diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 10fc30c52e..377d05d27f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2630,14 +2630,13 @@ namespace CalamityMod.NPCs ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - bool destroyerResist = CalamityLists.DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || BossRushEvent.BossRushActive); bool eaterofWorldsResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive; - if (destroyerResist || eaterofWorldsResist || CalamityLists.AstrumDeusIDs.Contains(npc.type)) - { - float resistanceGateValue = (CalamityLists.AstrumDeusIDs.Contains(npc.type) && newAI[0] != 0f) ? 300f : 600f; - if (newAI[1] < resistanceGateValue || (newAI[2] > 0f && CalamityLists.DestroyerIDs.Contains(npc.type))) - modifiers.FinalDamage *= 0.01f; - } + if (CalamityLists.DestroyerIDs.Contains(npc.type)) + modifiers.FinalDamage *= 1f - MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncraeseTime, 0f, 1f)); + if (CalamityLists.AstrumDeusIDs.Contains(npc.type)) + modifiers.FinalDamage *= 1f - MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / (newAI[0] != 0f ? 300f : 600f), 0f, 1f)); + if (eaterofWorldsResist) + modifiers.FinalDamage *= 0.01f; // Large Deus worm takes reduced damage in order to last a long enough time. // TODO -- WHY DOES DEUS HAVE THIS UNDOCUMENTED MULTIPLIER HERE?? @@ -3138,10 +3137,10 @@ namespace CalamityMod.NPCs case NPCID.GolemHeadFree: return GolemAI.VanillaGolemHeadFreeAI(npc, Mod); - /*case NPCID.DukeFishron: + case NPCID.DukeFishron: return DukeFishronAI.VanillaDukeFishronAI(npc, Mod); - case NPCID.CultistBoss: + /*case NPCID.CultistBoss: case NPCID.CultistBossClone: return CultistAI.VanillaCultistAI(npc, Mod); case NPCID.AncientLight: diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index e57258ea7c..e263cbc7d2 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -352,6 +352,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense *= 2; NPC.damage = NPC.defDamage * 2; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) { NPC.localAI[0] += 1f; @@ -455,6 +457,9 @@ namespace CalamityMod.NPCs.NormalNPCs calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + if (NPC.IsMechQueenUp) NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); else diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index c416a6244b..e18bf6459d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -14,6 +14,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class DestroyerAI { + public const float DRIncraeseTime = 600f; + public static bool BuffedDestroyerAI(NPC npc, Mod mod) { int mechdusaCurvedSpineSegmentIndex = 0; @@ -51,10 +53,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool death = CalamityWorld.death || bossRush; // 10 seconds of resistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 600f) + if (calamityGlobalNPC.newAI[1] < DRIncraeseTime) calamityGlobalNPC.newAI[1] += 1f; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < 600f; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < DRIncraeseTime; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -129,7 +131,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Phase for flying at the player - bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase) || (calamityGlobalNPC.newAI[1] < 600f && calamityGlobalNPC.newAI[1] > 60f); + bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase) || (calamityGlobalNPC.newAI[1] < DRIncraeseTime && calamityGlobalNPC.newAI[1] > 60f); // Dust on spawn and alpha effects if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) @@ -775,6 +777,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } + // 10 seconds of resistance to prevent spawn killing + if (npc.Calamity().newAI[1] < DRIncraeseTime) + npc.Calamity().newAI[1] += 1f; + + npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.Calamity().newAI[1] < DRIncraeseTime; + if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs index 338ce7f742..9e085e85d5 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs @@ -29,21 +29,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool charging = npc.ai[3] < 10f; // Adjust stats + int setDamage = npc.defDamage; if (phase3AI) { - npc.damage = (int)(npc.defDamage * 1.32f); + setDamage = (int)(setDamage * 1.32f); npc.defense = 0; } else if (phase2AI) { - npc.damage = (int)(npc.defDamage * 1.44f); + setDamage = (int)(setDamage * 1.44f); npc.defense = (int)(npc.defDefense * 0.8f); } else - { - npc.damage = npc.defDamage; npc.defense = npc.defDefense; - } int idlePhaseTimer = 30; float idlePhaseAcceleration = 0.55f; @@ -155,7 +153,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); - npc.Calamity().CurrentlyEnraged = !bossRush && enrage; + calamityGlobalNPC.CurrentlyEnraged = !bossRush && enrage; // Make him always able to take damage npc.dontTakeDamage = false; @@ -181,7 +179,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!bossRush) { - npc.damage = npc.defDamage * 2; + setDamage *= 2; npc.defense = npc.defDefense * 3; } } @@ -266,6 +264,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn effects if (npc.ai[0] == -1f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity npc.velocity *= 0.98f; @@ -321,6 +322,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 1 else if (npc.ai[0] == 0f && !player.dead) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -378,6 +382,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set velocity for charge if (attackPicker == 1) { + // Set damage + npc.damage = setDamage; + npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -429,6 +436,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else if (npc.ai[0] == 1f) { + // Set damage + npc.damage = setDamage; + // Accelerate npc.velocity *= 1.01f; @@ -460,6 +470,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Bubble belch else if (npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -506,6 +519,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Sharknado spawn else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -543,6 +559,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Transition to phase 2 else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -566,6 +585,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 2 else if (npc.ai[0] == 5f && !player.dead) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -619,6 +641,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set velocity for charge if (phase2AttackPicker == 1) { + // Set damage + npc.damage = setDamage; + npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -642,6 +667,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set velocity for spin else if (phase2AttackPicker == 2) { + // Set damage + npc.damage = setDamage; + // Velocity and rotation npc.velocity = Vector2.Normalize(player.Center - npc.Center) * bubbleSpinPhaseVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -685,6 +713,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else if (npc.ai[0] == 6f) { + // Set damage + npc.damage = setDamage; + // Accelerate npc.velocity *= 1.01f; @@ -716,6 +747,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Bubble spin else if (npc.ai[0] == 7f) { + // Set damage + npc.damage = setDamage; + // Play sounds and spawn bubbles if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); @@ -759,6 +793,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn cthulhunado else if (npc.ai[0] == 8f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -784,6 +821,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Transition to phase 3 else if (npc.ai[0] == 9f) { + // Avoid cheap bullshit + npc.damage = 0; + // Alpha adjustments if (npc.ai[2] < phaseTransitionTimer - 90) { @@ -914,6 +954,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set velocity for charge if (phase3AttackPicker == 1) { + // Set damage + npc.damage = setDamage; + npc.ai[0] = 11f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -949,6 +992,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else if (npc.ai[0] == 11f) { + // Set damage + npc.damage = setDamage; + // Accelerate npc.velocity *= 1.01f; @@ -1052,5 +1098,999 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } + + public static bool VanillaDukeFishronAI(NPC npc, Mod mod) + { + bool expertMode = Main.expertMode; + bool masterMode = Main.masterMode; + + float damageScale = expertMode ? 1.2f : 1f; + float phase2LifeRatio = masterMode ? 0.6f : 0.5f; + float phase3LifeRatio = masterMode ? 0.25f : 0.15f; + bool flag = npc.life <= npc.lifeMax * phase2LifeRatio; + bool flag2 = expertMode && npc.life <= npc.lifeMax * phase3LifeRatio; + bool flag3 = npc.ai[0] > 4f; + bool flag4 = npc.ai[0] > 9f; + bool flag5 = npc.ai[3] < 10f; + + int setDamage = npc.defDamage; + if (flag4) + { + setDamage = (int)(setDamage * 1.1f * damageScale); + npc.defense = 0; + } + else if (flag3) + { + setDamage = (int)(setDamage * 1.2f * damageScale); + npc.defense = (int)((float)npc.defDefense * 0.8f); + } + else + npc.defense = npc.defDefense; + + int num2 = (masterMode ? 30 : expertMode ? 40 : 60); + float num3 = (masterMode ? 0.65f : expertMode ? 0.55f : 0.45f); + float num4 = (masterMode ? 9.5f : expertMode ? 8.5f : 7.5f); + if (flag4) + { + num3 = masterMode ? 0.8f : 0.7f; + num4 = masterMode ? 13f : 12f; + num2 = masterMode ? 20 : 30; + } + else if (flag3 && flag5) + { + num3 = (masterMode ? 0.7f : expertMode ? 0.6f : 0.5f); + num4 = (masterMode ? 12f : expertMode ? 10f : 8f); + num2 = (masterMode ? 35 : expertMode ? 40 : 20); + } + else if (flag5 && !flag3 && !flag4) + num2 = masterMode ? 25 : 30; + + int num5 = (masterMode ? 25 : expertMode ? 28 : 30); + float num6 = (masterMode ? 18f : expertMode ? 17f : 16f); + if (flag4) + { + num5 = masterMode ? 20 : 25; + num6 = masterMode ? 29f : 27f; + } + else if (flag5 && flag3) + { + num5 = (masterMode ? 24 : expertMode ? 27 : 30); + if (expertMode) + num6 = masterMode ? 24f : 21f; + } + + int num7 = masterMode ? 40 : 80; + int num8 = masterMode ? 2 : 4; + float num9 = masterMode ? 0.5f : 0.3f; + float num10 = masterMode ? 8f : 5f; + int num11 = masterMode ? 60 : 90; + int num12 = 180; + int num13 = 180; + int num14 = 30; + int num15 = masterMode ? 60 : 120; + int num16 = masterMode ? 2 : 4; + float num17 = masterMode ? 9f : 6f; + float num18 = 20f; + float num19 = MathHelper.TwoPi / (float)(num15 / 2); + int num20 = masterMode ? 50 : 75; + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > 5600f) + { + npc.TargetClosest(); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + + if (player.dead || Vector2.Distance(player.Center, center) > 5600f) + { + npc.velocity.Y -= 0.4f; + npc.EncourageDespawn(10); + if (npc.ai[0] > 4f) + npc.ai[0] = 5f; + else + npc.ai[0] = 0f; + + npc.ai[2] = 0f; + } + + bool enrage = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); + + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrage; + + // Increased DR during phase transitions + npc.Calamity().DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (BossRushEvent.BossRushActive ? 0.99f : 0.625f) : 0.15f; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; + + if (enrage) + { + num2 = masterMode ? 5 : 10; + setDamage *= 2; + npc.defense = npc.defDefense * 2; + num6 += (masterMode ? 12f : 6f); + } + + if (npc.localAI[0] == 0f) + { + npc.localAI[0] = 1f; + npc.alpha = 255; + npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[0] = -1f; + npc.netUpdate = true; + } + } + + float num21 = (float)Math.Atan2(player.Center.Y - center.Y, player.Center.X - center.X); + if (npc.spriteDirection == 1) + num21 += (float)Math.PI; + + if (num21 < 0f) + num21 += MathHelper.TwoPi; + + if (num21 > MathHelper.TwoPi) + num21 -= MathHelper.TwoPi; + + if (npc.ai[0] == -1f) + num21 = 0f; + + if (npc.ai[0] == 3f) + num21 = 0f; + + if (npc.ai[0] == 4f) + num21 = 0f; + + if (npc.ai[0] == 8f) + num21 = 0f; + + float num22 = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f) + num22 = 0f; + + if (npc.ai[0] == 7f) + num22 = 0f; + + if (npc.ai[0] == 3f) + num22 = 0.01f; + + if (npc.ai[0] == 4f) + num22 = 0.01f; + + if (npc.ai[0] == 8f) + num22 = 0.01f; + + if (npc.rotation < num21) + { + if ((double)(num21 - npc.rotation) > Math.PI) + npc.rotation -= num22; + else + npc.rotation += num22; + } + + if (npc.rotation > num21) + { + if ((double)(npc.rotation - num21) > Math.PI) + npc.rotation += num22; + else + npc.rotation -= num22; + } + + if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) + npc.rotation = num21; + + if (npc.rotation < 0f) + npc.rotation += MathHelper.TwoPi; + + if (npc.rotation > MathHelper.TwoPi) + npc.rotation -= MathHelper.TwoPi; + + if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) + npc.rotation = num21; + + if (npc.ai[0] != -1f && npc.ai[0] < 9f) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + + if (npc.ai[0] == -1f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + int num23 = Math.Sign(player.Center.X - center.X); + if (num23 != 0) + { + npc.direction = num23; + npc.spriteDirection = -npc.direction; + } + + if (npc.ai[2] > 20f) + { + npc.velocity.Y = -2f; + npc.alpha -= 5; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + + if (npc.ai[2] == (float)(num11 - 30)) + { + int num24 = 36; + for (int i = 0; i < num24; i++) + { + Vector2 vector = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((float)(i - (num24 / 2 - 1)) * MathHelper.TwoPi / (float)num24) + npc.Center; + Vector2 vector2 = vector - npc.Center; + int num25 = Dust.NewDust(vector + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num25].noGravity = true; + Main.dust[num25].noLight = true; + Main.dust[num25].velocity = Vector2.Normalize(vector2) * 3f; + } + + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num20) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 0f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + npc.velocity.X -= num3; + } + + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + npc.velocity.Y -= num3; + } + + int num26 = Math.Sign(player.Center.X - center.X); + if (num26 != 0) + { + if (npc.ai[2] == 0f && num26 != npc.direction) + npc.rotation += (float)Math.PI; + + npc.direction = num26; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num27 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + num27 = 1; + break; + case 10: + npc.ai[3] = 1f; + num27 = 2; + break; + case 11: + npc.ai[3] = 0f; + num27 = 3; + break; + } + + if (enrage && num27 == 2) + num27 = 3; + + if (flag) + num27 = 4; + + switch (num27) + { + case 1: + + // Set damage + npc.damage = setDamage; + + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num26 != 0) + { + npc.direction = num26; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + if (enrage) + npc.ai[2] = num11 - 40; + break; + + case 4: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + // Set damage + npc.damage = setDamage; + + int num28 = 7; + for (int j = 0; j < num28; j++) + { + Vector2 vector4 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(j - (num28 / 2 - 1)) * Math.PI / (double)(float)num28) + center; + Vector2 vector5 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num29 = Dust.NewDust(vector4 + vector5, 0, 0, 172, vector5.X * 2f, vector5.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num29].noGravity = true; + Main.dust[num29].noLight = true; + Main.dust[num29].velocity /= 4f; + Main.dust[num29].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector6 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num10; + if (npc.velocity.X < vector6.X) + { + npc.velocity.X += num9; + if (npc.velocity.X < 0f && vector6.X > 0f) + npc.velocity.X += num9; + } + else if (npc.velocity.X > vector6.X) + { + npc.velocity.X -= num9; + if (npc.velocity.X > 0f && vector6.X < 0f) + npc.velocity.X -= num9; + } + + if (npc.velocity.Y < vector6.Y) + { + npc.velocity.Y += num9; + if (npc.velocity.Y < 0f && vector6.Y > 0f) + npc.velocity.Y += num9; + } + else if (npc.velocity.Y > vector6.Y) + { + npc.velocity.Y -= num9; + if (npc.velocity.Y > 0f && vector6.Y < 0f) + npc.velocity.Y -= num9; + } + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % (float)num8 == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector7 = Vector2.Normalize(player.Center - center) * (npc.width + 20) / 2f + center; + NPC.NewNPC(npc.GetSource_FromAI(), (int)vector7.X, (int)vector7.Y + 45, NPCID.DetonatingBubble); + } + } + + int num30 = Math.Sign(player.Center.X - center.X); + if (num30 != 0) + { + npc.direction = num30; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num7) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num11 - 30)) + SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) + { + Vector2 vector8 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + center; + Vector2 sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? 12f : 8f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -Vector2.UnitX, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + if (masterMode) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -Vector2.UnitY, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity * -1f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 4f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num12 - 60)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num12) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 5f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector9 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + if (npc.velocity.X < vector9.X) + { + npc.velocity.X += num3; + if (npc.velocity.X < 0f && vector9.X > 0f) + npc.velocity.X += num3; + } + else if (npc.velocity.X > vector9.X) + { + npc.velocity.X -= num3; + if (npc.velocity.X > 0f && vector9.X < 0f) + npc.velocity.X -= num3; + } + + if (npc.velocity.Y < vector9.Y) + { + npc.velocity.Y += num3; + if (npc.velocity.Y < 0f && vector9.Y > 0f) + npc.velocity.Y += num3; + } + else if (npc.velocity.Y > vector9.Y) + { + npc.velocity.Y -= num3; + if (npc.velocity.Y > 0f && vector9.Y < 0f) + npc.velocity.Y -= num3; + } + + int num31 = Math.Sign(player.Center.X - center.X); + if (num31 != 0) + { + if (npc.ai[2] == 0f && num31 != npc.direction) + npc.rotation += (float)Math.PI; + + npc.direction = num31; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num32 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + num32 = 1; + break; + case 6: + npc.ai[3] = 1f; + num32 = 2; + break; + case 7: + npc.ai[3] = 0f; + num32 = 3; + break; + } + + if (flag2) + num32 = 4; + + if (enrage && num32 == 2) + num32 = 3; + + switch (num32) + { + case 1: + + // Set damage + npc.damage = setDamage; + + npc.ai[0] = 6f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num31 != 0) + { + npc.direction = num31; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + + // Set damage + npc.damage = setDamage; + + npc.velocity = Vector2.Normalize(player.Center - center) * num18; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num31 != 0) + { + npc.direction = num31; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 8f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 4: + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 6f) + { + // Set damage + npc.damage = setDamage; + + int num33 = 7; + for (int k = 0; k < num33; k++) + { + Vector2 vector10 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(k - (num33 / 2 - 1)) * Math.PI / (double)(float)num33) + center; + Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num34 = Dust.NewDust(vector10 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num34].noGravity = true; + Main.dust[num34].noLight = true; + Main.dust[num34].velocity /= 4f; + Main.dust[num34].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 2f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) + { + // Set damage + npc.damage = setDamage; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (npc.ai[2] % (float)num16 == 0f) + { + SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector12 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + center; + int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector12.X, (int)vector12.Y + 45, NPCID.DetonatingBubble); + Main.npc[num35].target = npc.target; + Main.npc[num35].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * (float)npc.direction) * num17; + Main.npc[num35].netUpdate = true; + Main.npc[num35].ai[3] = (float)Main.rand.Next(80, 121) / 100f; + } + } + + npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); + npc.rotation -= num19 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num15) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 8f) + { + // Avoid cheap bullshit + npc.damage = 0; + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num11 - 30)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) + Projectile.NewProjectile(npc.GetSource_FromAI(), center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num11) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[2] < (float)(num13 - 90)) + { + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.alpha += 15; + else + npc.alpha -= 15; + + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha > 150) + npc.alpha = 150; + } + else if (npc.alpha < 255) + { + npc.alpha += 4; + if (npc.alpha > 255) + npc.alpha = 255; + } + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num13 - 60)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num13) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 10f && !player.dead) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.alpha < 255) + { + npc.alpha += 25; + if (npc.alpha > 255) + npc.alpha = 255; + } + + if (npc.ai[1] == 0f) + npc.ai[1] = 360 * Math.Sign((center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; + npc.SimpleFlyMovement(desiredVelocity, num3); + int num36 = Math.Sign(player.Center.X - center.X); + if (num36 != 0) + { + if (npc.ai[2] == 0f && num36 != npc.direction) + { + npc.rotation += (float)Math.PI; + for (int l = 0; l < npc.oldPos.Length; l++) + npc.oldPos[l] = Vector2.Zero; + } + + npc.direction = num36; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + int num37 = 0; + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + num37 = 1; + break; + case 1: + case 4: + case 8: + num37 = 2; + break; + } + + switch (num37) + { + case 1: + + // Set damage + npc.damage = setDamage; + + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - center) * num6; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num36 != 0) + { + npc.direction = num36; + if (npc.spriteDirection == 1) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + break; + + case 2: + npc.ai[0] = 12f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + + case 3: + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + break; + } + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 11f) + { + // Set damage + npc.damage = setDamage; + + npc.alpha -= 25; + if (npc.alpha < 0) + npc.alpha = 0; + + int num38 = 7; + for (int m = 0; m < num38; m++) + { + Vector2 vector13 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(m - (num38 / 2 - 1)) * Math.PI / (double)(float)num38) + center; + Vector2 vector14 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num39 = Dust.NewDust(vector13 + vector14, 0, 0, 172, vector14.X * 2f, vector14.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num39].noGravity = true; + Main.dust[num39].noLight = true; + Main.dust[num39].velocity /= 4f; + Main.dust[num39].velocity -= npc.velocity; + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num5) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 12f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } + + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == (float)(num14 / 2)) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + if (Main.netMode != 1 && npc.ai[2] == (float)(num14 / 2)) + { + if (npc.ai[1] == 0f) + npc.ai[1] = 300 * Math.Sign((center - player.Center).X); + + Vector2 vector15 = player.Center + new Vector2(0f - npc.ai[1], -200f); + Vector2 vector17 = (npc.Center = vector15); + center = vector17; + int num40 = Math.Sign(player.Center.X - center.X); + if (num40 != 0) + { + if (npc.ai[2] == 0f && num40 != npc.direction) + { + npc.rotation += (float)Math.PI; + for (int n = 0; n < npc.oldPos.Length; n++) + npc.oldPos[n] = Vector2.Zero; + } + + npc.direction = num40; + if (npc.spriteDirection != -npc.direction) + npc.rotation += (float)Math.PI; + + npc.spriteDirection = -npc.direction; + } + } + + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num14) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + if (npc.ai[3] >= 9f) + npc.ai[3] = 0f; + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 13f) + { + // Avoid cheap bullshit + npc.damage = 0; + + if (npc.ai[2] == 0f) + SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); + + npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); + npc.rotation -= num19 * (float)npc.direction; + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num15) + { + npc.ai[0] = 10f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.netUpdate = true; + } + } + + // Make him always able to take damage + npc.dontTakeDamage = false; + + return false; + } } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 37da11f0d1..959ab8feea 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -81,12 +81,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float enrageScale = bossRush ? 1.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { - npc.Calamity().CurrentlyEnraged = !bossRush; + calamityGlobalNPC.CurrentlyEnraged = !bossRush; enrageScale += 0.5f; } if (!Main.player[npc.target].ZoneCorrupt || bossRush) { - npc.Calamity().CurrentlyEnraged = !bossRush; + calamityGlobalNPC.CurrentlyEnraged = !bossRush; enrageScale += 2f; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs index db34335f6b..5a879d85cb 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EmpressofLightAI.cs @@ -1287,7 +1287,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int rainbowStreakDamage = 45; int lastingRainbowDamage = 45; int sunDanceDamage = 50; - + + // Rotation + npc.rotation = npc.velocity.X * 0.005f; + + // Reset DR every frame + calamityGlobalNPC.DR = 0.15f; + bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); bool expertMode = Main.expertMode; bool masterMode = Main.masterMode; @@ -1298,10 +1304,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool genuinePhase2 = npc.life / (float)npc.lifeMax <= phase2LifeRatio; bool phase3 = npc.life / (float)npc.lifeMax <= phase3LifeRatio && expertMode; + bool shouldBeInPhase2ButIsStillInPhase1 = npc.life / (float)npc.lifeMax <= phase2LifeRatio && !phase2; + if (shouldBeInPhase2ButIsStillInPhase1) + calamityGlobalNPC.DR = 0.99f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; + bool enraged = NPC.ShouldEmpressBeEnraged(); if (npc.life == npc.lifeMax && enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) npc.ai[3] += 2f; + calamityGlobalNPC.CurrentlyEnraged = !BossRushEvent.BossRushActive && enraged; + int projectileDamageMultiplier = enraged ? 2 : 1; bool becomeVisible = true; @@ -1845,6 +1859,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Avoid cheap bullshit. npc.damage = 0; + // Increase durability. + calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (BossRushEvent.BossRushActive ? 0.99f : 0.575f); + float extraPhaseTime = (masterMode ? 30 : expertMode ? 75 : 120) - reducedAttackCooldown; Vector2 offset = new Vector2(0f, -100f); Vector2 sunDanceSpawnLocation = npc.Center + offset; diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 068e9d2745..e93db26d68 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -1311,6 +1311,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) enrageScale *= 2f; + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrageScale > 1f; + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index 2fa7d190ee..973e657b62 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -1231,6 +1231,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num780 = 0.15f; } + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && flag39; + if (Main.expertMode) { num779 += (Main.masterMode ? 2f : 1f); diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 2f37b53662..1311810e38 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -43,12 +43,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float enrageScale = death ? 0.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { - npc.Calamity().CurrentlyEnraged = !bossRush; + calamityGlobalNPC.CurrentlyEnraged = !bossRush; enrageScale += 0.5f; } if (!Main.player[npc.target].ZoneJungle || bossRush) { - npc.Calamity().CurrentlyEnraged = !bossRush; + calamityGlobalNPC.CurrentlyEnraged = !bossRush; enrageScale += 0.5f; } @@ -843,6 +843,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!Main.player[npc.target].ZoneJungle) num644 += 1f; + npc.Calamity().CurrentlyEnraged = num644 > 0f; + if (Main.getGoodWorld) num644 += 0.5f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 7eab20f040..9c60368bf0 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -756,6 +756,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.damage = 1000; calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; + + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + npc.rotation += npc.direction * 0.3f; Vector2 enrageSpinPos = npc.Center; float enrageSpinTargetX = Main.player[npc.target].Center.X - enrageSpinPos.X; @@ -1236,6 +1240,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.defense += numHands * (Main.masterMode ? 50 : 25); + npc.Calamity().CurrentlyIncreasingDefenseOrDR = numHands > 0; + npc.chaseable = numHands == 0; if ((numHands < maxHands || (double)npc.life < (double)npc.lifeMax * 0.75 || Main.masterMode) && npc.ai[1] == 0f) { float num151 = 80f; @@ -1449,6 +1455,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.damage = 1000; npc.defense = 9999; + + npc.Calamity().CurrentlyEnraged = true; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + npc.rotation += (float)npc.direction * 0.3f; Vector2 vector21 = npc.Center; float num176 = Main.player[npc.target].Center.X - vector21.X; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index b725ebd070..af737e6df8 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -324,6 +324,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.defense *= 2; npc.damage = npc.defDamage * 2; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; @@ -427,6 +429,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; + calamityGlobalNPC.CurrentlyEnraged = true; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; + if (NPC.IsMechQueenUp) npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); else @@ -2079,6 +2084,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.defense *= 2; npc.damage = npc.defDamage * 2; + + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + npc.ai[2] += 1f; if (npc.ai[2] == 2f) SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); @@ -2157,6 +2165,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.damage = 1000; npc.defense = 9999; + + npc.Calamity().CurrentlyEnraged = true; + npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; + if (NPC.IsMechQueenUp) npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); else diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index 2a0a0e18f4..ebb80f692a 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -274,6 +274,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } + calamityGlobalNPC.CurrentlyEnraged = distanceFromTarget > halfAverageScreenWidth || npc.ai[3] == 1f; + if (bossRush) speedMult += 0.2f;