From ab0898c44bdcf5d27ea4b04757bb102fdf50f4df Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Thu, 10 Feb 2022 05:32:17 -0600 Subject: [PATCH] 1 - Astrum Aureus takes 1% of its health in damage every time it spawns an Aureus Spawn in Death Mode. 2 - Aureus Spawns charge the player for 10 seconds instead of 5 seconds in Death Mode, before exploding. 3 - Aureus Spawns push away from each other in Death Mode. 4 - Aureus Spawns fire Astral Flames every 3 seconds in Death Mode when not in their charging phase. 5 - Astrum Aureus Astral Flame barrage spreads out far more in Death Mode. 6 - Final Astrum Deus worm in Death Mode does not vanish when the first worm dies and instead goes berserk, decreasing defense and DR to 0, increasing charge speed and allowing both types of projectiles to be fired at the same time. 7 - Removed the slightly random spread from Brimling fireballs. 8 - Removed more timed DR leftovers. --- NPCs/AstrumAureus/AstrumAureus.cs | 6 +- NPCs/AstrumAureus/AureusSpawn.cs | 54 +++++++- NPCs/AstrumDeus/AstrumDeusBodySpectral.cs | 9 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 16 +-- NPCs/AstrumDeus/AstrumDeusTailSpectral.cs | 9 +- NPCs/BrimstoneElemental/Brimling.cs | 4 +- NPCs/CalamityAI.cs | 131 ++++++++++++++---- NPCs/CalamityGlobalNPC.cs | 3 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 3 - NPCs/Perforator/PerforatorBodyMedium.cs | 4 - .../Bosses/EaterOfWorldsAI.cs | 4 - Utilities/NPCStats.cs | 1 + 12 files changed, 181 insertions(+), 63 deletions(-) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index f6de8faaff..2f00bda95e 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -73,7 +73,8 @@ namespace CalamityMod.NPCs.AstrumAureus writer.Write(npc.dontTakeDamage); writer.Write(npc.chaseable); writer.Write(npc.alpha); - for (int i = 0; i < 4; i++) + writer.Write(npc.localAI[2]); + for (int i = 0; i < 4; i++) writer.Write(npc.Calamity().newAI[i]); } @@ -83,7 +84,8 @@ namespace CalamityMod.NPCs.AstrumAureus npc.dontTakeDamage = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); npc.alpha = reader.ReadInt32(); - for (int i = 0; i < 4; i++) + npc.localAI[2] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) npc.Calamity().newAI[i] = reader.ReadSingle(); } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 5551a80c93..f1925534a7 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -87,7 +89,7 @@ namespace CalamityMod.NPCs.AstrumAureus Point point15 = npc.Center.ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(point15); bool flag121 = tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !Main.tileSolidTop[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]; - if (npc.ai[1] > 300f) + if (npc.ai[1] > ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 600f : 300f)) { npc.Calamity().newAI[0] += 1f; npc.scale = MathHelper.Lerp(1f, 2f, npc.Calamity().newAI[0] / 45f); @@ -109,6 +111,33 @@ namespace CalamityMod.NPCs.AstrumAureus num1374 *= num1376; npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + + if (CalamityWorld.death || BossRushEvent.BossRushActive) + { + float pushVelocity = 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 320f) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X = npc.velocity.X - pushVelocity; + else + npc.velocity.X = npc.velocity.X + pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y = npc.velocity.Y - pushVelocity; + else + npc.velocity.Y = npc.velocity.Y + pushVelocity; + } + } + } + } + } + return; } @@ -123,6 +152,29 @@ namespace CalamityMod.NPCs.AstrumAureus } } + if (CalamityWorld.death || BossRushEvent.BossRushActive) + { + npc.localAI[0] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + { + npc.localAI[0] = 0f; + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, type, damage, 0f, Main.myPlayer); + } + } + } + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); Vector2 vector251 = Main.player[npc.target].Center - value53; bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index e73d1f0158..ca3d019ee6 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -90,14 +90,15 @@ namespace CalamityMod.NPCs.AstrumDeus bool altBodyTextures = npc.localAI[3] == 1f; bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + bool deathModeEnragePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; Texture2D texture2D15 = altBodyTextures ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral") : Main.npcTexture[npc.type]; Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2"); Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; - int num153 = 5; + int num153 = deathModeEnragePhase ? 10 : 5; if (CalamityConfig.Instance.Afterimages) { @@ -151,13 +152,13 @@ namespace CalamityMod.NPCs.AstrumDeus } } - int timesToDraw = drawCyan ? 1 : 2; + int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); if (!altBodyTextures) { - timesToDraw = drawCyan ? 2 : 1; + timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 17bfebe549..2b9b7211bc 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -19,7 +19,6 @@ using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus @@ -104,14 +103,15 @@ namespace CalamityMod.NPCs.AstrumDeus spriteEffects = SpriteEffects.FlipHorizontally; bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + bool deathModeEnragePhase = npc.Calamity().newAI[0] == 3f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture2D15 = Main.npcTexture[npc.type]; + Texture2D texture2D15 = Main.npcTexture[npc.type]; Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2"); Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; - int num153 = 5; + int num153 = deathModeEnragePhase ? 10 : 5; if (CalamityConfig.Instance.Afterimages) { @@ -162,11 +162,11 @@ namespace CalamityMod.NPCs.AstrumDeus } } - int timesToDraw = drawCyan ? 1 : 2; + int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - timesToDraw = drawCyan ? 2 : 1; + timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -208,7 +208,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool SpecialNPCLoot() { - if (npc.Calamity().newAI[0] == 0f) + if (npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f)) return false; int closestSegmentID = DropHelper.FindClosestWormSegment(npc, @@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override bool PreNPCLoot() { // Unsplit Deus does not drop anything when killed/despawned. - if (npc.Calamity().newAI[0] == 0f) + if (npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f)) return false; // Killing ANY split Deus makes all other Deus heads die immediately. diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index b22443fc2c..ac994eac13 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -89,13 +89,14 @@ namespace CalamityMod.NPCs.AstrumDeus spriteEffects = SpriteEffects.FlipHorizontally; bool drawCyan = npc.Calamity().newAI[3] >= 600f; - bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + bool deathModeEnragePhase = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture2D15 = Main.npcTexture[npc.type]; + Texture2D texture2D15 = Main.npcTexture[npc.type]; Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; - int num153 = 5; + int num153 = deathModeEnragePhase ? 10 : 5; if (CalamityConfig.Instance.Afterimages) { @@ -139,7 +140,7 @@ namespace CalamityMod.NPCs.AstrumDeus } } - int timesToDraw = drawCyan ? 2 : 1; + int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 38dbd9ae96..bc4b28f2a3 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -114,8 +114,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental { float speed = 5f; Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X; + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y; float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); num8 = speed / num8; num6 *= num8; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 2932a656d2..02792be92f 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -289,7 +289,7 @@ namespace CalamityMod.NPCs { Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401) * 0.01f; + vector15 *= Main.rand.Next(death ? 200 : 50, 401) * 0.01f; float maximumVelocityMult = death ? 0.35f : 0.25f; if (expertMode) @@ -2698,7 +2698,7 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); - float velocity = death ? 8f : 7f; + float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); if (postMoonLordBuff) @@ -3112,8 +3112,15 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (phase3) - npc.localAI[1] += 1f; + if (death) + npc.localAI[2] += 1f + 0.33f * (1f - lifeRatio); + + if (phase3) + { + npc.localAI[1] += 1f; + if (death) + npc.localAI[2] += 1f + 0.33f * (1f - lifeRatio); + } if (npc.localAI[1] >= ((malice ? 120f : 240f) - (death ? 60f * (1f - lifeRatio) : 0f))) { @@ -3121,8 +3128,22 @@ namespace CalamityMod.NPCs bool spawnFlag = revenge; if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); + + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); + + if (death) + { + int damageAmt = npc.lifeMax / 100; + npc.life -= damageAmt; + if (npc.life < 1) + npc.life = 1; + + npc.HealEffect(-damageAmt, true); + npc.netUpdate = true; + } + } // Reset localAI and find a teleport destination npc.TargetClosest(); @@ -3164,8 +3185,17 @@ namespace CalamityMod.NPCs npc.chaseable = false; npc.dontTakeDamage = true; - // Turn invisible - npc.alpha += 10; + if (death) + npc.localAI[2] += 1f + 0.33f * (1f - lifeRatio); + + if (phase3) + { + if (death) + npc.localAI[2] += 1f + 0.33f * (1f - lifeRatio); + } + + // Turn invisible + npc.alpha += 10; if (npc.alpha >= 255) { // Set position to teleport destination @@ -3175,6 +3205,7 @@ namespace CalamityMod.NPCs // Reset alpha and set AI to next phase (End of teleport) npc.alpha = 255; npc.ai[0] = 7f; + npc.localAI[2] = 0f; npc.netUpdate = true; } @@ -3205,8 +3236,22 @@ namespace CalamityMod.NPCs bool spawnFlag = phase3; if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); + + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); + + if (death) + { + int damageAmt = npc.lifeMax / 100; + npc.life -= damageAmt; + if (npc.life < 1) + npc.life = 1; + + npc.HealEffect(-damageAmt, true); + npc.netUpdate = true; + } + } // Become vulnerable npc.chaseable = true; @@ -3308,19 +3353,14 @@ namespace CalamityMod.NPCs bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; bool doubleLasersAndSplittingMines = lifeRatio < 0.7f; bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing float resistanceTime = doubleWormPhase ? 300f : 600f; if (calamityGlobalNPC.newAI[1] < resistanceTime) calamityGlobalNPC.newAI[1] += 1f; - // Set timed DR - if (!doubleWormPhase) - { - if (calamityGlobalNPC.AITimer < 3600) - calamityGlobalNPC.AITimer = 3600; - } - // Flight timer float aiSwitchTimer = doubleWormPhase ? 1200f : 1800f; calamityGlobalNPC.newAI[3] += 1f; @@ -3338,8 +3378,17 @@ namespace CalamityMod.NPCs // Split into two worms if (head) { + bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; + bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; + if (deathModeFinalWormEnrage) + { + calamityGlobalNPC.newAI[0] = 3f; + npc.defense = 0; + calamityGlobalNPC.DR = 0f; + } + float splitAnimationTime = 180f; - bool despawnRemainingWorm = doubleWormPhase && NPC.CountNPCS(ModContent.NPCType()) < 2; + bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) { npc.dontTakeDamage = true; @@ -3434,11 +3483,18 @@ namespace CalamityMod.NPCs } } - // Copy dontTakeDamage and Opacity from previous segment + // Copy dontTakeDamage and Opacity from head else { npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; + + if (deathModeEnragePhase_BodyAndTail) + { + npc.defense = 0; + calamityGlobalNPC.DR = 0f; + } } // Set worm variable @@ -3621,7 +3677,7 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; // Despawn - float fallSpeed = death ? 17.5f : 16f; + float fallSpeed = deathModeEnragePhase_Head ? 22f : death ? 17.5f : 16f; if (player.dead) { flag2 = false; @@ -3629,7 +3685,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= velocity; if ((double)npc.position.Y < Main.topWorld + 16f) { - fallSpeed = 32f; + fallSpeed = deathModeEnragePhase_Head ? 44f : death ? 35f : 32f; npc.velocity.Y -= velocity; } @@ -3656,14 +3712,14 @@ namespace CalamityMod.NPCs // Speed and movement float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); - float speed = (death ? 0.18f : 0.13f) + speedBoost; - float turnSpeed = (death ? 0.25f : 0.2f) + turnSpeedBoost; + float speed = (deathModeEnragePhase_Head ? 0.23f : death ? 0.18f : 0.13f) + speedBoost; + float turnSpeed = (deathModeEnragePhase_Head ? 0.3f : death ? 0.25f : 0.2f) + turnSpeedBoost; speed += 0.05f * enrageScale; turnSpeed += 0.08f * enrageScale; if (flyAtTarget) { - float speedMultiplier = doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; + float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; speed *= speedMultiplier; } @@ -3862,14 +3918,31 @@ namespace CalamityMod.NPCs float shootProjectile = 400 / shootTime; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; - if (!flyAtTarget) + if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) { if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { npc.TargetClosest(); + + if (deathModeEnragePhase_BodyAndTail) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= Main.rand.Next(90, 121) * 0.01f; + velocity = vector15; + } + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float split = (doubleLasersAndSplittingMines && npc.ai[0] % 4f == 0f) ? 1f : 0f; + Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + } + if (Vector2.Distance(player.Center, npc.Center) > 80f) { - Main.PlaySound(phase2 ? SoundID.Item91 : SoundID.Item12, npc.Center); + Main.PlaySound((phase2 || deathModeEnragePhase_BodyAndTail) ? SoundID.Item91 : SoundID.Item12, npc.Center); float num941 = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); float num942 = player.position.X + player.width * 0.5f - vector104.X; @@ -3882,9 +3955,9 @@ namespace CalamityMod.NPCs vector104.Y += num943 * 5f; Vector2 shootDirection = new Vector2(num942, num943).SafeNormalize(Vector2.UnitY); Vector2 laserVelocity = shootDirection * num941; - int type = phase2 ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int type = (phase2 || deathModeEnragePhase_BodyAndTail) ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - if (phase2) + if (phase2 || deathModeEnragePhase_BodyAndTail) { // Waving beams need to start offset so they cross each other neatly. float waveSideOffset = Main.rand.NextFloat(9f, 14f); @@ -3923,7 +3996,7 @@ namespace CalamityMod.NPCs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); float split = (doubleLasersAndSplittingMines && npc.ai[0] % 4f == 0f) ? 1f : 0f; - int proj = Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index af7d99dd0a..0dba6642c3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2598,8 +2598,7 @@ namespace CalamityMod.NPCs } } - bool DoGSentinelPhase = CalamityLists.DevourerOfGodsIDs.Contains(npc.type) && npc.life / (float)npc.lifeMax < 0.6f && CalamityWorld.DoGSecondStageCountdown > 60; - if (npc.type != NPCType() && !DoGSentinelPhase) + if (npc.type != NPCType()) { if (AITimer < KillTime) AITimer++; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 6f33bb1461..bc2c1857e9 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -363,9 +363,6 @@ namespace CalamityMod.NPCs.DevourerofGods { Phase2Started = true; - // Timed DR - calamityGlobalNPC.AITimer = CalamityGlobalNPC.DoGPhase1KillTime; - // Reset important shit npc.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index c61ce05646..d8b2d12ac7 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -104,28 +104,24 @@ namespace CalamityMod.NPCs.Perforator int whoAmI = npc.whoAmI; float num25 = npc.life / (float)npc.lifeMax; float num26 = npc.ai[0]; - int aiTimer = npc.Calamity().AITimer; npc.SetDefaultsKeepPlayerInteraction(npc.type); npc.life = (int)(npc.lifeMax * num25); npc.ai[0] = num26; npc.TargetClosest(true); npc.netUpdate = true; npc.whoAmI = whoAmI; - npc.Calamity().AITimer = aiTimer; } if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle) { int whoAmI2 = npc.whoAmI; float num27 = npc.life / (float)npc.lifeMax; float num28 = npc.ai[1]; - int aiTimer = npc.Calamity().AITimer; npc.SetDefaultsKeepPlayerInteraction(npc.type); npc.life = (int)(npc.lifeMax * num27); npc.ai[1] = num28; npc.TargetClosest(true); npc.netUpdate = true; npc.whoAmI = whoAmI2; - npc.Calamity().AITimer = aiTimer; } if (!npc.active && Main.netMode == NetmodeID.Server) diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 5f76bda816..ed76a5c9e0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -186,7 +186,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int whoAmI = npc.whoAmI; float ai0Holdover = npc.ai[0]; float newAI1Holdover = calamityGlobalNPC.newAI[1]; - int aiTimer = calamityGlobalNPC.AITimer; int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; // Actually transform the body segment into a head segment. @@ -197,7 +196,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Heads spawned mid fight by splitting do not get reset spawn invincibility. CalamityGlobalNPC newCGN = npc.Calamity(); newCGN.newAI[1] = newAI1Holdover; - newCGN.AITimer = aiTimer; newCGN.debuffResistanceTimer = slowingDebuffResistTimer; npc.TargetClosest(); npc.netUpdate = true; @@ -211,7 +209,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float segmentLifeRatio = npc.life / (float)npc.lifeMax; int whoAmI = npc.whoAmI; float ai1Holdover = npc.ai[1]; - int aiTimer = calamityGlobalNPC.AITimer; int slowingDebuffResistTimer = calamityGlobalNPC.debuffResistanceTimer; // Actually transform the body segment into a tail segment. @@ -219,7 +216,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.life = (int)(npc.lifeMax * segmentLifeRatio); npc.whoAmI = whoAmI; npc.ai[1] = ai1Holdover; - npc.Calamity().AITimer = aiTimer; npc.Calamity().debuffResistanceTimer = slowingDebuffResistTimer; npc.TargetClosest(); npc.netUpdate = true; diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index 22fcf776f2..942dea6426 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -647,6 +647,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 74, 128, 148, 160, 222 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 140, 160, 172, 252 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 74, 128, 148, 160, 222 } }, { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 58, 116, 148, 160, 222 } }, { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 56, 112, 140, 152, 210 } },