From b50df59a295ff2deff5d91b6ba47e94fe1e659c7 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 12 Aug 2021 09:36:58 -0500 Subject: [PATCH] 1 - Buffed Malice Mode Ravager, Slime God, Duke Fishron and Moon Lord. 2 - Malice Mode Cal Clone, Duke Fishron and Spazmatism rotate in the direction they're about to charge when using predictive charges. --- NPCs/CalamityAI.cs | 21 ++++- NPCs/CalamityGlobalAI.cs | 138 +++++++++++++++++++++--------- NPCs/Ravager/RavagerBody.cs | 2 +- NPCs/Ravager/RavagerHead2.cs | 5 +- NPCs/SlimeGod/SlimeGod.cs | 4 +- NPCs/SlimeGod/SlimeGodCore.cs | 2 +- NPCs/SlimeGod/SlimeGodRun.cs | 4 +- NPCs/SlimeGod/SlimeGodRunSplit.cs | 4 +- NPCs/SlimeGod/SlimeGodSplit.cs | 4 +- Projectiles/Boss/RavagerFlame.cs | 4 +- Projectiles/Boss/ScavengerNuke.cs | 7 +- 11 files changed, 138 insertions(+), 57 deletions(-) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index a9b65b55c1..9cf40b3f61 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1403,9 +1403,24 @@ namespace CalamityMod.NPCs } // Rotation - float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; + /*float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); + float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2);*/ + + Vector2 rotationVector = Main.player[npc.target].Center - npc.Center; + + // Malice Mode predictive charge rotation + if (npc.ai[1] == 4f && phase5 && malice) + { + // Velocity + float chargeVelocity = 30f; + chargeVelocity += 5f * enrageScale; + if (provy) + chargeVelocity *= 1.25f; + + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; + } + + float num803 = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; if (num803 < 0f) num803 += MathHelper.TwoPi; else if (num803 > MathHelper.TwoPi) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 0a47be5d61..3d68181940 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -6394,11 +6394,24 @@ namespace CalamityMod.NPCs bool enrage = lifeRatio < 0.25f; - // Rotation - float num418 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float num419 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + // Rotation + /*float num418 = npc.Center.X - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num419 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2);*/ + Vector2 rotationVector = Main.player[npc.target].Center - npc.Center; - float num420 = (float)Math.Atan2(num419, num418) + MathHelper.PiOver2; + // Malice Mode predictive charge rotation + if (npc.ai[1] == 5f && !retAlive && malice) + { + // Velocity + float chargeVelocity = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); + chargeVelocity += 10f * enrageScale; + if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == 4f)) + chargeVelocity *= 1.3f; + + rotationVector = Vector2.Normalize(Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center) * chargeVelocity; + } + + float num420 = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; if (num420 < 0f) num420 += MathHelper.TwoPi; else if (num420 > MathHelper.TwoPi) @@ -7058,23 +7071,13 @@ namespace CalamityMod.NPCs float fireRate = retAlive ? 30f : 20f; if (npc.ai[2] % fireRate == 0f) { - Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num430 = 16f; + float velocity = 16f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - - float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - vector44.X += num427 * 4f; - vector44.Y += num428 * 4f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + (!retAlive && malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * velocity; + Projectile.NewProjectile(npc.Center + Vector2.Normalize(projectileVelocity) * 4f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); } } @@ -10975,8 +10978,25 @@ namespace CalamityMod.NPCs } } - // Rotation - float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + // Rotation + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) + rateOfRotation = 0.01f; + + Vector2 rotationVector = player.Center - vector; + if (!player.dead && malice && phase4) + { + // Rotate to show direction of predictive charge + if (npc.ai[0] == 10f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + } + } + + float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) num17 += MathHelper.Pi; if (num17 < 0f) @@ -10986,14 +11006,8 @@ namespace CalamityMod.NPCs if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) num17 = 0f; - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) - num18 = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) - num18 = 0.01f; - - if (num18 != 0f) - npc.rotation = npc.rotation.AngleTowards(num17, num18); + if (rateOfRotation != 0f) + npc.rotation = npc.rotation.AngleTowards(num17, rateOfRotation); // Alpha adjustments if (npc.ai[0] != -1f && npc.ai[0] < 9f) @@ -11665,7 +11679,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.velocity = Vector2.Normalize(player.Center + (malice && phase4 ? player.velocity * 20f : Vector2.Zero) - vector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -13019,10 +13033,10 @@ namespace CalamityMod.NPCs } if (malice) - aggressionLevel = 4; + aggressionLevel = 5; if (enraged) - aggressionLevel = 5; + aggressionLevel = 6; npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; @@ -13154,6 +13168,9 @@ namespace CalamityMod.NPCs float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -13230,6 +13247,9 @@ namespace CalamityMod.NPCs float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -13713,8 +13733,11 @@ namespace CalamityMod.NPCs switch (aggressionLevel) { + case 6: + calamityGlobalNPC.newAI[1] -= 180f; + break; case 5: - calamityGlobalNPC.newAI[1] -= 120f; + calamityGlobalNPC.newAI[1] -= 90f; break; case 4: break; @@ -13833,8 +13856,11 @@ namespace CalamityMod.NPCs bool shootThirdBolt = num1207 == num1208; switch (aggressionLevel) { + case 6: + v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; + break; case 5: - v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 40f - npc.Center; + v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; break; case 4: break; @@ -13869,9 +13895,8 @@ namespace CalamityMod.NPCs float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) { + case 6: case 5: - velocity += 2f; - break; case 4: break; case 3: @@ -14019,8 +14044,11 @@ namespace CalamityMod.NPCs float velocity = death ? 7.75f : 7.5f; switch (aggressionLevel) { + case 6: + velocity += 3f; + break; case 5: - velocity += 2f; + velocity += 1.5f; break; case 4: break; @@ -14057,6 +14085,9 @@ namespace CalamityMod.NPCs float divisor = 6f; switch (aggressionLevel) { + case 6: + divisor = 3f; + break; case 5: divisor = 4f; break; @@ -14099,6 +14130,8 @@ namespace CalamityMod.NPCs float velocity = death ? 3.5f : 3f; switch (aggressionLevel) { + case 6: + case 5: case 4: break; case 3: @@ -14120,7 +14153,7 @@ namespace CalamityMod.NPCs int damage = npc.GetProjectileDamage(type); int proj = Projectile.NewProjectile(vector169, vector170, type, damage, 0f, Main.myPlayer, 0f, ai); Main.projectile[proj].timeLeft = 1200; - Main.projectile[proj].Calamity().lineColor = aggressionLevel; + Main.projectile[proj].Calamity().lineColor = (malice || enraged) ? 1 : aggressionLevel; } } else @@ -14149,6 +14182,9 @@ namespace CalamityMod.NPCs float velocityMultiplier = death ? 0.88f : 0.885f; switch (aggressionLevel) { + case 6: + velocityMultiplier -= 0.04f; + break; case 5: velocityMultiplier -= 0.02f; break; @@ -14178,6 +14214,9 @@ namespace CalamityMod.NPCs float velocity = death ? 11f : 10f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -14207,9 +14246,12 @@ namespace CalamityMod.NPCs int divisor = 30; switch (aggressionLevel) { - case 5: + case 6: divisor = 15; break; + case 5: + divisor = 20; + break; case 4: break; case 3: @@ -14247,6 +14289,9 @@ namespace CalamityMod.NPCs float velocity = death ? 26.5f : 24f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -14297,8 +14342,11 @@ namespace CalamityMod.NPCs float velocity = death ? 2.2f : 2f; switch (aggressionLevel) { + case 6: + velocity += 3f; + break; case 5: - velocity += 2f; + velocity += 1.5f; break; case 4: break; @@ -14337,6 +14385,9 @@ namespace CalamityMod.NPCs float velocity = death ? 19.75f : 17.5f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -14371,6 +14422,9 @@ namespace CalamityMod.NPCs float velocity = death ? 11f : 10f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; case 5: velocity += 2f; break; @@ -14409,8 +14463,11 @@ namespace CalamityMod.NPCs bool shootThirdBolt = num1178 == num1179; switch (aggressionLevel) { + case 6: + v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; + break; case 5: - v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 40f - npc.Center; + v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; break; case 4: break; @@ -14446,9 +14503,8 @@ namespace CalamityMod.NPCs float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) { + case 6: case 5: - velocity += 2f; - break; case 4: break; case 3: diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index b2fd9a1f86..8c498eeab0 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -592,7 +592,7 @@ namespace CalamityMod.NPCs.Ravager float maxFallSpeed = npc.ai[0] == 2f ? 24f : 15f; if (malice) { - gravity *= 2f; + gravity *= 1.25f; maxFallSpeed *= 1.25f; } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 0b65ef701f..98ecbe1d8a 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -43,7 +43,8 @@ namespace CalamityMod.NPCs.Ravager return; } - bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; if (npc.timeLeft < 1800) @@ -95,7 +96,7 @@ namespace CalamityMod.NPCs.Ravager npc.rotation = num803; npc.ai[1] += 1f; - bool fireProjectiles = npc.ai[1] >= 480f; + bool fireProjectiles = npc.ai[1] >= (malice ? 240f : 480f); if (fireProjectiles && Vector2.Distance(npc.Center, player.Center) > 80f) { int type = ModContent.ProjectileType(); diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 4cb42dba5f..7049ec45c8 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); if (npc.life / (float)npc.lifeMax <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { @@ -157,6 +157,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[0] += enraged ? 6f : flag100 ? 1f : 2f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) { diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 1ce4c50f6a..47ec486b3d 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[0] = 0f; npc.localAI[1] = 0f; float chargeVelocity = death ? 12f : 9f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeVelocity; + npc.velocity = Vector2.Normalize(player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - vectorCenter) * chargeVelocity; npc.TargetClosest(); return; } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 55389a895d..d3c40f9be0 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); if (npc.life / (float)npc.lifeMax <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { @@ -167,6 +167,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[0] += enraged ? 6f : flag100 ? 1f : 2f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) { diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 6ac3751e06..94e2f8cf41 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; @@ -152,6 +152,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[0] += enraged ? 3f : flag100 ? 0.5f : 1f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) { diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 7cdd88736a..27d62a9839 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; @@ -146,6 +146,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[0] += enraged ? 3f : flag100 ? 0.5f : 1f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) { diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 81d08fe15c..dbce83205c 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = 1; projectile.timeLeft = 300; projectile.aiStyle = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = CalamityWorld.malice ? 2 : 1; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 26db926959..bf0ea05ad3 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -30,7 +30,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; if (projectile.timeLeft < 180) projectile.tileCollide = true; @@ -46,8 +47,8 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - float inertia = revenge ? 90f : 110f; - float scaleFactor12 = revenge ? 16f : 12f; + float inertia = malice ? 70f : revenge ? 90f : 110f; + float scaleFactor12 = malice ? 20f : revenge ? 16f : 12f; if (projectile.alpha > 0) projectile.alpha -= 10;