From bdbfa05877d3edfdea7038ae55b258cf2c64839d Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 28 Oct 2020 20:36:52 -0500 Subject: [PATCH] 1 - All the changelog stuff on main. 2 - Certain ores can no longer be bombed because they had old bomb resist code that makes no sense anymore. 3 - Bumbledoge mount nerf. 4 - Terra Arrows have had their aistyle removed so they no longer behave like normal arrows. --- CalPlayer/CalamityPlayer.cs | 416 +++++++++------- CalPlayer/CalamityPlayerMiscEffects.cs | 419 ++++++++-------- Items/Mounts/BUMBLEDOGE.cs | 2 +- Items/SummonItems/Abomination.cs | 3 +- NPCs/AstrumAureus/AureusSpawn.cs | 70 +-- NPCs/BrimstoneElemental/Brimling.cs | 4 +- NPCs/CalamityAI.cs | 212 ++++++-- NPCs/CalamityGlobalAI.cs | 469 +++++++++++------- NPCs/CalamityGlobalNPC.cs | 50 +- NPCs/CalamityGlobalNPCLoot.cs | 17 +- NPCs/Crabulon/CrabulonIdle.cs | 29 +- NPCs/Cryogen/Cryogen.cs | 68 +-- NPCs/DesertScourge/DesertScourgeHead.cs | 25 +- NPCs/HiveMind/HiveMind.cs | 14 +- NPCs/HiveMind/HiveMindP2.cs | 64 ++- NPCs/Leviathan/Leviathan.cs | 33 +- NPCs/Leviathan/Siren.cs | 55 +- NPCs/NormalNPCs/KingSlimeJewel.cs | 36 +- NPCs/Perforator/PerforatorHeadLarge.cs | 19 +- NPCs/Perforator/PerforatorHeadMedium.cs | 21 +- NPCs/Perforator/PerforatorHeadSmall.cs | 19 +- NPCs/Perforator/PerforatorHive.cs | 35 +- .../PlaguebringerGoliath.cs | 91 ++-- NPCs/Ravager/RavagerHead2.cs | 4 +- NPCs/Ravager/RockPillar.cs | 5 + NPCs/SlimeGod/SlimeGod.cs | 2 +- NPCs/SlimeGod/SlimeGodCore.cs | 6 +- NPCs/SlimeGod/SlimeGodRun.cs | 2 +- NPCs/SlimeGod/SlimeGodSplit.cs | 2 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 4 +- Projectiles/Boss/AstralFlame.cs | 5 +- Projectiles/Boss/BrimstoneRay.cs | 26 +- Projectiles/Boss/DestroyerCursedLaser.cs | 2 +- Projectiles/Boss/DestroyerElectricLaser.cs | 2 +- Projectiles/Boss/HolySpear.cs | 46 +- Projectiles/Boss/PlagueStingerGoliath.cs | 2 +- Projectiles/Boss/SandPoisonCloud.cs | 4 +- Projectiles/CalamityGlobalProjectile.cs | 8 +- Projectiles/Ranged/TerraArrowMain.cs | 1 - Tiles/Ores/AerialiteOre.cs | 5 - Tiles/Ores/AstralOre.cs | 2 +- Tiles/Ores/AuricOre.cs | 2 +- Tiles/Ores/ChaoticOre.cs | 2 +- Tiles/Ores/CharredOre.cs | 2 +- Tiles/Ores/CryonicOre.cs | 2 +- Tiles/Ores/ExodiumOre.cs | 7 +- Tiles/Ores/PerennialOre.cs | 2 +- Tiles/Ores/UelibloomOre.cs | 2 +- 48 files changed, 1430 insertions(+), 888 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 946ff9d589..fa329e2e0b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -67,6 +67,15 @@ using Terraria.ModLoader.IO; namespace CalamityMod.CalPlayer { + public enum ClassType + { + Melee = 0, + Ranged = 1, + Magic = 2, + Summon = 3, + Rogue = 4 + } + public enum GaelSwitchPhase { LoseRage = 0, @@ -244,10 +253,13 @@ namespace CalamityMod.CalPlayer public bool playRogueStealthSound = false; public bool playFullRageSound = true; public bool playFullAdrenalineSound = true; - #endregion + #endregion - #region Proficiency - public int meleeLevel = 0; + #region Proficiency + private const int levelTier1 = 1500; + private const int levelTier2 = 5500; + private const int levelTier3 = 12500; + public int meleeLevel = 0; public int rangedLevel = 0; public int magicLevel = 0; public int rogueLevel = 0; @@ -5429,22 +5441,24 @@ namespace CalamityMod.CalPlayer gainLevelCooldown = 120; if (item.melee && meleeLevel <= 12500) { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } + if (!ReduceCooldown((int)ClassType.Melee)) + { + if (!Main.hardMode && meleeLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && meleeLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterMeleeLevel) + gainLevelCooldown /= 2; + meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; shootFireworksLevelUpMelee = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } + LevelPacket(false, (int)ClassType.Melee); } } } @@ -5910,98 +5924,108 @@ namespace CalamityMod.CalPlayer gainLevelCooldown = 120; //2 seconds if (proj.melee && meleeLevel <= 12500) { - if (!Main.hardMode && meleeLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; + if (!ReduceCooldown((int)ClassType.Melee)) + { + if (!Main.hardMode && meleeLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && meleeLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterMeleeLevel) + gainLevelCooldown /= 2; + + meleeLevel++; shootFireworksLevelUpMelee = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } + LevelPacket(false, (int)ClassType.Melee); } else if (proj.ranged && rangedLevel <= 12500) { - if (!Main.hardMode && rangedLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rangedLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rangedLevel++; - if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rangedLevel++; + if (!ReduceCooldown((int)ClassType.Ranged)) + { + if (!Main.hardMode && rangedLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && rangedLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterRangedLevel) + gainLevelCooldown /= 2; + + rangedLevel++; shootFireworksLevelUpRanged = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 1); - } + LevelPacket(false, (int)ClassType.Ranged); } else if (proj.magic && magicLevel <= 12500) { - if (!Main.hardMode && magicLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && magicLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - magicLevel++; - if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - magicLevel++; + if (!ReduceCooldown((int)ClassType.Magic)) + { + if (!Main.hardMode && magicLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && magicLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterMagicLevel) + gainLevelCooldown /= 2; + + magicLevel++; shootFireworksLevelUpMagic = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 2); - } + LevelPacket(false, (int)ClassType.Magic); } else if (isSummon && summonLevel <= 12500) { - if (!Main.hardMode && summonLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && summonLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - summonLevel++; - if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - summonLevel++; + if (!ReduceCooldown((int)ClassType.Summon)) + { + if (!Main.hardMode && summonLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && summonLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterSummonLevel) + gainLevelCooldown /= 2; + + summonLevel++; shootFireworksLevelUpSummon = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 3); - } + LevelPacket(false, (int)ClassType.Summon); } else if (proj.Calamity().rogue && rogueLevel <= 12500) { - if (!Main.hardMode && rogueLevel >= 1500) - { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && rogueLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds - } - rogueLevel++; - if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rogueLevel++; + if (!ReduceCooldown((int)ClassType.Rogue)) + { + if (!Main.hardMode && rogueLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && rogueLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds + } + else + gainLevelCooldown /= 2; + + if (fasterRogueLevel) + gainLevelCooldown /= 2; + + rogueLevel++; shootFireworksLevelUpRogue = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 4); - } + LevelPacket(false, (int)ClassType.Rogue); } } } @@ -6206,8 +6230,7 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.ironHeart) { - int damageMin = 60 + (player.statLifeMax2 / 10); - int damageWithDR = (int)(damage * (1f - player.endurance)); + int damageMin = 40 + (player.statLifeMax2 / 10); if (damage < damageMin) { player.endurance = 0f; @@ -6491,8 +6514,7 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.ironHeart) { - int damageMin = 60 + (player.statLifeMax2 / 10); - int damageWithDR = (int)(damage * (1f - player.endurance)); + int damageMin = (Main.expertMode ? 10 : 20) + (player.statLifeMax2 / (Main.expertMode ? 40 : 20)); if (damage < damageMin) { player.endurance = 0f; @@ -7589,7 +7611,7 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.ironHeart) { - int damageMin = 60 + (player.statLifeMax2 / 10); + int damageMin = 80 + (player.statLifeMax2 / 10); playSound = false; hurtSoundTimer = 20; if (damage <= damageMin) @@ -10069,6 +10091,68 @@ namespace CalamityMod.CalPlayer #endregion #region Proficiency Stuff + private bool ReduceCooldown(int classType) + { + switch (classType) + { + case (int)ClassType.Melee: + + if (meleeLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (meleeLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (meleeLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Ranged: + + if (rangedLevel < levelTier3 && (meleeLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (rangedLevel < levelTier2 && (meleeLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (rangedLevel < levelTier1 && (meleeLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Magic: + + if (magicLevel < levelTier3 && (rangedLevel >= levelTier3 || meleeLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (magicLevel < levelTier2 && (rangedLevel >= levelTier2 || meleeLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (magicLevel < levelTier1 && (rangedLevel >= levelTier1 || meleeLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Summon: + + if (summonLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || meleeLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (summonLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || meleeLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (summonLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || meleeLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Rogue: + + if (rogueLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || meleeLevel >= levelTier3)) + return true; + if (rogueLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || meleeLevel >= levelTier2)) + return true; + if (rogueLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || meleeLevel >= levelTier1)) + return true; + + break; + } + return false; + } + public void GetExactLevelUp() { if (gainLevelCooldown > 0) @@ -10078,49 +10162,49 @@ namespace CalamityMod.CalPlayer switch (meleeLevel) { case 100: - this.ExactLevelUp(0, 1, false); + ExactLevelUp(0, 1, false); break; case 300: - this.ExactLevelUp(0, 2, false); + ExactLevelUp(0, 2, false); break; case 600: - this.ExactLevelUp(0, 3, false); + ExactLevelUp(0, 3, false); break; case 1000: - this.ExactLevelUp(0, 4, false); + ExactLevelUp(0, 4, false); break; case 1500: - this.ExactLevelUp(0, 5, false); + ExactLevelUp(0, 5, false); break; case 2100: - this.ExactLevelUp(0, 6, false); + ExactLevelUp(0, 6, false); break; case 2800: - this.ExactLevelUp(0, 7, false); + ExactLevelUp(0, 7, false); break; case 3600: - this.ExactLevelUp(0, 8, false); + ExactLevelUp(0, 8, false); break; case 4500: - this.ExactLevelUp(0, 9, false); + ExactLevelUp(0, 9, false); break; case 5500: - this.ExactLevelUp(0, 10, false); + ExactLevelUp(0, 10, false); break; case 6600: - this.ExactLevelUp(0, 11, false); + ExactLevelUp(0, 11, false); break; case 7800: - this.ExactLevelUp(0, 12, false); + ExactLevelUp(0, 12, false); break; case 9100: - this.ExactLevelUp(0, 13, false); + ExactLevelUp(0, 13, false); break; case 10500: - this.ExactLevelUp(0, 14, false); + ExactLevelUp(0, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(0, 15, true); + ExactLevelUp(0, 15, true); break; default: break; @@ -10131,49 +10215,49 @@ namespace CalamityMod.CalPlayer switch (rangedLevel) { case 100: - this.ExactLevelUp(1, 1, false); + ExactLevelUp(1, 1, false); break; case 300: - this.ExactLevelUp(1, 2, false); + ExactLevelUp(1, 2, false); break; case 600: - this.ExactLevelUp(1, 3, false); + ExactLevelUp(1, 3, false); break; case 1000: - this.ExactLevelUp(1, 4, false); + ExactLevelUp(1, 4, false); break; case 1500: - this.ExactLevelUp(1, 5, false); + ExactLevelUp(1, 5, false); break; case 2100: - this.ExactLevelUp(1, 6, false); + ExactLevelUp(1, 6, false); break; case 2800: - this.ExactLevelUp(1, 7, false); + ExactLevelUp(1, 7, false); break; case 3600: - this.ExactLevelUp(1, 8, false); + ExactLevelUp(1, 8, false); break; case 4500: - this.ExactLevelUp(1, 9, false); + ExactLevelUp(1, 9, false); break; case 5500: - this.ExactLevelUp(1, 10, false); + ExactLevelUp(1, 10, false); break; case 6600: - this.ExactLevelUp(1, 11, false); + ExactLevelUp(1, 11, false); break; case 7800: - this.ExactLevelUp(1, 12, false); + ExactLevelUp(1, 12, false); break; case 9100: - this.ExactLevelUp(1, 13, false); + ExactLevelUp(1, 13, false); break; case 10500: - this.ExactLevelUp(1, 14, false); + ExactLevelUp(1, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(1, 15, true); + ExactLevelUp(1, 15, true); break; default: break; @@ -10184,49 +10268,49 @@ namespace CalamityMod.CalPlayer switch (magicLevel) { case 100: - this.ExactLevelUp(2, 1, false); + ExactLevelUp(2, 1, false); break; case 300: - this.ExactLevelUp(2, 2, false); + ExactLevelUp(2, 2, false); break; case 600: - this.ExactLevelUp(2, 3, false); + ExactLevelUp(2, 3, false); break; case 1000: - this.ExactLevelUp(2, 4, false); + ExactLevelUp(2, 4, false); break; case 1500: - this.ExactLevelUp(2, 5, false); + ExactLevelUp(2, 5, false); break; case 2100: - this.ExactLevelUp(2, 6, false); + ExactLevelUp(2, 6, false); break; case 2800: - this.ExactLevelUp(2, 7, false); + ExactLevelUp(2, 7, false); break; case 3600: - this.ExactLevelUp(2, 8, false); + ExactLevelUp(2, 8, false); break; case 4500: - this.ExactLevelUp(2, 9, false); + ExactLevelUp(2, 9, false); break; case 5500: - this.ExactLevelUp(2, 10, false); + ExactLevelUp(2, 10, false); break; case 6600: - this.ExactLevelUp(2, 11, false); + ExactLevelUp(2, 11, false); break; case 7800: - this.ExactLevelUp(2, 12, false); + ExactLevelUp(2, 12, false); break; case 9100: - this.ExactLevelUp(2, 13, false); + ExactLevelUp(2, 13, false); break; case 10500: - this.ExactLevelUp(2, 14, false); + ExactLevelUp(2, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(2, 15, true); + ExactLevelUp(2, 15, true); break; default: break; @@ -10237,49 +10321,49 @@ namespace CalamityMod.CalPlayer switch (summonLevel) { case 100: - this.ExactLevelUp(3, 1, false); + ExactLevelUp(3, 1, false); break; case 300: - this.ExactLevelUp(3, 2, false); + ExactLevelUp(3, 2, false); break; case 600: - this.ExactLevelUp(3, 3, false); + ExactLevelUp(3, 3, false); break; case 1000: - this.ExactLevelUp(3, 4, false); + ExactLevelUp(3, 4, false); break; case 1500: - this.ExactLevelUp(3, 5, false); + ExactLevelUp(3, 5, false); break; case 2100: - this.ExactLevelUp(3, 6, false); + ExactLevelUp(3, 6, false); break; case 2800: - this.ExactLevelUp(3, 7, false); + ExactLevelUp(3, 7, false); break; case 3600: - this.ExactLevelUp(3, 8, false); + ExactLevelUp(3, 8, false); break; case 4500: - this.ExactLevelUp(3, 9, false); + ExactLevelUp(3, 9, false); break; case 5500: - this.ExactLevelUp(3, 10, false); + ExactLevelUp(3, 10, false); break; case 6600: - this.ExactLevelUp(3, 11, false); + ExactLevelUp(3, 11, false); break; case 7800: - this.ExactLevelUp(3, 12, false); + ExactLevelUp(3, 12, false); break; case 9100: - this.ExactLevelUp(3, 13, false); + ExactLevelUp(3, 13, false); break; case 10500: - this.ExactLevelUp(3, 14, false); + ExactLevelUp(3, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(3, 15, true); + ExactLevelUp(3, 15, true); break; default: break; @@ -10290,49 +10374,49 @@ namespace CalamityMod.CalPlayer switch (rogueLevel) { case 100: - this.ExactLevelUp(4, 1, false); + ExactLevelUp(4, 1, false); break; case 300: - this.ExactLevelUp(4, 2, false); + ExactLevelUp(4, 2, false); break; case 600: - this.ExactLevelUp(4, 3, false); + ExactLevelUp(4, 3, false); break; case 1000: - this.ExactLevelUp(4, 4, false); + ExactLevelUp(4, 4, false); break; case 1500: - this.ExactLevelUp(4, 5, false); + ExactLevelUp(4, 5, false); break; case 2100: - this.ExactLevelUp(4, 6, false); + ExactLevelUp(4, 6, false); break; case 2800: - this.ExactLevelUp(4, 7, false); + ExactLevelUp(4, 7, false); break; case 3600: - this.ExactLevelUp(4, 8, false); + ExactLevelUp(4, 8, false); break; case 4500: - this.ExactLevelUp(4, 9, false); + ExactLevelUp(4, 9, false); break; case 5500: - this.ExactLevelUp(4, 10, false); + ExactLevelUp(4, 10, false); break; case 6600: - this.ExactLevelUp(4, 11, false); + ExactLevelUp(4, 11, false); break; case 7800: - this.ExactLevelUp(4, 12, false); + ExactLevelUp(4, 12, false); break; case 9100: - this.ExactLevelUp(4, 13, false); + ExactLevelUp(4, 13, false); break; case 10500: - this.ExactLevelUp(4, 14, false); + ExactLevelUp(4, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(4, 15, true); + ExactLevelUp(4, 15, true); break; default: break; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2fe09f93c4..58c24eaafb 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -526,60 +526,6 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer) { - // Calculate underground darkness here. The effect is applied in CalamityMod.ModifyLightingBrightness. - Point point = player.Center.ToTileCoordinates(); - if (point.Y > Main.worldSurface && !modPlayer.ZoneAbyss && !player.ZoneUnderworldHeight && !CalamityPlayer.areThereAnyDamnBosses) - { - // Darkness strength scales smoothly with how deep you are. - double totalUndergroundDepth = Main.maxTilesY - 200D - Main.worldSurface; - double playerUndergroundDepth = point.Y - Main.worldSurface; - double depthRatio = playerUndergroundDepth / totalUndergroundDepth; - int lightStrength = modPlayer.GetTotalLightStrength(); - - // In the last 50 blocks before hell, the darkness smoothly fades away. - float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); - float darknessStrength = (float)(depthRatio / FadeAwayStart); - if (depthRatio > FadeAwayStart) - { - // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. - darknessStrength = MathHelper.Lerp(0f, 1f, (1f - (float)depthRatio) / (1f - FadeAwayStart)); - } - - // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. - switch (lightStrength) - { - case 0: - darknessStrength *= 0.75f; - break; - case 1: - darknessStrength *= 0.5f; - break; - case 2: - darknessStrength *= 0.25f; - break; - case 3: - darknessStrength *= 0.15f; - break; - case 4: - darknessStrength *= 0.05f; - break; - default: - darknessStrength = 0f; - break; - } - modPlayer.caveDarkness = darknessStrength; - } - - // Immunity bools - bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves; - - bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier || - modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs || modPlayer.coldDivinity || modPlayer.eGauntlet; - - bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || modPlayer.aAmpoule || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity; - - bool immunityToHot = player.lavaImmune || player.lavaRose || player.lavaMax > 0 || immunityToHotAndCold || modPlayer.externalHeatImmunity; - // Thorn and spike effects // 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes Vector2 tileType; @@ -606,27 +552,6 @@ namespace CalamityMod.CalPlayer break; } - // Astral effects - if (modPlayer.ZoneAstral) - { - player.gravity *= 0.75f; - } - - // Space effects - if (player.InSpace()) - { - if (Main.dayTime) - { - if (!immunityToHot) - player.AddBuff(BuffID.Burning, 2, false); - } - else - { - if (!immunityToCold) - player.AddBuff(BuffID.Frostburn, 2, false); - } - } - // Leech bleed if (player.ZoneJungle && player.wet && !player.lavaWet && !player.honeyWet) { @@ -634,52 +559,153 @@ namespace CalamityMod.CalPlayer player.AddBuff(BuffID.Bleeding, 300, false); } - // Ice shards, lightning and sharknadoes - bool nearPillar = player.PillarZone(); - if (player.ZoneOverworldHeight && !BossRushEvent.BossRushActive && !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents && NPC.MoonLordCountdown == 0 && !player.InSpace()) + if (!BossRushEvent.BossRushActive && !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents) { - Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - Main.rand.Next(300, 701), player.Center.Y - Main.rand.Next(700, 801)); - if (point.X > Main.maxTilesX / 2) - sharknadoSpawnPoint.X = player.Center.X + Main.rand.Next(300, 701); + // Astral effects + if (modPlayer.ZoneAstral) + player.gravity *= 0.75f; - if (Main.raining) + // Calculate underground darkness here. The effect is applied in CalamityMod.ModifyLightingBrightness. + Point point = player.Center.ToTileCoordinates(); + if (point.Y > Main.worldSurface && !modPlayer.ZoneAbyss && !player.ZoneUnderworldHeight) { - float frequencyMult = (1f - Main.cloudAlpha) * CalamityConfig.Instance.DeathWeatherMultiplier; // 3 to 0.055 + // Darkness strength scales smoothly with how deep you are. + double totalUndergroundDepth = Main.maxTilesY - 200D - Main.worldSurface; + double playerUndergroundDepth = point.Y - Main.worldSurface; + double depthRatio = playerUndergroundDepth / totalUndergroundDepth; + int lightStrength = modPlayer.GetTotalLightStrength(); - Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); - Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); - - if (player.ZoneSnow) + // In the last 50 blocks before hell, the darkness smoothly fades away. + float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); + float darknessStrength = (float)(depthRatio / FadeAwayStart); + if (depthRatio > FadeAwayStart) { - if (!tileSafely.active()) - { - int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult); - float windVelocity = (float)Math.Sqrt(Math.Abs(Main.windSpeed)) * Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; - Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); + // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. + darknessStrength = MathHelper.Lerp(0f, 1f, (1f - (float)depthRatio) / (1f - FadeAwayStart)); + } - if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) - Projectile.NewProjectile(spawnPoint, velocity, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); + // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. + switch (lightStrength) + { + case 0: + darknessStrength *= 0.75f; + break; + case 1: + darknessStrength *= 0.5f; + break; + case 2: + darknessStrength *= 0.25f; + break; + case 3: + darknessStrength *= 0.15f; + break; + case 4: + darknessStrength *= 0.05f; + break; + default: + darknessStrength = 0f; + break; + } + modPlayer.caveDarkness = darknessStrength; + } + + // Ice shards, lightning and sharknadoes + bool nearPillar = player.PillarZone(); + if (player.ZoneOverworldHeight && NPC.MoonLordCountdown == 0 && !player.InSpace()) + { + Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - Main.rand.Next(300, 701), player.Center.Y - Main.rand.Next(700, 801)); + if (point.X > Main.maxTilesX / 2) + sharknadoSpawnPoint.X = player.Center.X + Main.rand.Next(300, 701); + + if (Main.raining) + { + float frequencyMult = (1f - Main.cloudAlpha) * CalamityConfig.Instance.DeathWeatherMultiplier; // 3 to 0.055 + + Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); + Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); + + if (player.ZoneSnow) + { + if (!tileSafely.active()) + { + int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult); + float windVelocity = (float)Math.Sqrt(Math.Abs(Main.windSpeed)) * Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; + Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); + + if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) + Projectile.NewProjectile(spawnPoint, velocity, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); + } + } + else + { + if (player.ZoneBeach && !modPlayer.ZoneSulphur) + { + int randomFrequency = (int)(50f * frequencyMult); + if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1) + { + Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); + int y = (int)(sharknadoSpawnPoint.Y / 16f); + int x = (int)(sharknadoSpawnPoint.X / 16f); + int yAdjust = 100; + if (x < 10) + x = 10; + if (x > Main.maxTilesX - 10) + x = Main.maxTilesX - 10; + if (y < 10) + y = 10; + if (y > Main.maxTilesY - yAdjust - 10) + y = Main.maxTilesY - yAdjust - 10; + + int spawnAreaY = Main.maxTilesY - y; + for (int j = y; j < y + spawnAreaY; j++) + { + Tile tile = Main.tile[x, j]; + if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) + { + y = j; + break; + } + } + + int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); + Main.projectile[tornado].netUpdate = true; + } + } + + int randomFrequency2 = (int)(20f * frequencyMult); + if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur) + randomFrequency2 = (int)(randomFrequency2 * 3.75); + if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) + { + if (!tileSafely.active()) + { + float randomVelocity = Main.rand.NextFloat() - 0.5f; + Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f); + Vector2 direction = fireTo - spawnPoint; + Vector2 velocity = Vector2.Normalize(direction) * 12f; + Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } } } else { if (player.ZoneBeach && !modPlayer.ZoneSulphur) { - int randomFrequency = (int)(50f * frequencyMult); - if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1) + if (player.miscCounter == 280 && Main.rand.NextBool(10) && player.ownedProjectileCounts[ProjectileID.Sharknado] < 1) { - Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); + Main.PlaySound(SoundID.NPCDeath19, sharknadoSpawnPoint); int y = (int)(sharknadoSpawnPoint.Y / 16f); int x = (int)(sharknadoSpawnPoint.X / 16f); - int yAdjust = 100; + int num333 = 100; if (x < 10) x = 10; if (x > Main.maxTilesX - 10) x = Main.maxTilesX - 10; if (y < 10) y = 10; - if (y > Main.maxTilesY - yAdjust - 10) - y = Main.maxTilesY - yAdjust - 10; + if (y > Main.maxTilesY - num333 - 10) + y = Main.maxTilesY - num333 - 10; int spawnAreaY = Main.maxTilesY - y; for (int j = y; j < y + spawnAreaY; j++) @@ -692,139 +718,114 @@ namespace CalamityMod.CalPlayer } } - int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); + int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f); Main.projectile[tornado].netUpdate = true; } } - - int randomFrequency2 = (int)(20f * frequencyMult); - if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur) - randomFrequency2 = (int)(randomFrequency2 * 3.75); - if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) - { - if (!tileSafely.active()) - { - float randomVelocity = Main.rand.NextFloat() - 0.5f; - Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f); - Vector2 direction = fireTo - spawnPoint; - Vector2 velocity = Vector2.Normalize(direction) * 12f; - Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - } - } } } - else + + // Immunity bools + bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves; + + bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier || + modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs || modPlayer.coldDivinity || modPlayer.eGauntlet; + + bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || modPlayer.aAmpoule || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity; + + bool immunityToHot = player.lavaImmune || player.lavaRose || player.lavaMax > 0 || immunityToHotAndCold || modPlayer.externalHeatImmunity; + + // Space effects + if (player.InSpace()) { - if (player.ZoneBeach && !modPlayer.ZoneSulphur) + if (Main.dayTime) { - if (player.miscCounter == 280 && Main.rand.NextBool(10) && player.ownedProjectileCounts[ProjectileID.Sharknado] < 1) - { - Main.PlaySound(SoundID.NPCDeath19, sharknadoSpawnPoint); - int y = (int)(sharknadoSpawnPoint.Y / 16f); - int x = (int)(sharknadoSpawnPoint.X / 16f); - int num333 = 100; - if (x < 10) - x = 10; - if (x > Main.maxTilesX - 10) - x = Main.maxTilesX - 10; - if (y < 10) - y = 10; - if (y > Main.maxTilesY - num333 - 10) - y = Main.maxTilesY - num333 - 10; - - int spawnAreaY = Main.maxTilesY - y; - for (int j = y; j < y + spawnAreaY; j++) - { - Tile tile = Main.tile[x, j]; - if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) - { - y = j; - break; - } - } - - int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f); - Main.projectile[tornado].netUpdate = true; - } + if (!immunityToHot) + player.AddBuff(BuffID.Burning, 2, false); + } + else + { + if (!immunityToCold) + player.AddBuff(BuffID.Frostburn, 2, false); } } - } - // Cold timer - if (!player.behindBackWall && Main.raining && player.ZoneSnow && !immunityToCold && player.ZoneOverworldHeight) - { - bool affectedByColdWater = player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear; + // Cold timer + if (!player.behindBackWall && Main.raining && player.ZoneSnow && !immunityToCold && player.ZoneOverworldHeight) + { + bool affectedByColdWater = player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear; - player.AddBuff(ModContent.BuffType(), 2, false); + player.AddBuff(ModContent.BuffType(), 2, false); - modPlayer.deathModeBlizzardTime++; - if (affectedByColdWater) modPlayer.deathModeBlizzardTime++; - - if (modPlayer.deathModeUnderworldTime > 0) - { - modPlayer.deathModeUnderworldTime--; if (affectedByColdWater) + modPlayer.deathModeBlizzardTime++; + + if (modPlayer.deathModeUnderworldTime > 0) + { modPlayer.deathModeUnderworldTime--; - if (modPlayer.deathModeUnderworldTime < 0) - modPlayer.deathModeUnderworldTime = 0; + if (affectedByColdWater) + modPlayer.deathModeUnderworldTime--; + if (modPlayer.deathModeUnderworldTime < 0) + modPlayer.deathModeUnderworldTime = 0; + } } - } - else if (modPlayer.deathModeBlizzardTime > 0) - { - modPlayer.deathModeBlizzardTime--; - if (immunityToCold) - modPlayer.deathModeBlizzardTime--; - if (modPlayer.deathModeBlizzardTime < 0) - modPlayer.deathModeBlizzardTime = 0; - } - - // Hot timer - if (player.ZoneUnderworldHeight && !immunityToHot) - { - bool affectedByHotLava = player.lavaWet; - - player.AddBuff(ModContent.BuffType(), 2, false); - - modPlayer.deathModeUnderworldTime++; - if (affectedByHotLava) - modPlayer.deathModeUnderworldTime++; - - if (modPlayer.deathModeBlizzardTime > 0) + else if (modPlayer.deathModeBlizzardTime > 0) { modPlayer.deathModeBlizzardTime--; - if (affectedByHotLava) + if (immunityToCold) modPlayer.deathModeBlizzardTime--; if (modPlayer.deathModeBlizzardTime < 0) modPlayer.deathModeBlizzardTime = 0; } - } - else if (modPlayer.deathModeUnderworldTime > 0) - { - modPlayer.deathModeUnderworldTime--; - if (immunityToHot) + + // Hot timer + if (player.ZoneUnderworldHeight && !immunityToHot) + { + bool affectedByHotLava = player.lavaWet; + + player.AddBuff(ModContent.BuffType(), 2, false); + + modPlayer.deathModeUnderworldTime++; + if (affectedByHotLava) + modPlayer.deathModeUnderworldTime++; + + if (modPlayer.deathModeBlizzardTime > 0) + { + modPlayer.deathModeBlizzardTime--; + if (affectedByHotLava) + modPlayer.deathModeBlizzardTime--; + if (modPlayer.deathModeBlizzardTime < 0) + modPlayer.deathModeBlizzardTime = 0; + } + } + else if (modPlayer.deathModeUnderworldTime > 0) + { modPlayer.deathModeUnderworldTime--; - if (modPlayer.deathModeUnderworldTime < 0) - modPlayer.deathModeUnderworldTime = 0; + if (immunityToHot) + modPlayer.deathModeUnderworldTime--; + if (modPlayer.deathModeUnderworldTime < 0) + modPlayer.deathModeUnderworldTime = 0; + } + + // Cold effects + if (modPlayer.deathModeBlizzardTime > 1800) + player.AddBuff(BuffID.Frozen, 2, false); + if (modPlayer.deathModeBlizzardTime > 1980) + modPlayer.KillPlayer(); + + // Hot effects + if (modPlayer.deathModeUnderworldTime > 360) + player.AddBuff(BuffID.Weak, 2, false); + if (modPlayer.deathModeUnderworldTime > 720) + player.AddBuff(BuffID.Slow, 2, false); + if (modPlayer.deathModeUnderworldTime > 1080) + player.AddBuff(BuffID.OnFire, 2, false); + if (modPlayer.deathModeUnderworldTime > 1440) + player.AddBuff(BuffID.Confused, 2, false); + if (modPlayer.deathModeUnderworldTime > 1800) + player.AddBuff(BuffID.Burning, 2, false); } - - // Cold effects - if (modPlayer.deathModeBlizzardTime > 1800) - player.AddBuff(BuffID.Frozen, 2, false); - if (modPlayer.deathModeBlizzardTime > 1980) - modPlayer.KillPlayer(); - - // Hot effects - if (modPlayer.deathModeUnderworldTime > 360) - player.AddBuff(BuffID.Weak, 2, false); - if (modPlayer.deathModeUnderworldTime > 720) - player.AddBuff(BuffID.Slow, 2, false); - if (modPlayer.deathModeUnderworldTime > 1080) - player.AddBuff(BuffID.OnFire, 2, false); - if (modPlayer.deathModeUnderworldTime > 1440) - player.AddBuff(BuffID.Confused, 2, false); - if (modPlayer.deathModeUnderworldTime > 1800) - player.AddBuff(BuffID.Burning, 2, false); } } diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 78285bdfda..a1e6feff59 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Mounts mountData.flightTimeMax = 600; mountData.fatigueMax = 0; mountData.fallDamage = 0f; - mountData.runSpeed = 12f; + mountData.runSpeed = 10f; mountData.heightBoost = 44; mountData.acceleration = 0.2f; mountData.jumpHeight = 10; diff --git a/Items/SummonItems/Abomination.cs b/Items/SummonItems/Abomination.cs index 5a2117782e..6edd808a33 100644 --- a/Items/SummonItems/Abomination.cs +++ b/Items/SummonItems/Abomination.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.SummonItems { DisplayName.SetDefault("Abombination"); Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + - "Summons the Plaguebringer Goliath\n" + - "The boss enrages in the open air of the surface"); + "Summons the Plaguebringer Goliath"); } public override void SetDefaults() diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 25113379e8..3a860ad935 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -28,14 +28,11 @@ namespace CalamityMod.NPCs.AstrumAureus npc.width = 90; npc.height = 60; npc.alpha = 255; - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.999999f; - global.unbreakableDR = true; - npc.lifeMax = 1008; + npc.defense = 10; + npc.lifeMax = 3000; if (BossRushEvent.BossRushActive) { - npc.lifeMax = 1002; + npc.lifeMax = 30000; } npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) @@ -49,22 +46,26 @@ namespace CalamityMod.NPCs.AstrumAureus npc.DeathSound = SoundID.NPCDeath1; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override void AI() + public override void AI() { npc.damage = 0; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + npc.spriteDirection = npc.direction; + if (npc.alpha > 0) { npc.alpha -= 5; @@ -77,17 +78,28 @@ namespace CalamityMod.NPCs.AstrumAureus num = num245; } } + npc.TargetClosest(true); - if (npc.life <= 1000 || Main.dayTime) + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (lifeRatio <= 0.5f || Main.dayTime) { - npc.dontTakeDamage = true; + npc.ai[1] += 1f; + npc.dontTakeDamage = true; Vector2 vector = Main.player[npc.target].Center - npc.Center; 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 (vector.Length() < 60f || flag121) + if (npc.ai[1] > 300f) + { + npc.Calamity().newAI[0] += 1f; + npc.scale = MathHelper.Lerp(1f, 2f, npc.Calamity().newAI[0] / 45f); + } + if (vector.Length() < 60f || flag121 || npc.Calamity().newAI[0] >= 45f) { - npc.dontTakeDamage = false; + npc.dontTakeDamage = false; CheckDead(); npc.life = 0; return; @@ -104,17 +116,18 @@ namespace CalamityMod.NPCs.AstrumAureus npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; return; } + float num1446 = BossRushEvent.BossRushActive ? 10f : 7f; int num1447 = 480; - float num244; if (npc.localAI[1] == 1f) { npc.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = (float)num1447; + npc.ai[0] = num1447; } } + 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); @@ -133,6 +146,7 @@ namespace CalamityMod.NPCs.AstrumAureus { npc.velocity *= 0.98f; } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) { Main.PlaySound(SoundID.Item8, npc.Center); @@ -161,11 +175,9 @@ namespace CalamityMod.NPCs.AstrumAureus num = num1451; } } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != NetmodeID.MultiplayerClient) + + npc.ai[0] += 1f; + if (npc.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[0] = 0f; Point point12 = npc.Center.ToTileCoordinates(); @@ -301,10 +313,10 @@ namespace CalamityMod.NPCs.AstrumAureus npc.position.X = npc.position.X + (float)(npc.width / 2); npc.position.Y = npc.position.Y + (float)(npc.height / 2); npc.damage = npc.defDamage; - npc.width = npc.height = 216; + npc.width = npc.height = 432; npc.position.X = npc.position.X - (float)(npc.width / 2); npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) + for (int num621 = 0; num621 < 30; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; @@ -315,7 +327,7 @@ namespace CalamityMod.NPCs.AstrumAureus } Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int num623 = 0; num623 < 60; num623++) { int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index b46c4c431e..be4ab9dfa4 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.height = 60; npc.defense = 0; npc.DR_NERD(normalDR); - npc.lifeMax = 4000; + npc.lifeMax = 2000; npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental Vector2 vector251 = Main.player[npc.target].Center - value53; bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); npc.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 360f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) { 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)) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index d2fa007ff9..0b3aba32a2 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -72,6 +72,17 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + bool notOcean = player.position.Y < 400f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + float enrageScale = 0f; + if (!player.Calamity().ZoneSulphur && notOcean) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + Vector2 vectorCenter = npc.Center; // Circular movement @@ -137,7 +148,7 @@ namespace CalamityMod.NPCs { npc.TargetClosest(true); calamityGlobalNPC.newAI[3] = 0f; - float chargeVelocity = BossRushEvent.BossRushActive ? 24f : death ? 16f : 12f; + float chargeVelocity = (BossRushEvent.BossRushActive ? 24f : death ? 16f : 12f) + 3f * enrageScale; npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; } } @@ -317,12 +328,7 @@ namespace CalamityMod.NPCs } } - // Despawn - bool notOcean = player.position.Y < 400f || - player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - - if (player.dead || (notOcean && !BossRushEvent.BossRushActive && !player.Calamity().ZoneSulphur)) + if (player.dead) { calamityGlobalNPC.newAI[1] = 1f; npc.TargetClosest(false); @@ -384,23 +390,20 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = revenge ? 13f : 11f; - num189 = revenge ? 0.14f : 0.12f; + num188 = revenge ? 9f : 7f; + num189 = revenge ? 0.12f : 0.1f; if (expertMode) { - num188 += 4f * (1f - lifeRatio); - num189 += 0.04f * (1f - lifeRatio); - } - if (notOcean) - { - num188 += 2f; - num189 += 0.02f; + num188 += 8f * (1f - lifeRatio); + num189 += 0.06f * (1f - lifeRatio); } if (player.gravDir == -1f && expertMode) { num188 = 21f; num189 = 0.21f; } + num188 += 3f * enrageScale; + num189 += 0.06f * enrageScale; if (BossRushEvent.BossRushActive) { num188 = 25f; @@ -619,10 +622,18 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - bool calamity = modPlayer.ZoneCalamity; bool phase2 = lifeRatio < 0.5f && revenge; bool phase3 = lifeRatio < 0.33f; + float enrageScale = 0f; + if (!player.ZoneUnderworldHeight) + enrageScale += 1f; + if (!modPlayer.ZoneCalamity) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Emit dust int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; int size = (npc.ai[0] == 2f) ? 50 : 35; @@ -641,9 +652,10 @@ namespace CalamityMod.NPCs } // Speed while moving in phase 1 - float speed = BossRushEvent.BossRushActive ? 12f : !calamity ? 8f : death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f; + float speed = BossRushEvent.BossRushActive ? 12f : death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f; if (expertMode) speed += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + speed += 3f * enrageScale; // Variables for target location relative to npc location float xDistance = player.Center.X - vectorCenter.X; @@ -794,7 +806,8 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 30f : revenge ? 35f : 40f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 45f; + float divisor = expertMode ? (death ? 40f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; + divisor -= 5f * enrageScale; float divisor2 = divisor * 2f; if (npc.ai[1] % divisor == divisor - 1f) @@ -802,6 +815,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { float num742 = BossRushEvent.BossRushActive ? 8f : death ? 5f : 4f; + num742 += 2f * enrageScale; float num743 = player.position.X + player.width * 0.5f - vectorCenter.X; float num744 = player.position.Y + player.height * 0.5f - vectorCenter.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); @@ -822,7 +836,7 @@ namespace CalamityMod.NPCs double deltaAngle = rotation / numProj; double offsetAngle; - if (npc.ai[1] % divisor2 == divisor2 - 1f || !calamity) + if (npc.ai[1] % divisor2 == divisor2 - 1f) { for (int i = 0; i < numProj; i++) { @@ -836,8 +850,7 @@ namespace CalamityMod.NPCs projectileSpeed += 4f; if (revenge) projectileSpeed += 1f; - if (!calamity) - projectileSpeed += 2f; + projectileSpeed += 2f * enrageScale; if (expertMode) projectileSpeed += 3f * (1f - lifeRatio); @@ -860,6 +873,8 @@ namespace CalamityMod.NPCs float maxVelocityY = death ? 2.5f : 3f; float maxVelocityX = death ? 7f : 8f; + maxVelocityY -= 0.5f * enrageScale; + maxVelocityX -= 1.5f * enrageScale; if (npc.position.Y > player.position.Y - 150f) { @@ -923,18 +938,17 @@ namespace CalamityMod.NPCs { npc.localAI[0] += 1f; if (expertMode) - npc.localAI[0] += death ? 1.5f * (1f - lifeRatio) : 1f - lifeRatio; - + npc.localAI[0] += 1f - lifeRatio; if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) npc.localAI[0] += 2f; - if (!calamity) - npc.localAI[0] += 2f; + npc.localAI[0] += 1f * enrageScale; if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; float projectileSpeed = BossRushEvent.BossRushActive ? 12f : death ? 9f : revenge ? 8f : 6f; + projectileSpeed += 3f * enrageScale; vectorCenter = player.Center - vectorCenter; @@ -1134,7 +1148,6 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool dayTime = Main.dayTime && !BossRushEvent.BossRushActive; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; // Variable for live brothers @@ -1239,6 +1252,13 @@ namespace CalamityMod.NPCs // Target variable Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // 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); @@ -1274,11 +1294,11 @@ namespace CalamityMod.NPCs npc.rotation = num803; // Despawn - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -1306,11 +1326,15 @@ namespace CalamityMod.NPCs { float num823 = expertMode ? 9.5f : 8f; float num824 = expertMode ? 0.175f : 0.15f; + num823 += 2f * enrageScale; + num824 += 0.05f * enrageScale; + if (phase2) { num823 = expertMode ? 10f : 8.5f; num824 = expertMode ? 0.18f : 0.155f; } + if (death) { num823 += 2f * (1f - lifeRatio); @@ -1329,6 +1353,7 @@ namespace CalamityMod.NPCs num823 *= 1.25f; num824 *= 1.25f; } + if (BossRushEvent.BossRushActive) { num823 *= 1.5f; @@ -1398,6 +1423,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num828 = BossRushEvent.BossRushActive ? 18f : expertMode ? 14f : 12.5f; + num828 += 3f * enrageScale; if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) num828 += 5f; @@ -1427,6 +1453,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num828 = BossRushEvent.BossRushActive ? 16f : expertMode ? 12f : 10.5f; + num828 += 2.5f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); @@ -1450,11 +1477,15 @@ namespace CalamityMod.NPCs float num832 = expertMode ? 9.5f : 8f; float num833 = expertMode ? 0.25f : 0.2f; + num832 += 2f * enrageScale; + num833 += 0.05f * enrageScale; + if (phase2) { num832 = expertMode ? 10f : 8.5f; num833 = expertMode ? 0.255f : 0.205f; } + if (death) { num832 += 2f * (1f - lifeRatio); @@ -1473,6 +1504,7 @@ namespace CalamityMod.NPCs num832 *= 1.25f; num833 *= 1.25f; } + if (BossRushEvent.BossRushActive) { num832 *= 1.5f; @@ -1534,6 +1566,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num837 = BossRushEvent.BossRushActive ? 16f : expertMode ? 12.5f : 11f; + num837 += 2.5f * enrageScale; int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -1562,6 +1595,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num837 = BossRushEvent.BossRushActive ? 16f : expertMode ? 12f : 10.5f; + num837 += 2.5f * enrageScale; int type = ModContent.ProjectileType(); int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); @@ -1590,6 +1624,7 @@ namespace CalamityMod.NPCs npc.rotation = num803; float chargeVelocity = BossRushEvent.BossRushActive ? 40f : (25f + (death ? 4f * (1f - lifeRatio) : 0f)); + chargeVelocity += 5f * enrageScale; if (provy) chargeVelocity *= 1.25f; @@ -1718,7 +1753,6 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool dayTime = Main.dayTime && !BossRushEvent.BossRushActive; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1726,6 +1760,13 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; @@ -1759,11 +1800,11 @@ namespace CalamityMod.NPCs if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -1793,11 +1834,15 @@ namespace CalamityMod.NPCs { float num861 = 5f; float num862 = 0.1f; + num861 += enrageScale; + num862 += 0.03f * enrageScale; + if (provy) { num861 *= 1.25f; num862 *= 1.25f; } + if (BossRushEvent.BossRushActive) { num861 *= 1.5f; @@ -1887,7 +1932,8 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 12f) { npc.localAI[1] = 0f; - float num867 = BossRushEvent.BossRushActive ? 9f : 6f; + float num867 = BossRushEvent.BossRushActive ? 9f : NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + num867 += enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1914,6 +1960,7 @@ namespace CalamityMod.NPCs npc.rotation = num842; float num870 = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + num870 += 3f * enrageScale; if (expertMode) num870 += 2f; if (revenge) @@ -1992,7 +2039,6 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool dayTime = Main.dayTime && !BossRushEvent.BossRushActive; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2000,6 +2046,13 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; @@ -2033,11 +2086,11 @@ namespace CalamityMod.NPCs if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -2067,11 +2120,15 @@ namespace CalamityMod.NPCs { float num861 = 4.5f; float num862 = 0.2f; + num861 += enrageScale; + num862 += 0.05f * enrageScale; + if (provy) { num861 *= 1.25f; num862 *= 1.25f; } + if (BossRushEvent.BossRushActive) { num861 *= 1.5f; @@ -2162,6 +2219,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num867 = BossRushEvent.BossRushActive ? 22f : death ? 14f : 12f; + num867 += 3f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -2187,7 +2245,8 @@ namespace CalamityMod.NPCs Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); npc.rotation = num842; - float num870 = 16f + (death ? 4f * (1f - lifeRatio) : 0f); + float num870 = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + num870 += 4f * enrageScale; if (expertMode) num870 += 2f; if (revenge) @@ -2273,7 +2332,12 @@ namespace CalamityMod.NPCs if (expertMode) shootTimer += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - bool dayTime = Main.dayTime; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2289,11 +2353,11 @@ namespace CalamityMod.NPCs bool phase3 = lifeRatio < 0.5f; // Despawn - if (!player.active || player.dead || dayTime || Vector2.Distance(player.Center, npc.Center) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || dayTime || Vector2.Distance(player.Center, npc.Center) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.noTileCollide = true; @@ -2325,11 +2389,11 @@ namespace CalamityMod.NPCs Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) + if (npc.ai[0] == 2f || npc.ai[0] >= 5f || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += (npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer; + npc.localAI[0] += npc.ai[0] == 2f ? 4f : shootTimer; if (npc.localAI[0] >= 180f) { npc.localAI[0] = 0f; @@ -2353,8 +2417,8 @@ namespace CalamityMod.NPCs } } - // Fire astral lasers while falling or walking - else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) + // Fire astral lasers while walking + else if (npc.ai[0] == 2f) { float num179 = BossRushEvent.BossRushActive ? 24f : death ? 20f : 18.5f; int maxProjectiles = death ? 6 : 4; @@ -2441,6 +2505,7 @@ namespace CalamityMod.NPCs { // Set walking speed float num823 = BossRushEvent.BossRushActive ? 12f : 6f; + num823 += 2f * enrageScale; if (expertMode) num823 += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); if (revenge) @@ -2536,6 +2601,7 @@ namespace CalamityMod.NPCs { // Set jump velocity, reset and set AI to next phase (Stomp) float velocityX = BossRushEvent.BossRushActive ? 12f : 9f; + velocityX += 3f * enrageScale; if (expertMode) velocityX += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); @@ -2548,8 +2614,8 @@ namespace CalamityMod.NPCs if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[0] = 1f + distanceBelowTarget * 0.001f; - if (calamityGlobalNPC.newAI[0] > 2f) - calamityGlobalNPC.newAI[0] = 2f; + if (calamityGlobalNPC.newAI[0] > 1.5f) + calamityGlobalNPC.newAI[0] = 1.5f; } if (expertMode) @@ -2606,6 +2672,41 @@ namespace CalamityMod.NPCs Main.dust[num624].velocity *= 0.2f; } } + + // Fire lasers on stomp + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num179 = BossRushEvent.BossRushActive ? 24f : death ? 20f : 18.5f; + int maxProjectiles = death ? 6 : 4; + int spread = death ? 60 : 45; + Vector2 value9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num180 = player.position.X + player.width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + damage *= 3; + value9.X += num180; + value9.Y += num182; + for (int i = 0; i < maxProjectiles; i++) + { + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + num183 = num179 / num183; + num180 += Main.rand.Next(-spread, spread + 1); + num182 += Main.rand.Next(-spread, spread + 1); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } } else { @@ -2626,6 +2727,7 @@ namespace CalamityMod.NPCs if (npc.Bottom.Y < player.position.Y) { float fallSpeed = 1.2f; + fallSpeed += 0.4f * enrageScale; if (expertMode) fallSpeed += death ? 0.6f * (1f - lifeRatio) : 0.4f * (1f - lifeRatio); @@ -2637,7 +2739,8 @@ namespace CalamityMod.NPCs } else { - float velocityXChange = 0.02f + Math.Abs(npc.Center.X - player.Center.X) * 0.0005f; + float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; + velocityXChange += 0.05f * enrageScale; if (npc.direction < 0) npc.velocity.X -= velocityXChange; @@ -2645,6 +2748,7 @@ namespace CalamityMod.NPCs npc.velocity.X += velocityXChange; float num626 = BossRushEvent.BossRushActive ? 18f : 12f; + num626 += 4f * enrageScale; if (expertMode) num626 += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); @@ -2832,6 +2936,13 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive); + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Deus cannot hit for 3 seconds if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage) npc.damage = 0; @@ -3177,7 +3288,7 @@ namespace CalamityMod.NPCs // Despawn float fallSpeed = death ? 17.5f : 16f; - if (player.dead || Main.dayTime) + if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8000f) { flag2 = false; float velocity = 2f; @@ -3188,7 +3299,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= velocity; } - if ((double)npc.position.Y < Main.topWorld + 16f) + if ((double)npc.position.Y < Main.topWorld + 16f || Vector2.Distance(player.Center, npc.Center) > 8000f) { for (int num957 = 0; num957 < Main.maxNPCs; num957++) { @@ -3200,12 +3311,15 @@ namespace CalamityMod.NPCs float fallSpeedBoost = 5f * (1f - lifeRatio); fallSpeed += fallSpeedBoost; + fallSpeed += 4f * enrageScale; // Speed and movement float speedBoost = death ? ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.26f : 0.13f) * (1f - lifeRatio)); float turnSpeedBoost = death ? ((targetFloatingUp ? 0.36f : 0.18f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.4f : 0.2f) * (1f - lifeRatio)); float speed = (death ? 0.18f : 0.13f) + speedBoost; float turnSpeed = (death ? 0.25f : 0.2f) + turnSpeedBoost; + speed += 0.05f * enrageScale; + turnSpeed += 0.08f * enrageScale; if (flyAtTarget) { diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 3d5f3a96fd..6858f10ccf 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -585,6 +585,13 @@ namespace CalamityMod.NPCs bool phase5 = lifeRatio < 0.4f; float num5 = (float)(death ? 20 - Math.Round(5f * (1f - lifeRatio)) : 20); + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(true); @@ -645,7 +652,7 @@ namespace CalamityMod.NPCs dust.velocity.Y *= 0.1f; } - if (Main.dayTime | dead) + if (dead) { npc.velocity.Y -= 0.04f; @@ -659,6 +666,9 @@ namespace CalamityMod.NPCs { float num11 = 7f; float num12 = 0.15f; + num11 += 2.5f * enrageScale; + num12 += 0.05f * enrageScale; + if (death) { num11 += 8f * (1f - lifeRatio); @@ -758,6 +768,7 @@ namespace CalamityMod.NPCs { npc.rotation = num8; float num24 = 7.25f; + num24 += 2.5f * enrageScale; if (death) num24 += 8.5f * (1f - lifeRatio); @@ -924,11 +935,15 @@ namespace CalamityMod.NPCs { float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + 3.5f * (0.75f - lifeRatio); float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + 0.025f * (0.75f - lifeRatio); + num37 += 2f * enrageScale; + num38 += 0.02f * enrageScale; + if (death) { num37 += 5f * (0.75f - lifeRatio); num38 += 0.04f * (0.75f - lifeRatio); } + if (BossRushEvent.BossRushActive) { num37 *= 2f; @@ -1007,6 +1022,7 @@ namespace CalamityMod.NPCs npc.rotation = num8; float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + 4f * (0.75f - lifeRatio); + num42 += 2f * enrageScale; if (death) num42 += 5.5f * (0.75f - lifeRatio); if (npc.ai[3] == 1f) @@ -1095,7 +1111,8 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); float speedBoost = death ? 5f * (0.65f - lifeRatio) : 3.5f * (0.65f - lifeRatio); float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; - if (BossRushEvent.BossRushActive) + num48 += 5f * enrageScale; + if (BossRushEvent.BossRushActive) num48 *= 1.5f; Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1347,7 +1364,8 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); float speedBoost = death ? 6f * (0.4f - lifeRatio) : 4f * (0.4f - lifeRatio); float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; - if (BossRushEvent.BossRushActive) + num48 += 5f * enrageScale; + if (BossRushEvent.BossRushActive) num48 *= 1.5f; Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1416,8 +1434,17 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - // Total body segments - float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCorrupt) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + + // Total body segments + float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); // Count segments remaining float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); @@ -1453,10 +1480,13 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.EaterofWorldsHead) { calamityGlobalNPC.newAI[0] += 1f; - float timer = 90f; + float timer = enrageScale > 0f ? 90f : 120f; float shootBoost = death ? lifeRatio * 90f : lifeRatio * 180f; timer += shootBoost; + if (enrageScale == 2f) + timer = 60f; + if (calamityGlobalNPC.newAI[0] >= timer && phase3) { calamityGlobalNPC.newAI[0] = 0f; @@ -1643,9 +1673,10 @@ namespace CalamityMod.NPCs if (!inTiles && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num35 = death ? 400 : 850; + int num35 = death ? 700 : 850; if (BossRushEvent.BossRushActive) - num35 /= 2; + num35 = 100; + num35 -= (int)(enrageScale * 300f); bool freeMoveAnyway = true; for (int num36 = 0; num36 < Main.maxPlayers; num36++) @@ -1665,20 +1696,22 @@ namespace CalamityMod.NPCs } // Velocity and acceleration - float velocityBoost = death ? 4.8f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - float accelerationBoost = death ? 0.06f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio); + float velocityScale = (death ? 4.8f : 2.4f) * enrageScale; + float velocityBoost = velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; + float accelerationBoost = accelerationScale * (1f - lifeRatio); float num37 = 12f + velocityBoost; float num38 = 0.15f + accelerationBoost; if (phase5) { - num37 += 2.4f; - num38 += 0.03f; + num37 += 2.4f * enrageScale; + num38 += 0.03f * enrageScale; } else if (phase4) { - num37 += 1.2f; - num38 += 0.015f; + num37 += 1.2f * enrageScale; + num38 += 0.015f * enrageScale; } Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1782,17 +1815,17 @@ namespace CalamityMod.NPCs num40 *= num57; // Despawn - bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead); + bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; if (shouldDespawn && !BossRushEvent.BossRushActive) { - bool nobodyElseInEvilBiome = true; + bool everyoneDead = true; for (int num58 = 0; num58 < Main.maxPlayers; num58++) { - if (Main.player[num58].active && !Main.player[num58].dead && (Main.player[num58].ZoneCorrupt || Main.player[num58].ZoneCrimson)) - nobodyElseInEvilBiome = false; + if (Main.player[num58].active && !Main.player[num58].dead) + everyoneDead = false; } - if (nobodyElseInEvilBiome) + if (everyoneDead) { if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) { @@ -1932,6 +1965,15 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Spawn Creepers if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) { @@ -2025,7 +2067,8 @@ namespace CalamityMod.NPCs float num795 = Main.player[npc.target].Center.X - vector98.X; float num796 = Main.player[npc.target].Center.Y - vector98.Y; float num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); - float velocityBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + float velocityScale = (death ? 4f : 2f) * enrageScale; + float velocityBoost = velocityScale * (1f - lifeRatio); float num798 = 8f + velocityBoost; if (BossRushEvent.BossRushActive) num798 *= 2f; @@ -2310,6 +2353,7 @@ namespace CalamityMod.NPCs // Creeper count int creeperCount = NPC.CountNPCS(NPCID.Creeper); int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; + creeperScale *= (int)enrageScale; bool phase2 = creeperCount <= 0; // Go to phase 2 @@ -2423,7 +2467,7 @@ namespace CalamityMod.NPCs } // Despawn - if ((Main.player[npc.target].dead || (!Main.player[npc.target].ZoneCrimson && !Main.player[npc.target].ZoneCorrupt)) && !BossRushEvent.BossRushActive) + if (Main.player[npc.target].dead && !BossRushEvent.BossRushActive) { if (npc.localAI[3] < 120f) npc.localAI[3] += 1f; @@ -2453,6 +2497,15 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Creeper count, 0 to 20 int creeperCount = NPC.CountNPCS(NPCID.Creeper); bool phase2 = creeperCount <= (death ? 12 : 6); @@ -2468,9 +2521,10 @@ namespace CalamityMod.NPCs float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; float num814 = (float)Math.Sqrt(num812 * num812 + num813 * num813); - float velocity = death ? 14f : 9f; + float velocity = death ? 10f : 7f; if (BossRushEvent.BossRushActive) velocity *= 2f; + velocity += 4f * enrageScale; // Max distance from Brain if (num814 > 90f) @@ -2491,6 +2545,7 @@ namespace CalamityMod.NPCs // Charge at target int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; + creeperScale *= (int)enrageScale; npc.ai[1] += (death ? 1f : 0.5f) + (creeperScale * 0.25f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) { @@ -2511,7 +2566,8 @@ namespace CalamityMod.NPCs // Charge else { - float chargeVelocity = death ? 14f : 9f; + float chargeVelocity = death ? 10f : 7f; + chargeVelocity += 4f * enrageScale; Vector2 value2 = Main.player[npc.target].Center - npc.Center; value2.Normalize(); value2 *= chargeVelocity; @@ -2576,7 +2632,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - float enrageScale = death ? 0.5f : 0f; + float enrageScale = death ? 0.25f : 0f; if ((npc.position.Y / 16f) < Main.worldSurface) enrageScale += 1f; if (!Main.player[npc.target].ZoneJungle) @@ -3196,6 +3252,7 @@ namespace CalamityMod.NPCs bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + Vector2 vectorCenter = npc.Center; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -3318,22 +3375,30 @@ namespace CalamityMod.NPCs int type = ProjectileID.Shadowflames; int damage = npc.GetProjectileDamage(type); - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num151; - int numProj = death ? 4 : 2; - float rotation = MathHelper.ToRadians(15); - for (int i = 0; i < numProj + 1; i++) - { - if (i % 2f != 0f && death) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.ChaosBall); - else - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[proj].timeLeft = 600; - } - } + int numProj = death ? 5 : 3; + + float num743 = Main.player[npc.target].Center.X - vectorCenter.X; + float num744 = Main.player[npc.target].Center.Y - vectorCenter.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + + num745 = num151 / num745; + num743 *= num745; + num744 *= num745; + vectorCenter.X += num743 * 3f; + vectorCenter.Y += num744 * 3f; + + float rotation = MathHelper.ToRadians(60); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[proj].timeLeft = 600; + } } // Teleport dust @@ -3691,16 +3756,16 @@ namespace CalamityMod.NPCs if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y -= BossRushEvent.BossRushActive ? 0.13f : death ? 0.09f : 0.07f; + npc.velocity.Y *= 0.94f; + npc.velocity.Y -= BossRushEvent.BossRushActive ? 0.16f : 0.08f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y += BossRushEvent.BossRushActive ? 0.13f : death ? 0.09f : 0.07f; + npc.velocity.Y *= 0.94f; + npc.velocity.Y += BossRushEvent.BossRushActive ? 0.16f : 0.08f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3708,8 +3773,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X -= BossRushEvent.BossRushActive ? 0.2f : death ? 0.12f : 0.1f; + npc.velocity.X *= 0.94f; + npc.velocity.X -= BossRushEvent.BossRushActive ? 0.24f : 0.12f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3717,8 +3782,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X += BossRushEvent.BossRushActive ? 0.2f : death ? 0.12f : 0.1f; + npc.velocity.X *= 0.94f; + npc.velocity.X += BossRushEvent.BossRushActive ? 0.24f : 0.12f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3740,7 +3805,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y -= BossRushEvent.BossRushActive ? 0.15f : death ? 1f : 0.08f; + npc.velocity.Y -= BossRushEvent.BossRushActive ? 0.2f : 0.1f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } @@ -3748,7 +3813,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y += BossRushEvent.BossRushActive ? 0.15f : death ? 1f : 0.08f; + npc.velocity.Y += BossRushEvent.BossRushActive ? 0.2f : 0.1f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3757,7 +3822,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.X > 0f) npc.velocity.X *= 0.92f; - npc.velocity.X -= BossRushEvent.BossRushActive ? 0.28f : death ? 0.16f : 0.14f; + npc.velocity.X -= BossRushEvent.BossRushActive ? 0.36f : 0.18f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3766,7 +3831,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.X < 0f) npc.velocity.X *= 0.92f; - npc.velocity.X += BossRushEvent.BossRushActive ? 0.28f : death ? 0.16f : 0.14f; + npc.velocity.X += BossRushEvent.BossRushActive ? 0.36f : 0.18f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3801,7 +3866,7 @@ namespace CalamityMod.NPCs num186 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector23.Y; num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); - num187 = 23f / num187; + num187 = 22f / num187; if (BossRushEvent.BossRushActive) num187 *= 1.5f; @@ -3839,7 +3904,7 @@ namespace CalamityMod.NPCs num189 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector24.Y; num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); - num190 = 24f / num190; + num190 = 23f / num190; if (BossRushEvent.BossRushActive) num190 *= 1.5f; @@ -4319,8 +4384,14 @@ namespace CalamityMod.NPCs // Decrement the enraged laser timer if (npc.localAI[3] > 0f) + { npc.localAI[3] -= 1f; + // Stop firing normal lasers when enrage ends + if (npc.localAI[3] == 0f) + npc.localAI[1] = 0f; + } + float shootBoost = fireAcceleratingLasers ? (death ? 1.5f : 1.5f * (1f - lifeRatio)) : (death ? 3f : 4f * (1f - lifeRatio)); npc.localAI[1] += 1f + shootBoost; @@ -4379,6 +4450,8 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // 10 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] == 0f) + npc.velocity = Vector2.UnitY; if (calamityGlobalNPC.newAI[1] < 600f) calamityGlobalNPC.newAI[1] += 1f; @@ -4408,6 +4481,13 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Enrage variable if player is flying upside down bool targetFloatingUp = player.gravDir == -1f; @@ -4459,16 +4539,16 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody) { // Gain more defense as health lowers with a max of 10, lose defense if probe has been launched - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f || enrageScale > 0f) { - int defenseBoost = (int)(10f * (1f - lifeRatio)); + int defenseBoost = (int)(10f * (1f - lifeRatio) * enrageScale); npc.defense = npc.defDefense + defenseBoost; } else npc.defense = npc.defDefense - 10; - // Enrage, fire more homing lasers - if (targetFloatingUp) + // Enrage, fire more cyan lasers + if (targetFloatingUp || enrageScale > 0f) { if (calamityGlobalNPC.newAI[2] < 480f) calamityGlobalNPC.newAI[2] += 1f; @@ -4510,14 +4590,14 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 160f && !flyAtTarget) { // Laser rate of fire - int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); + int shootTime = phase4 ? 2 : startFlightPhase ? 3 : 4; if (BossRushEvent.BossRushActive) shootTime += 1; if (enraged || configBossRushBoost) shootTime += 2; calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); - int randomCount = death ? Main.rand.Next(1470, 27301) : Main.rand.Next(1330, 24701); + int randomCount = Main.rand.Next(1400, 26001); if (calamityGlobalNPC.newAI[0] >= randomCount) { @@ -4526,7 +4606,8 @@ namespace CalamityMod.NPCs if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { // Laser speed - float projectileSpeed = 4f; + float projectileSpeed = npc.ai[2] == 0f ? 2f : 4f; + projectileSpeed += enrageScale; if (phase2) projectileSpeed += 0.25f; if (phase3) @@ -4537,47 +4618,34 @@ namespace CalamityMod.NPCs // Set projectile damage and type, set projectile to saucer scrap if probe has been launched int projectileType = ProjectileID.DeathLaser; float laserSpawnDistance = 5f; - if (npc.ai[2] == 0f || Main.rand.NextBool(2)) - { - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) - { - case 0: - case 1: - break; - case 2: - projectileType = ModContent.ProjectileType(); - break; - case 3: - projectileType = ModContent.ProjectileType(); - break; - } + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) + { + case 0: + case 1: + break; + case 2: + projectileType = ModContent.ProjectileType(); + break; + case 3: + projectileType = ModContent.ProjectileType(); + break; + } - if (calamityGlobalNPC.newAI[2] > 0f) - { - projectileType = ModContent.ProjectileType(); - laserSpawnDistance = 10f; - } - } - else - projectileType = ProjectileID.SaucerScrap; + if (calamityGlobalNPC.newAI[2] > 0f) + { + projectileType = ModContent.ProjectileType(); + laserSpawnDistance = 10f; + } // Get target vector Vector2 projectileVelocity = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * projectileSpeed; - - if (projectileType == ProjectileID.SaucerScrap) - projectileVelocity *= 0.5f; - Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long int damage = npc.GetProjectileDamage(projectileType); int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); - - if (projectileType == ProjectileID.SaucerScrap) - Main.projectile[proj].timeLeft = 480; - else - Main.projectile[proj].timeLeft = 600; + Main.projectile[proj].timeLeft = 900; npc.netUpdate = true; } @@ -4662,7 +4730,7 @@ namespace CalamityMod.NPCs // Despawn float fallSpeed = 16f; - if (Main.dayTime || player.dead) + if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8000f) { flag2 = false; npc.velocity.Y += 1f; @@ -4673,7 +4741,7 @@ namespace CalamityMod.NPCs fallSpeed = 32f; } - if (npc.position.Y > Main.rockLayer * 16.0) + if (npc.position.Y > Main.rockLayer * 16.0 || Vector2.Distance(player.Center, npc.Center) > 8000f) { for (int n = 0; n < Main.maxNPCs; n++) { @@ -4685,12 +4753,15 @@ namespace CalamityMod.NPCs float fallSpeedBoost = death ? 6.5f * (1f - lifeRatio) : 5f * (1f - lifeRatio); fallSpeed += fallSpeedBoost; + fallSpeed += 4f * enrageScale; // Speed and movement float speedBoost = death ? ((targetFloatingUp ? 0.28f : 0.14f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); float turnSpeedBoost = death ? ((targetFloatingUp ? 0.37f : 0.19f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); float speed = 0.1f + speedBoost; float turnSpeed = 0.15f + turnSpeedBoost; + speed += 0.04f * enrageScale; + turnSpeed += 0.06f * enrageScale; if (flyAtTarget) { @@ -4990,7 +5061,7 @@ namespace CalamityMod.NPCs npc.ai[0] = -200f; } - if (targetDead || Main.dayTime) + if (targetDead) { num4 = npc.direction * velocity / 2f; num5 = -velocity / 2f; @@ -5070,7 +5141,7 @@ namespace CalamityMod.NPCs npc.velocity.X *= 0.9f; } - if (targetDead || Main.dayTime) + if (targetDead) { npc.velocity.Y -= acceleration * 2f; if (npc.timeLeft > 10) @@ -5405,6 +5476,13 @@ namespace CalamityMod.NPCs bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -5469,7 +5547,7 @@ namespace CalamityMod.NPCs dust.velocity.Y *= 0.1f; } - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { for (int num381 = 0; num381 < Main.maxNPCs; num381++) { @@ -5479,7 +5557,7 @@ namespace CalamityMod.NPCs } } - if (Main.dayTime | Main.player[npc.target].dead) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -5495,6 +5573,8 @@ namespace CalamityMod.NPCs { float num382 = 8.25f; float num383 = 0.115f; + num382 += 2f * enrageScale; + num383 += 0.025f * enrageScale; if (death) { @@ -5572,6 +5652,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { float num389 = BossRushEvent.BossRushActive ? 12f : 10.5f; + num389 += 3f * enrageScale; int type = ProjectileID.EyeLaser; int damage = npc.GetProjectileDamage(type); @@ -5592,6 +5673,7 @@ namespace CalamityMod.NPCs { npc.rotation = num378; float num393 = BossRushEvent.BossRushActive ? 22.5f : 15f; + num393 += 5f * enrageScale; if (death) num393 += 12f * (1f - lifeRatio); @@ -5726,6 +5808,8 @@ namespace CalamityMod.NPCs { float num399 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); float num400 = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); + num399 += 3f * enrageScale; + num400 += 0.05f * enrageScale; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; @@ -5806,6 +5890,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num404 = BossRushEvent.BossRushActive ? 12f : 10f; + num404 += 3f * enrageScale; int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); @@ -5838,6 +5923,8 @@ namespace CalamityMod.NPCs float num409 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); float num410 = 0.25f + (death ? 0.075f * (0.7f - lifeRatio) : 0f); + num409 += 3f * enrageScale; + num410 += 0.1f * enrageScale; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; @@ -5946,8 +6033,9 @@ namespace CalamityMod.NPCs // Set rotation and velocity npc.rotation = num378; float num450 = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); + num450 += 5f * enrageScale; - if (!spazAlive) + if (!spazAlive) num450 += 2f; // Enrage @@ -5971,7 +6059,9 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; - float chargeTime = spazAlive ? 110f : 75f; + float chargeTime = spazAlive ? 45f : 30f; + if (npc.ai[3] % 3f == 0f) + chargeTime = spazAlive ? 90f : 60f; if (death) chargeTime -= chargeTime * 0.25f * (0.7f - lifeRatio); if (BossRushEvent.BossRushActive) @@ -5990,47 +6080,58 @@ namespace CalamityMod.NPCs { npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - float fireRate = spazAlive ? 13f : 9f; - if (BossRushEvent.BossRushActive) - fireRate = 7f; + if (npc.ai[3] % 3f == 0f) + { + float fireRate = spazAlive ? 13f : 9f; + if (BossRushEvent.BossRushActive) + fireRate = 7f; - if (npc.ai[2] % fireRate == 0f) - { - Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + if (npc.ai[2] % fireRate == 0f) + { + Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(SoundID.Item33, npc.position); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Item33, npc.position); - float num353 = 6f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + float num353 = 6f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; + vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } } - // Charge once + // Charge four times if (npc.ai[2] >= chargeTime + 30f) { npc.ai[2] = 0f; + npc.ai[3] += 1f; npc.target = Main.maxPlayers; npc.rotation = num378; - npc.ai[1] = 1f; + float maxChargeAmt = spazAlive ? 2f : 4f; + if (npc.ai[3] >= maxChargeAmt) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 4f; } } @@ -6114,6 +6215,13 @@ namespace CalamityMod.NPCs bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if (Main.dayTime) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Enrage variable if player is floating upside down bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; @@ -6181,7 +6289,7 @@ namespace CalamityMod.NPCs } // Despawn Twins at the same time - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { for (int num423 = 0; num423 < Main.maxNPCs; num423++) { @@ -6192,7 +6300,7 @@ namespace CalamityMod.NPCs } // Despawn - if (Main.dayTime | Main.player[npc.target].dead) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -6214,6 +6322,8 @@ namespace CalamityMod.NPCs // Velocity float num424 = 12f; float num425 = 0.4f; + num424 += 3f * enrageScale; + num425 += 0.1f * enrageScale; if (death) { @@ -6291,6 +6401,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { float num430 = BossRushEvent.BossRushActive ? 20f : 15f; + num430 += 3f * enrageScale; int type = ProjectileID.CursedFlameHostile; int damage = npc.GetProjectileDamage(type); @@ -6315,6 +6426,7 @@ namespace CalamityMod.NPCs // Rotation and velocity npc.rotation = num420; float num434 = BossRushEvent.BossRushActive ? 24f : 16f; + num434 += 4f * enrageScale; if (death) num434 += 12f * (1f - lifeRatio); @@ -6466,7 +6578,10 @@ namespace CalamityMod.NPCs { float num440 = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); float num441 = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); - if (BossRushEvent.BossRushActive) + num440 += 2f * enrageScale; + num441 += 0.03f * enrageScale; + + if (BossRushEvent.BossRushActive) { num440 *= 1.5f; num441 *= 1.5f; @@ -6555,6 +6670,7 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; float num446 = BossRushEvent.BossRushActive ? 9f : 6f; + num446 += 2f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -6596,9 +6712,10 @@ namespace CalamityMod.NPCs // Set rotation and velocity npc.rotation = num420; float num450 = 16.75f + (death ? 5f * (0.7f - lifeRatio) : 0f); + num450 += 4f * enrageScale; - // Enrage - if (targetFloatingUp) + // Enrage + if (targetFloatingUp) num450 += 2f; if (BossRushEvent.BossRushActive) @@ -6686,7 +6803,8 @@ namespace CalamityMod.NPCs // Velocity float num48 = ((enraged || configBossRushBoost) ? 30f : 20f) + (death ? 6f * (0.7f - lifeRatio) : 0f); - if (BossRushEvent.BossRushActive) + num48 += 5f * enrageScale; + if (BossRushEvent.BossRushActive) num48 *= 1.5f; if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) num48 *= 1.3f; @@ -6960,7 +7078,7 @@ namespace CalamityMod.NPCs else if (allArmsDead) npc.damage = npc.defDamage; - int defenseBoost = death ? 15 : 10; + int defenseBoost = 20; npc.defense = npc.defDefense + (cannonAlive ? defenseBoost : 0) + (laserAlive ? defenseBoost : 0) + (viceAlive ? defenseBoost : 0) + (sawAlive ? defenseBoost : 0); // Phases @@ -7074,7 +7192,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] >= 300f) { npc.localAI[2] = 0f; - float num502 = BossRushEvent.BossRushActive ? 10f : 6.5f; + float num502 = BossRushEvent.BossRushActive ? 6f : 3f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); Vector2 value19 = Main.player[npc.target].Center - npc.Center; @@ -7897,7 +8015,7 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - float num495 = BossRushEvent.BossRushActive ? 10f : 6.5f; + float num495 = BossRushEvent.BossRushActive ? 6f : 3f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); num494 = num495 / num494; @@ -7967,7 +8085,7 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 180f) { npc.localAI[0] = 0f; - float num502 = BossRushEvent.BossRushActive ? 10f : 6.5f; + float num502 = BossRushEvent.BossRushActive ? 6f : 3f; int type = ProjectileID.RocketSkeleton; int damage = npc.GetProjectileDamage(type); Vector2 value19 = Main.player[npc.target].Center - npc.Center; @@ -9001,7 +9119,7 @@ namespace CalamityMod.NPCs } if (canHit) { - float num757 = BossRushEvent.BossRushActive ? 12f : 8f; + float num757 = BossRushEvent.BossRushActive ? 12f : 4f; Vector2 vector94 = npc.Center; float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); float num759 = Math.Abs(num758 * 0.2f); @@ -10498,16 +10616,24 @@ namespace CalamityMod.NPCs // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune if (!phase3AI) - npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || enrage; + npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; // Enrage if (enrage) { + bubbleBelchPhaseTimer = 20; + bubbleBelchPhaseDivisor = 1; + bubbleBelchPhaseAcceleration = 1f; + bubbleBelchPhaseVelocity = 10f; idlePhaseTimer = 20; - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 2; - npc.ai[3] = 0f; - chargeVelocity += 8f; + idlePhaseAcceleration = 1f; + idlePhaseVelocity = 15f; + chargeTime = 20; + chargeVelocity += 8f; + bubbleSpinPhaseDivisor = 1; + bubbleSpinBubbleVelocity = 15f; + npc.damage = npc.defDamage * 2; + npc.defense = npc.defDefense * 3; } // Spawn cthulhunadoes in phase 3 @@ -11412,16 +11538,12 @@ namespace CalamityMod.NPCs (phase5 ? 10 : 0); int idleTime = 40 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - (phase4 ? 5 : 0) - (phase5 ? 5 : 0); float timeToFinishRitual = 420f - - (phase2 ? 90f : 0f) - - (phase3 ? 60f : 0f) - - (phase4 ? 30f : 0f) - - (phase5 ? 15f : 0f); + (phase4 ? 120f : 0f) - + (phase5 ? 75f : 0f); if (BossRushEvent.BossRushActive) { @@ -13436,7 +13558,7 @@ namespace CalamityMod.NPCs { Vector2 vector203 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value19 * npc.localAI[1]); - float velocity = BossRushEvent.BossRushActive ? 9f : death ? 7.25f : 6.75f; + float velocity = BossRushEvent.BossRushActive ? 9f : death ? 6.75f : 6.25f; switch (aggressionLevel) { case 4: @@ -13618,20 +13740,20 @@ namespace CalamityMod.NPCs int num1186 = 7; int num1187 = 4; - float divisor = 4f; + float divisor = 6f; switch (aggressionLevel) { case 4: break; case 3: - divisor = 6f; - break; - case 2: divisor = 8f; break; - case 1: + case 2: divisor = 10f; break; + case 1: + divisor = 12f; + break; default: break; } @@ -13979,7 +14101,7 @@ namespace CalamityMod.NPCs { Vector2 vector181 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); - float velocity = BossRushEvent.BossRushActive ? 9f : death ? 7.25f : 6.75f; + float velocity = BossRushEvent.BossRushActive ? 9f : death ? 6.75f : 6.25f; switch (aggressionLevel) { case 4: @@ -20364,14 +20486,13 @@ namespace CalamityMod.NPCs bool flag = npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.LeechHead || npc.type == NPCID.DuneSplicerHead || (!Main.player[npc.target].ZoneUndergroundDesert && npc.type == NPCID.TombCrawlerHead); float num4 = npc.type == NPCID.TombCrawlerHead ? 0.1f : 0.2f; - bool isSplittingNPC = (npc.type >= NPCID.DevourerHead && npc.type <= NPCID.DevourerTail) || (npc.type >= NPCID.DiggerHead && npc.type <= NPCID.DiggerTail) || - (npc.type >= NPCID.SeekerHead && npc.type <= NPCID.SeekerTail) || (npc.type >= NPCID.DuneSplicerHead && npc.type <= NPCID.DuneSplicerTail); + bool isSplittingNPC = (npc.type >= NPCID.DiggerHead && npc.type <= NPCID.DiggerTail) || (npc.type >= NPCID.SeekerHead && npc.type <= NPCID.SeekerTail) || (npc.type >= NPCID.DuneSplicerHead && npc.type <= NPCID.DuneSplicerTail); - bool isSplittingNPCHead = npc.type == NPCID.DevourerHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.DuneSplicerHead; + bool isSplittingNPCHead = npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.DuneSplicerHead; - bool isSplittingNPCBody = npc.type == NPCID.DevourerBody || npc.type == NPCID.DiggerBody || npc.type == NPCID.SeekerBody || npc.type == NPCID.DuneSplicerBody; + bool isSplittingNPCBody = npc.type == NPCID.DiggerBody || npc.type == NPCID.SeekerBody || npc.type == NPCID.DuneSplicerBody; - bool isSplittingNPCTail = npc.type == NPCID.DevourerTail || npc.type == NPCID.DiggerTail || npc.type == NPCID.SeekerTail || npc.type == NPCID.DuneSplicerTail; + bool isSplittingNPCTail = npc.type == NPCID.DiggerTail || npc.type == NPCID.SeekerTail || npc.type == NPCID.DuneSplicerTail; if (isSplittingNPC) { @@ -20485,9 +20606,9 @@ namespace CalamityMod.NPCs } } - if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) + if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) { - if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) + if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) { if (!isSplittingNPCHead) { @@ -20522,7 +20643,7 @@ namespace CalamityMod.NPCs npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - else if ((isSplittingNPCBody || npc.type == NPCID.GiantWormBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) + else if ((isSplittingNPCBody || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) { npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } @@ -20681,7 +20802,7 @@ namespace CalamityMod.NPCs } } - if (!flag2 && (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) + if (!flag2 && (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num35 = 1000; @@ -25503,23 +25624,21 @@ namespace CalamityMod.NPCs #endregion #region Spore AI - public static bool BuffedSporeAI(NPC npc, Mod mod, bool death) + public static bool BuffedSporeAI(NPC npc, Mod mod) { if (npc.timeLeft > 5) - { npc.timeLeft = 5; - } + npc.noTileCollide = true; npc.velocity.Y += 0.02f; // Ensure slow fall if (npc.velocity.Y > 1f) - { npc.velocity.Y = 1f; - } + npc.TargetClosest(true); - float acceleration = death ? 0.25f : 0.2f; - float velocity = death ? 7f : 5f; + float acceleration = 0.2f; + float velocity = 5f; // Simple movement AI. You shouldn't need any help from comments to parse this. if (npc.Center.X < Main.player[npc.target].position.X) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 5fc4e27e59..017b38486e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -314,6 +314,19 @@ namespace CalamityMod.NPCs NPCID.EaterofWorldsTail }; + public static List DeathModeSplittingWormIDs = new List + { + NPCID.DuneSplicerHead, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.DiggerHead, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.SeekerHead, + NPCID.SeekerBody, + NPCID.SeekerTail + }; + public static List DestroyerIDs = new List { NPCID.TheDestroyer, @@ -912,7 +925,7 @@ namespace CalamityMod.NPCs break; case NPCID.SkeletronPrime: - npc.lifeMax = (int)(npc.lifeMax * 1.9); + npc.lifeMax = (int)(npc.lifeMax * 1.45); npc.npcSlots = 12f; break; @@ -937,6 +950,11 @@ namespace CalamityMod.NPCs { npc.value = (int)(npc.value * 1.5); + if (DeathModeSplittingWormIDs.Contains(npc.type)) + { + if (CalamityWorld.death) + npc.lifeMax = (int)(npc.lifeMax * 0.5); + } if (npc.type == NPCID.Mothron) { npc.scale = 1.25f; @@ -965,7 +983,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Golem) { - npc.lifeMax = (int)(npc.lifeMax * 4.0); + npc.lifeMax = (int)(npc.lifeMax * 3.5); npc.npcSlots = 64f; } else if (npc.type == NPCID.GolemHead) @@ -974,7 +992,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)(npc.lifeMax * 1.25); + npc.lifeMax = (int)(npc.lifeMax * 1.7); npc.dontTakeDamage = false; } else if (npc.type == NPCID.Plantera) @@ -995,7 +1013,7 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)(npc.lifeMax * 1.05); } - else if (npc.type == NPCID.SkeletronHead) // 8800 in expert, 6600 in rev, 4400 in death + else if (npc.type == NPCID.SkeletronHead) { if (CalamityWorld.death) npc.lifeMax = (int)(npc.lifeMax * 0.5); @@ -1004,10 +1022,10 @@ namespace CalamityMod.NPCs npc.npcSlots = 12f; } - else if (npc.type == NPCID.SkeletronHand) // 3120 in expert, 11232 in rev, 18720 in death + else if (npc.type == NPCID.SkeletronHand) { if (CalamityWorld.death) - npc.lifeMax = (int)(npc.lifeMax * 0.75); + npc.lifeMax = (int)(npc.lifeMax * 0.65); else npc.lifeMax = (int)(npc.lifeMax * 0.9); } @@ -1065,7 +1083,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronPrime) { - npc.lifeMax = (int)(npc.lifeMax * 1.45); + npc.lifeMax = (int)(npc.lifeMax * 1.2); npc.npcSlots = 12f; } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) @@ -2288,7 +2306,7 @@ namespace CalamityMod.NPCs { case NPCID.FungiSpore: case NPCID.Spore: - return CalamityGlobalAI.BuffedSporeAI(npc, mod, true); + return CalamityGlobalAI.BuffedSporeAI(npc, mod); } break; case 73: @@ -2341,7 +2359,7 @@ namespace CalamityMod.NPCs else if (Main.expertMode) { if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) - return CalamityGlobalAI.BuffedSporeAI(npc, mod, false); + return CalamityGlobalAI.BuffedSporeAI(npc, mod); } return true; @@ -3680,7 +3698,16 @@ namespace CalamityMod.NPCs } } } - } + + if (spawnInfo.playerSafe) + return; + + if (!Main.hardMode && spawnInfo.player.ZoneUnderworldHeight) + { + if (!NPC.AnyNPCs(NPCID.VoodooDemon)) + pool[NPCID.VoodooDemon] = SpawnCondition.Underworld.Chance * 1.5f; + } + } #endregion #region Drawing @@ -4320,9 +4347,6 @@ namespace CalamityMod.NPCs { switch (npc.type) { - case NPCID.DevourerHead: - case NPCID.DevourerBody: - case NPCID.DevourerTail: case NPCID.DiggerHead: case NPCID.DiggerBody: case NPCID.DiggerTail: diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 49790cb43f..a9b6c5645c 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -59,22 +59,18 @@ namespace CalamityMod.NPCs { switch (npc.type) { - case NPCID.DevourerHead: - case NPCID.DevourerBody: - case NPCID.DevourerTail: - return SplittingWormLoot(npc, mod, 0); case NPCID.DiggerHead: case NPCID.DiggerBody: case NPCID.DiggerTail: - return SplittingWormLoot(npc, mod, 1); + return SplittingWormLoot(npc, mod, 0); case NPCID.SeekerHead: case NPCID.SeekerBody: case NPCID.SeekerTail: - return SplittingWormLoot(npc, mod, 2); + return SplittingWormLoot(npc, mod, 1); case NPCID.DuneSplicerHead: case NPCID.DuneSplicerBody: case NPCID.DuneSplicerTail: - return SplittingWormLoot(npc, mod, 3); + return SplittingWormLoot(npc, mod, 2); default: break; } @@ -525,10 +521,9 @@ namespace CalamityMod.NPCs { switch (wormType) { - case 0: return CheckSegments(NPCID.DevourerHead, NPCID.DevourerBody, NPCID.DevourerTail); - case 1: return CheckSegments(NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); - case 2: return CheckSegments(NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); - case 3: return CheckSegments(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); + case 0: return CheckSegments(NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); + case 1: return CheckSegments(NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); + case 2: return CheckSegments(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); default: break; } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index 742cab9637..e536444995 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -82,7 +82,7 @@ namespace CalamityMod.NPCs.Crabulon bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - npc.spriteDirection = npc.direction; + npc.spriteDirection = npc.direction; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -128,6 +128,15 @@ namespace CalamityMod.NPCs.Crabulon else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!player.ZoneGlowshroom) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + if (npc.ai[0] != 0f && npc.ai[0] < 3f) { Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -233,23 +242,23 @@ namespace CalamityMod.NPCs.Crabulon } else if (npc.ai[0] == 2f) { - float num823 = 1.25f; - bool flag51 = false; + float num823 = 1f; if (phase2) - num823 = 1.5f; + num823 = 1.25f; if (phase3) - num823 = 2f; + num823 = 1.75f; if (death) num823 += 2f * (1f - lifeRatio); if (BossRushEvent.BossRushActive) num823 = 12f; if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) num823 = 16f; + num823 += 2f * enrageScale; - if (Math.Abs(npc.Center.X - player.Center.X) < 50f) - { + bool flag51 = false; + if (Math.Abs(npc.Center.X - player.Center.X) < 50f) flag51 = true; - } + if (flag51) { npc.velocity.X *= 0.9f; @@ -509,6 +518,7 @@ namespace CalamityMod.NPCs.Crabulon (expertMode ? 0.02f : 0f) + (revenge ? 0.02f : 0f) + (death ? 0.02f : 0f); + velocityX += 0.05f * enrageScale; if (npc.direction < 0) npc.velocity.X -= velocityX; @@ -516,6 +526,7 @@ namespace CalamityMod.NPCs.Crabulon npc.velocity.X += velocityX; float num626 = BossRushEvent.BossRushActive ? 5f : 2.5f; + num626 += enrageScale; if (revenge) { num626 += 1f; @@ -556,7 +567,7 @@ namespace CalamityMod.NPCs.Crabulon if ((npc.life + num660) < npc.localAI[0]) { npc.localAI[0] = npc.life; - int num661 = death ? 3 : expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3); + int num661 = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; for (int num662 = 0; num662 < num661; num662++) { int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index daf08dd730..e66f631138 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -124,23 +124,29 @@ namespace CalamityMod.NPCs.Cryogen Player player = Main.player[npc.target]; - bool isChill = player.ZoneSnow; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if (!player.ZoneSnow) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool phase2 = lifeRatio < (death ? 0.95 : revenge ? 0.89 : 0.83); - bool phase3 = lifeRatio < (death ? 0.8 : revenge ? 0.73 : 0.66); - bool phase4 = lifeRatio < (death ? 0.7 : revenge ? 0.6 : 0.49); - bool phase5 = lifeRatio < (death ? 0.55 : revenge ? 0.43 : 0.32); - bool phase6 = lifeRatio < (death ? 0.4 : revenge ? 0.27 : 0.15); - bool phase7 = lifeRatio < (death ? 0.25 : 0.15) && revenge; - bool phase8 = lifeRatio < (revenge ? 0.225 : 0.1); - bool phase9 = lifeRatio < (revenge ? 0.2 : 0.05) || death; + bool phase2 = lifeRatio < 0.85f; + bool phase3 = lifeRatio < 0.7f; + bool phase4 = lifeRatio < 0.55f; + bool phase5 = lifeRatio < 0.4f; + bool phase6 = lifeRatio < (death ? 0.3f : revenge ? 0.25f : expertMode ? 0.2f : 0.15f); + bool phase7 = lifeRatio < (death ? 0.15f : 0.1f) && revenge; + bool phase8 = lifeRatio < (revenge ? 0.075f : 0.05f); + bool phase9 = lifeRatio < (revenge ? 0.05f : 0.025f) || death; if ((int)npc.ai[0] + 1 > currentPhase && currentPhase < 6) { @@ -260,11 +266,8 @@ namespace CalamityMod.NPCs.Cryogen float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); - float num1246 = isChill ? 4f : 8f; - if (death) - { - num1246 = isChill ? 5f : 10f; - } + float num1246 = death ? 5f : 4f; + num1246 += 2f * enrageScale; if (BossRushEvent.BossRushActive) { num1246 = 14f; @@ -307,10 +310,10 @@ namespace CalamityMod.NPCs.Cryogen } } - float velocity = isChill ? 7.5f : 4f; - float acceleration = isChill ? 0.1f : 0.15f; - if (death) - velocity = isChill ? 7f : 3.5f; + float velocity = death ? 3.5f : 4f; + float acceleration = 0.15f; + velocity -= enrageScale; + acceleration += 0.07f * enrageScale; if (BossRushEvent.BossRushActive) { velocity = 3f; @@ -430,12 +433,9 @@ namespace CalamityMod.NPCs.Cryogen float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); - float num1246 = isChill ? 6f : 12f; - if (death) - { - num1246 = isChill ? 7f : 14f; - } - if (BossRushEvent.BossRushActive) + float num1246 = death ? 7f : 6f; + num1246 += 2f * enrageScale; + if (BossRushEvent.BossRushActive) { num1246 = 20f; } @@ -495,10 +495,10 @@ namespace CalamityMod.NPCs.Cryogen } } - float velocity = isChill ? 7.5f : 4f; - float acceleration = isChill ? 0.1f : 0.15f; - if (death) - velocity = isChill ? 7f : 3.5f; + float velocity = death ? 3.5f : 4f; + float acceleration = 0.15f; + velocity -= enrageScale; + acceleration += 0.07f * enrageScale; if (BossRushEvent.BossRushActive) { velocity = 3f; @@ -741,7 +741,7 @@ namespace CalamityMod.NPCs.Cryogen if (phase7) { if (npc.ai[1] == 60f) - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (BossRushEvent.BossRushActive ? 30f : (isChill ? 18f : 24f)); + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (BossRushEvent.BossRushActive ? 30f : 18f + enrageScale * 2f); npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) @@ -773,7 +773,7 @@ namespace CalamityMod.NPCs.Cryogen return; } - float num1372 = isChill ? 16f : 24f; + float num1372 = 16f + enrageScale * 2f; if (BossRushEvent.BossRushActive) { num1372 = 32f; @@ -868,10 +868,10 @@ namespace CalamityMod.NPCs.Cryogen npc.netUpdate = true; } - float velocity = isChill ? 6f : 3f; - float acceleration = isChill ? 0.2f : 0.3f; - if (death) - velocity = isChill ? 5f : 2.5f; + float velocity = death ? 5f : 6f; + float acceleration = 0.2f; + velocity -= enrageScale; + acceleration += 0.07f * enrageScale; if (BossRushEvent.BossRushActive) { velocity = 2f; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index cb5c20106f..cf21d88e4c 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -91,6 +91,18 @@ namespace CalamityMod.NPCs.DesertScourge bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + Player player = Main.player[npc.target]; + + float enrageScale = 0f; + if (!player.ZoneDesert) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -108,8 +120,10 @@ namespace CalamityMod.NPCs.DesertScourge if (expertMode) { - speed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - turnSpeed += death ? 0.09f * (1f - lifeRatio) : 0.06f * (1f - lifeRatio); + float velocityScale = (death ? 9f : 6f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.09f : 0.06f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } if (lungeUpward) @@ -133,11 +147,6 @@ namespace CalamityMod.NPCs.DesertScourge if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !BossRushEvent.BossRushActive; npc.alpha -= 42; @@ -211,6 +220,8 @@ namespace CalamityMod.NPCs.DesertScourge { Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num954 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) ? 500 : 1000; + if (enrageScale > 0f) + num954 = 200; if (BossRushEvent.BossRushActive) num954 /= 2; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 00fc3f2ae6..0f4d3b65ee 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -107,12 +107,22 @@ namespace CalamityMod.NPCs.HiveMind npc.noGravity = false; npc.noTileCollide = false; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient) + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!player.ZoneCorrupt) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.localAI[0] == 0f) { @@ -182,7 +192,7 @@ namespace CalamityMod.NPCs.HiveMind burrowTimer--; if (burrowTimer < -120) { - burrowTimer = death ? 180 : revenge ? 300 : expertMode ? 360 : 420; + burrowTimer = (death ? 180 : revenge ? 300 : expertMode ? 360 : 420) - (int)enrageScale * 60; npc.scale = 1f; npc.alpha = 0; npc.dontTakeDamage = false; diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 262a5d2846..eab2f267bf 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -40,12 +40,12 @@ namespace CalamityMod.NPCs.HiveMind int minimumDriftTime = 300; int teleportRadius = 300; int decelerationTime = 30; - int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks + int reelbackFade = 2; //divide 255 by this for duration of reelback in ticks float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) - float driftSpeed = 2f; //default speed when slowly floating at player + float driftSpeed = 1f; //default speed when slowly floating at player float driftBoost = 1f; //max speed added as health decreases int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging - int lungeTime = 30; + int lungeTime = 33; int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge bool dashStarted = false; @@ -99,24 +99,24 @@ namespace CalamityMod.NPCs.HiveMind if (Main.expertMode) { minimumDriftTime = 120; - reelbackFade = 5; + reelbackFade = 4; } if (CalamityWorld.revenge) { lungeRots = 0.3; minimumDriftTime = 90; - reelbackFade = 6; - lungeTime = 25; - driftSpeed = 3f; + reelbackFade = 5; + lungeTime = 28; + driftSpeed = 2f; driftBoost = 2f; } if (CalamityWorld.death) { lungeRots = 0.4; minimumDriftTime = 60; - reelbackFade = 7; - lungeTime = 20; - driftSpeed = 4f; + reelbackFade = 6; + lungeTime = 23; + driftSpeed = 3f; driftBoost = 1f; } if (BossRushEvent.BossRushActive) @@ -143,7 +143,6 @@ namespace CalamityMod.NPCs.HiveMind writer.Write(reelCount); writer.Write(counter); writer.Write(initialised); - writer.Write(npc.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) @@ -158,7 +157,6 @@ namespace CalamityMod.NPCs.HiveMind reelCount = reader.ReadInt32(); counter = reader.ReadInt32(); initialised = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); } public override void FindFrame(int frameHeight) @@ -252,19 +250,15 @@ namespace CalamityMod.NPCs.HiveMind switch (choice) { case 0: + case 1: type = NPCID.EaterofSouls; break; - case 1: + case 2: type = NPCID.DevourerHead; break; - case 2: - type = ModContent.NPCType(); - break; case 3: - type = ModContent.NPCType(); - break; case 4: - type = ModContent.NPCType(); + type = ModContent.NPCType(); break; default: break; @@ -312,21 +306,25 @@ namespace CalamityMod.NPCs.HiveMind Player player = Main.player[npc.target]; - npc.dontTakeDamage = (player.ZoneCorrupt || BossRushEvent.BossRushActive) ? false : true; - CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (npc.alpha != 0) + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!player.ZoneCorrupt) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + + if (npc.alpha != 0) { if (npc.damage != 0) - { npc.damage = 0; - } } else - { npc.damage = npc.defDamage; - } + switch (state) { case 0: //slowdrift @@ -424,7 +422,7 @@ namespace CalamityMod.NPCs.HiveMind phase2timer--; if (phase2timer <= -180) //no stalling drift mode forever { - npc.velocity *= 2f / 255f * reelbackFade; + npc.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); ReelBack(); npc.netUpdate = true; } @@ -433,16 +431,16 @@ namespace CalamityMod.NPCs.HiveMind npc.velocity.Normalize(); if (Main.expertMode || BossRushEvent.BossRushActive) //variable velocity in expert and up { - npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; + npc.velocity *= driftSpeed + enrageScale + (driftBoost + enrageScale) * (npc.lifeMax - npc.life) / npc.lifeMax; } else { - npc.velocity *= driftSpeed; + npc.velocity *= driftSpeed + enrageScale; } } break; case 1: //reelback and teleport - npc.alpha += reelbackFade; + npc.alpha += reelbackFade + 2 * (int)enrageScale; npc.velocity -= deceleration; if (npc.alpha >= 255) { @@ -474,7 +472,7 @@ namespace CalamityMod.NPCs.HiveMind } break; case 2: //reelback for lunge + death legacy - npc.alpha += reelbackFade; + npc.alpha += reelbackFade + 2 * (int)enrageScale; npc.velocity -= deceleration; if (npc.alpha >= 255) { @@ -518,10 +516,10 @@ namespace CalamityMod.NPCs.HiveMind { if (phase2timer <= 0) { - phase2timer = lungeTime; + phase2timer = lungeTime - 4 * (int)enrageScale; npc.velocity = player.Center - npc.Center; npc.velocity.Normalize(); - npc.velocity *= teleportRadius / lungeTime; + npc.velocity *= teleportRadius / (lungeTime - 4 * (int)enrageScale); dashStarted = true; Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index ce6d179ecd..9f5e8c3107 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -173,8 +173,16 @@ namespace CalamityMod.NPCs.Leviathan Player player = Main.player[npc.target]; - bool flag6 = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); - npc.dontTakeDamage = (flag6 && !BossRushEvent.BossRushActive) || spawnAnimation; + bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + + float enrageScale = 0f; + if (notOcean) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + + npc.dontTakeDamage = spawnAnimation; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { @@ -236,13 +244,18 @@ namespace CalamityMod.NPCs.Leviathan if (npc.ai[0] == 0f) { npc.TargetClosest(true); + float num412 = (sirenAlive && !phase4) ? 3.5f : 7f; float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f; + num412 += 2f * enrageScale; + num413 += 0.05f * enrageScale; + if (expertMode && (!sirenAlive || phase4)) { num412 += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio); num413 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } + if (BossRushEvent.BossRushActive) { num412 *= 1.5f; @@ -332,6 +345,8 @@ namespace CalamityMod.NPCs.Leviathan if (expertMode) speed = (sirenAlive && !phase4 && !death) ? 14f : 17f; + speed += 4f * enrageScale; + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) speed = 22f; @@ -388,7 +403,7 @@ namespace CalamityMod.NPCs.Leviathan flag103 = true; } - int spawnLimit = (sirenAlive && !phase4) ? 2 : 4; + int spawnLimit = (sirenAlive && !phase4) ? 1 : 3; bool spawnParasea = NPC.CountNPCS(ModContent.NPCType()) < spawnLimit; bool spawnAberration = (!sirenAlive || phase4) && !NPC.AnyNPCs(ModContent.NPCType()); @@ -406,11 +421,15 @@ namespace CalamityMod.NPCs.Leviathan { float num1063 = (sirenAlive && !phase4) ? 7f : 8f; float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f; + num1063 += 2f * enrageScale; + num1064 += 0.02f * enrageScale; + if (expertMode && (!sirenAlive || phase4)) { num1063 += death ? 7f * (1f - lifeRatio) : 4f * (1f - lifeRatio); num1064 += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio); } + if (BossRushEvent.BossRushActive) { num1063 *= 1.5f; @@ -475,6 +494,7 @@ namespace CalamityMod.NPCs.Leviathan } float chargeDistance = (sirenAlive && !phase4) ? 1100f : 900f; + chargeDistance -= 100f * enrageScale; if (!sirenAlive || phase4) chargeDistance -= 250f * (1f - lifeRatio); @@ -500,6 +520,7 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[2] = 0f; float num1044 = revenge ? 20f : 18f; + num1044 += 4f * enrageScale; if (revenge && (!sirenAlive || phase4)) num1044 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); @@ -524,6 +545,9 @@ namespace CalamityMod.NPCs.Leviathan float num1048 = revenge ? 7.5f : 6.5f; float num1049 = revenge ? 0.12f : 0.11f; + num1048 += 2f * enrageScale; + num1049 += 0.03f * enrageScale; + if (revenge && (!sirenAlive || phase4)) { num1048 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); @@ -535,6 +559,7 @@ namespace CalamityMod.NPCs.Leviathan num1048 += 3f; num1049 += 0.2f; } + if (BossRushEvent.BossRushActive) { num1048 *= 1.25f; @@ -589,6 +614,8 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity *= 0.9f; float num1052 = revenge ? 0.11f : 0.1f; + num1052 += 0.03f * enrageScale; + if (revenge && (!sirenAlive || phase4)) { npc.velocity *= death ? MathHelper.Lerp(0.75f, 1f, lifeRatio) : MathHelper.Lerp(0.81f, 1f, lifeRatio); diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 60441162ca..6f9f18af74 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -129,9 +129,18 @@ namespace CalamityMod.NPCs.Leviathan bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + + float enrageScale = 0f; + if (notOcean) + enrageScale += 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + float lifeRatio = npc.life / (float)npc.lifeMax; float bubbleVelocity = BossRushEvent.BossRushActive ? 16f : death ? 9f : revenge ? 7f : expertMode ? 6f : 5f; + bubbleVelocity += 2f * enrageScale; if (!leviAlive) bubbleVelocity += 2f * (1f - lifeRatio); @@ -184,7 +193,7 @@ namespace CalamityMod.NPCs.Leviathan npc.dontTakeDamage = true; else { - npc.dontTakeDamage = isNotOcean && !BossRushEvent.BossRushActive; + npc.dontTakeDamage = false; npc.ai[3] = 0f; if (npc.localAI[1] == -1f) @@ -207,7 +216,7 @@ namespace CalamityMod.NPCs.Leviathan } else { - npc.dontTakeDamage = isNotOcean && !BossRushEvent.BossRushActive; + npc.dontTakeDamage = false; int num7 = (int)npc.ai[3] - 1; if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) @@ -259,18 +268,9 @@ namespace CalamityMod.NPCs.Leviathan // Alpha if (npc.damage != 0) { - if (isNotOcean) - { - npc.alpha += 3; - if (npc.alpha >= 150) - npc.alpha = 150; - } - else - { - npc.alpha -= 5; - if (npc.alpha <= 0) - npc.alpha = 0; - } + npc.alpha -= 5; + if (npc.alpha <= 0) + npc.alpha = 0; } // Play sound @@ -375,7 +375,10 @@ namespace CalamityMod.NPCs.Leviathan float maxVelocityY = death ? 3f : 4f; float maxVelocityX = death ? 7f : 8f; - if (npc.position.Y > player.position.Y - 350f) + maxVelocityY -= enrageScale; + maxVelocityX -= 2f * enrageScale; + + if (npc.position.Y > player.position.Y - 350f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; @@ -391,6 +394,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y < -maxVelocityY) npc.velocity.Y = -maxVelocityY; } + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) { if (npc.velocity.X > 0f) @@ -399,6 +403,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.X > maxVelocityX) npc.velocity.X = maxVelocityX; } + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) { if (npc.velocity.X < 0f) @@ -461,6 +466,9 @@ namespace CalamityMod.NPCs.Leviathan { float maxVelocityY = death ? 3f : 4f; float maxVelocityX = death ? 7f : 8f; + maxVelocityY -= enrageScale; + maxVelocityX -= 2f * enrageScale; + if (npc.position.Y > player.position.Y - 350f) { if (npc.velocity.Y > 0f) @@ -477,6 +485,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y < -maxVelocityY) npc.velocity.Y = -maxVelocityY; } + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) { if (npc.velocity.X > 0f) @@ -485,6 +494,7 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.X > maxVelocityX) npc.velocity.X = maxVelocityX; } + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) { if (npc.velocity.X < 0f) @@ -515,8 +525,11 @@ namespace CalamityMod.NPCs.Leviathan npc.rotation = npc.velocity.X * 0.02f; Vector2 targetVector = player.Center + new Vector2(0f, -350f); - Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * (BossRushEvent.BossRushActive ? 18f : death ? 13.5f : 12f); + float velocity = BossRushEvent.BossRushActive ? 18f : death ? 13.5f : 12f; + velocity += 3f * enrageScale; + Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * velocity; float acceleration = BossRushEvent.BossRushActive ? 0.5f : death ? 0.28f : 0.25f; + acceleration += 0.1f * enrageScale; if (Math.Abs(npc.Center.Y - targetVector.Y) > 50f || Math.Abs(npc.Center.X - player.Center.X) > 350f) npc.SimpleFlyMovement(vector3, acceleration); @@ -524,6 +537,7 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[1] += 1f; float divisor = 140f; + divisor -= (int)(20f * enrageScale); if (!leviAlive || phase4) divisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); @@ -531,6 +545,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles) { float projectileVelocity = expertMode ? 3f : 2f; + projectileVelocity += enrageScale; if (!leviAlive || phase4) projectileVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); @@ -567,8 +582,8 @@ namespace CalamityMod.NPCs.Leviathan for (int i = 0; i < totalProjectiles; i++) { Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; - Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; + Projectile.NewProjectile(spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); } } @@ -580,6 +595,7 @@ namespace CalamityMod.NPCs.Leviathan } float phaseTimer = 300f; + phaseTimer -= 30f * enrageScale; if (!leviAlive || phase4) phaseTimer -= 150f * (1f - lifeRatio); @@ -608,6 +624,7 @@ namespace CalamityMod.NPCs.Leviathan // Velocity and rotation float chargeVelocity = BossRushEvent.BossRushActive ? 31f : (leviAlive && !phase4) ? 21f : 26f; + chargeVelocity += 7f * enrageScale; if (revenge) chargeVelocity += 2f + (death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio)); diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 97b9e525bc..81c5ca3807 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -59,9 +59,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (npc.position.Y > Main.player[npc.target].position.Y - 350f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y - acceleration; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocity) npc.velocity.Y = velocity; @@ -69,30 +69,30 @@ namespace CalamityMod.NPCs.NormalNPCs else if (npc.position.Y < Main.player[npc.target].position.Y - 400f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y + acceleration; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocity) npc.velocity.Y = -velocity; } - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) + if (npc.Center.X > Main.player[npc.target].Center.X + 100f) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X - acceleration; + npc.velocity.X -= acceleration; if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) + if (npc.Center.X < Main.player[npc.target].Center.X - 100f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X += acceleration; if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -132,12 +132,24 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.rand.NextBool(2)) { Main.dust[ruby].scale = 0.5f; - Main.dust[ruby].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[ruby].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } Main.PlaySound(SoundID.Item8, npc.position); - Projectile.NewProjectile(npcPos, projVector, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); + int damage = npc.GetProjectileDamage(type); + if (CalamityWorld.death || BossRushEvent.BossRushActive) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(9); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else + Projectile.NewProjectile(npcPos, projVector, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 179260c01a..c38069042b 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -58,6 +58,15 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -70,13 +79,15 @@ namespace CalamityMod.NPCs.Perforator bool lungeUpward = burrow && npc.Calamity().newAI[1] == 1f; bool quickFall = npc.Calamity().newAI[1] == 2f; - float speed = 14f; - float turnSpeed = 0.12f; + float speed = 8f; + float turnSpeed = 0.06f; if (expertMode) { - speed += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - turnSpeed += death ? 0.06f * (1f - lifeRatio) : 0.04f * (1f - lifeRatio); + float velocityScale = (death ? 12f : 10f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } if (lungeUpward) diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 692ecc9957..5fdda377c3 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -57,16 +57,27 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 16f; - float turnSpeed = 0.14f; + float speed = 8f; + float turnSpeed = 0.06f; if (expertMode) { - speed += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; - turnSpeed += death ? 0.02f * (1f - lifeRatio) : 0.01f * (1f - lifeRatio); + float velocityScale = (death ? 8f : 7f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.08f : 0.07f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) @@ -229,7 +240,7 @@ namespace CalamityMod.NPCs.Perforator npc.Calamity().newAI[1] += 1f; // Set velocity for when a new head spawns - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (num37 * (BossRushEvent.BossRushActive ? 0.8f : death ? 0.5f : 0.4f)); + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (num37 * (BossRushEvent.BossRushActive ? 0.6f : death ? 0.3f : 0.2f)); } if (!flag2) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 66e94c11c2..a556a99a4a 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -57,16 +57,27 @@ namespace CalamityMod.NPCs.Perforator bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 18f; - float turnSpeed = 0.16f; + float speed = 12f; + float turnSpeed = 0.1f; if (expertMode) { - speed += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - turnSpeed += death ? 0.06f * (1f - lifeRatio) : 0.04f * (1f - lifeRatio); + float velocityScale = (death ? 12f : 10f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && BossRushEvent.BossRushActive)) diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index a404684dba..0e08de38ab 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -81,11 +81,19 @@ namespace CalamityMod.NPCs.Perforator npc.TargetClosest(true); Player player = Main.player[npc.target]; - bool isCrimson = player.ZoneCrimson || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 0f; + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.TargetClosest(false); @@ -120,14 +128,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; - if (largeWormAlive && expertMode) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = isCrimson ? false : true; - } + npc.dontTakeDamage = largeWormAlive && expertMode; float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; @@ -135,7 +136,7 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { - int shoot = revenge ? 6 : 4; + int shoot = (revenge ? 6 : 4) - wormsAlive; npc.localAI[0] += Main.rand.Next(shoot); if (npc.localAI[0] >= Main.rand.Next(300, 901) && npc.position.Y + npc.height < player.position.Y && Vector2.Distance(player.Center, npc.Center) > 80f) { @@ -168,7 +169,7 @@ namespace CalamityMod.NPCs.Perforator float maxVelocity = 8f; float velocityAdjustment = maxVelocity * 1.5f / totalProjectiles; Vector2 start = new Vector2(npc.Center.X, npc.Center.Y + 30f); - Vector2 destination = new Vector2(Vector2.Normalize(player.Center - start).X, 0f) * maxVelocity * 0.4f; + Vector2 destination = wormsAlive > 0 ? new Vector2(Vector2.Normalize(player.Center - start).X, 0f) * maxVelocity * 0.4f : Vector2.Zero; Vector2 velocity = destination + Vector2.UnitY * -maxVelocity; for (int i = 0; i < totalProjectiles + 1; i++) { @@ -193,24 +194,24 @@ namespace CalamityMod.NPCs.Perforator { if (large || death) { - Movement(player, 5f, 1.5f, BossRushEvent.BossRushActive ? 0.195f : death ? 0.15f : 0.13f, 360f, 10f, 50f, true); + Movement(player, 3.5f + 1.5f * enrageScale, 1f + 0.5f * enrageScale, BossRushEvent.BossRushActive ? 0.195f : death ? 0.15f : 0.13f, 360f, 10f, 50f, true); } else if (medium) { - Movement(player, 6f, 2f, BossRushEvent.BossRushActive ? 0.18f : death ? 0.14f : 0.12f, 340f, 15f, 50f, true); + Movement(player, 4.5f + 1.5f * enrageScale, 1.5f + 0.5f * enrageScale, BossRushEvent.BossRushActive ? 0.18f : death ? 0.14f : 0.12f, 340f, 15f, 50f, true); } else if (small) { - Movement(player, 7f, 2.5f, BossRushEvent.BossRushActive ? 0.165f : death ? 0.13f : 0.11f, 320f, 20f, 50f, true); + Movement(player, 5.5f + 1.5f * enrageScale, 2f + 0.5f * enrageScale, BossRushEvent.BossRushActive ? 0.165f : death ? 0.13f : 0.11f, 320f, 20f, 50f, true); } else { - Movement(player, 8f, 3f, BossRushEvent.BossRushActive ? 0.15f : death ? 0.12f : 0.1f, 300f, 25f, 50f, true); + Movement(player, 6.5f + 1.5f * enrageScale, 2.5f + 0.5f * enrageScale, BossRushEvent.BossRushActive ? 0.15f : death ? 0.12f : 0.1f, 300f, 25f, 50f, true); } } else { - npc.velocity.X += (npc.Center.X <= player.Center.X ? -0.1f : 0.1f); + npc.velocity.X += npc.Center.X <= player.Center.X ? -0.1f : 0.1f; if (npc.Center.X > player.Center.X + 320f || npc.Center.X < player.Center.X - 320f) { npc.ai[0] = 1f; @@ -220,7 +221,7 @@ namespace CalamityMod.NPCs.Perforator } else { - Movement(player, 4f, 1f, 0.1f, 160f, 300f, 400f, false); + Movement(player, 2.5f + 1.5f * enrageScale, 0.5f + 0.5f * enrageScale, 0.1f, 160f, 300f, 400f, false); } if (npc.ai[3] == 0f && npc.life > 0) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index f381ddcd2e..c6206277a0 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -182,10 +182,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Enrage float enrageScale = death ? 0.25f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface || (npc.position.Y / 16f) > (Main.maxTilesY - 200)) - enrageScale += 0.5f; if (!player.ZoneJungle) - enrageScale += 0.5f; + enrageScale += 1f; if (enrageScale > 1f) enrageScale = 1f; @@ -245,21 +243,27 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); while (num596 == npc.ai[1] || num596 == 1); - if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) - { - switch (Main.rand.Next(3)) - { - case 0: - chargeDistance = 0; - break; - case 1: - chargeDistance = 400; - break; - case 2: - chargeDistance = -400; - break; - } - } + if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) + { + do + { + switch (Main.rand.Next(3)) + { + case 0: + chargeDistance = 0; + break; + case 1: + chargeDistance = 400; + break; + case 2: + chargeDistance = -400; + break; + } + } + while (chargeDistance == npc.ai[3]); + + npc.ai[3] = -chargeDistance; + } npc.ai[0] = num596; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -424,11 +428,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1051 = -1; if (npc.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > num1050)) - { npc.ai[2] = 1f; - } + if (enrageScale > 0 && npc.ai[2] == 1f) - npc.velocity *= 0.75f; + npc.velocity *= 0.95f; if (npc.ai[2] != 1f) { @@ -471,7 +474,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.85f; + npc.velocity *= 0.95f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { @@ -700,21 +703,30 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1071 *= num1073; num1072 *= num1073; - int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (expertMode) - { - if (Main.rand.NextBool(6)) - type = ModContent.ProjectileType(); - } - else - { - if (Main.rand.NextBool(9)) - type = ModContent.ProjectileType(); - } + int type = ModContent.ProjectileType(); + switch ((int)npc.ai[2]) + { + case 0: + case 1: + break; + case 2: + case 3: + if (expertMode) + type = ModContent.ProjectileType(); + break; + case 4: + type = ModContent.ProjectileType(); + break; + } + int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, player.position.Y); } - } + + npc.ai[2] += 1f; + if (npc.ai[2] > 4f) + npc.ai[2] = 0f; + } Movement(100f, 400f, 500f, player, enrageScale); @@ -726,7 +738,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.ai[0] = -1f; npc.ai[1] = 3f; - npc.netUpdate = true; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -872,7 +885,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) npc.ai[2] = 1f; if (enrageScale > 0 && npc.ai[2] == 1f) - npc.velocity *= 0.75f; + npc.velocity *= 0.95f; if (npc.ai[2] != 1f) { @@ -914,7 +927,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.85f; + npc.velocity *= 0.95f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { @@ -995,8 +1008,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("PlaguebringerGoliathGore" + i), 2f); npc.position.X = npc.position.X + (npc.width / 2); npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = 100; - npc.height = 100; + npc.width = 200; + npc.height = 200; npc.position.X = npc.position.X - (npc.width / 2); npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 9f5a74dd6a..90a8bac281 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -145,9 +145,9 @@ namespace CalamityMod.NPCs.Ravager } Vector2 vector82 = npc.Center; - float distance = npc.ai[0] % 2f == 0f ? 360f : -360f; + float distance = npc.ai[0] % 2f == 0f ? 420f : -420f; float num825 = player.Center.X + (fireProjectiles ? distance : 0f) - vector82.X; - float num826 = player.Center.Y + (fireProjectiles ? -180f : 360f) - vector82.Y; + float num826 = player.Center.Y + (fireProjectiles ? -210f : 420f) - vector82.Y; float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 384a8ea2fe..0360dba9ca 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -128,6 +128,11 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); + Main.PlaySound(SoundID.Item14, npc.position); + npc.ai[0] = 0f; + npc.life = 0; + HitEffect(npc.direction, 9999); + npc.netUpdate = true; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index a35b382351..d41471d05e 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.height = 92; npc.scale = 1.1f; npc.defense = 10; - npc.LifeMaxNERB(4000, 5500, 2200000); + npc.LifeMaxNERB(4650, 6400, 2200000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index d79a726c78..8662709b30 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.width = 44; npc.height = 44; npc.defense = 6; - npc.LifeMaxNERB(4000, 5000, 2500000); + npc.LifeMaxNERB(2000, 2500, 2500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); NPCID.Sets.TrailCacheLength[npc.type] = 8; @@ -503,7 +503,7 @@ namespace CalamityMod.NPCs.SlimeGod float num1372 = death ? 14f : revenge ? 11f : expertMode ? 8.5f : 6f; if (phase2) { - num1372 = revenge ? 14f : expertMode ? 12.5f : 11f; + num1372 = revenge ? 18f : expertMode ? 16f : 14f; } if (BossRushEvent.BossRushActive || player.gravDir == -1f) { @@ -712,7 +712,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.VortexDebuff, 180, true); + player.AddBuff(BuffID.VortexDebuff, 150, true); } } } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 7db159bb0d..fd81bad08f 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.height = 92; npc.scale = 1.1f; npc.defense = 12; - npc.LifeMaxNERB(3500, 4820, 1600000); + npc.LifeMaxNERB(4150, 5700, 1600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 19bead5b50..53168a84f3 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.LifeMaxNERB(1000, 1375, 1100000); + npc.LifeMaxNERB(1350, 1800, 1100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.GetNPCDamage(); diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 42d54e9e9a..14e450ec2f 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -205,7 +205,9 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.player[npc.target].dead && npc.life > 0) { - npc.TargetClosest(false); + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.TargetClosest(false); npc.velocity.Y = npc.velocity.Y - 10f; if ((double)npc.position.Y < Main.topWorld + 16f) { diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 8e8a1ea3ef..09e371fea5 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -80,10 +80,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity *= scaleFactor2; } else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } + projectile.velocity *= 1.01f; } } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index c16c04b578..f83cb40354 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -103,7 +103,31 @@ namespace CalamityMod.Projectiles.Boss float amount = 0.5f; //0.5f projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); - for (int num809 = 0; num809 < 2; num809++) + + // Fire brimstone darts along the laser + if (Main.npc[(int)projectile.ai[1]].ai[1] == 210f && projectile.owner == Main.myPlayer) + { + Vector2 velocity = projectile.velocity; + velocity.Normalize(); + float distanceBetweenProjectiles = 96f; + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f) + velocity * distanceBetweenProjectiles; + int projectileAmt = (int)(projectile.localAI[1] / distanceBetweenProjectiles); + int type = ModContent.ProjectileType(); + int damage = projectile.GetProjectileDamage(ModContent.NPCType()); + for (int i = 0; i < projectileAmt; i++) + { + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int j = 0; j < totalProjectiles; j++) + { + Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); + Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + } + fireFrom += velocity * distanceBetweenProjectiles; + } + } + + for (int num809 = 0; num809 < 2; num809++) { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index a547eebef0..e83a33b84f 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 14f) { projectile.velocity *= 1.0025f; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index e8bc47ef58..9957185797 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 14f) { projectile.velocity *= 1.0025f; } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 7eb1df79a1..9913244a95 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -12,6 +13,7 @@ namespace CalamityMod.Projectiles.Boss public class HolySpear : ModProjectile { Vector2 velocity = Vector2.Zero; + Vector2 providenceCenter = Vector2.Zero; public override void SetStaticDefaults() { @@ -37,6 +39,7 @@ namespace CalamityMod.Projectiles.Boss writer.Write(projectile.localAI[0]); writer.Write(projectile.localAI[1]); writer.WriteVector2(velocity); + writer.WriteVector2(providenceCenter); } public override void ReceiveExtraAI(BinaryReader reader) @@ -44,6 +47,7 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[0] = reader.ReadSingle(); projectile.localAI[1] = reader.ReadSingle(); velocity = reader.ReadVector2(); + providenceCenter = reader.ReadVector2(); } public override void AI() @@ -52,10 +56,21 @@ namespace CalamityMod.Projectiles.Boss { projectile.localAI[0] = 1f; + providenceCenter = Main.npc[CalamityGlobalNPC.holyBoss].Center; + if (projectile.ai[0] == 1f) velocity = projectile.velocity; } + float timeGateValue = 510f; + float timeGateValue2 = 540f; + int playerIndex = Player.FindClosest(projectile.Center, 1, 1); + bool farFromProvidence = Vector2.Distance(Main.player[playerIndex].Center, providenceCenter) > 1920f; + Vector2 velocity2 = Main.player[playerIndex].Center - projectile.Center; + float scaleFactor = projectile.velocity.Length(); + velocity2.Normalize(); + velocity2 *= scaleFactor; + if (projectile.ai[0] == 0f) { projectile.ai[1] += 1f; @@ -64,14 +79,20 @@ namespace CalamityMod.Projectiles.Boss float fastGateValue = 30f; float minVelocity = 3f; float maxVelocity = 12f; - float extremeVelocity = 16f; + float extremeVelocity = 24f; float deceleration = 0.95f; float acceleration = 1.2f; - if (projectile.localAI[1] > 480f) + if (projectile.localAI[1] > timeGateValue) { if (projectile.velocity.Length() < extremeVelocity) projectile.velocity *= acceleration; + else + { + projectile.velocity = (projectile.velocity * 10f + velocity2) / 11f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor; + } } else { @@ -91,17 +112,26 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = 0.1f; - float amplitude = 2f; + if (projectile.localAI[1] > timeGateValue) + { + projectile.velocity = (projectile.velocity * 10f + velocity2) / 11f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor; + } + else + { + float frequency = 0.1f; + float amplitude = 2f; - projectile.ai[1] += frequency; + projectile.ai[1] += frequency; - float wavyVelocity = (float)Math.Sin(projectile.ai[1]); + float wavyVelocity = (float)Math.Sin(projectile.ai[1]); - projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + } } - if (projectile.localAI[1] < 540f) + if (projectile.localAI[1] < timeGateValue2) { projectile.localAI[1] += 1f; diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 9355b50714..a1208f07f2 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; - if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) + if (projectile.ai[0] < 90f && projectile.ai[0] > 30f) { float scaleFactor2 = projectile.velocity.Length(); Vector2 vector17 = Main.player[num123].Center - projectile.Center; diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 2658a0bd39..589bfffd5a 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,5 +1,3 @@ -using CalamityMod.Events; -using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.timeLeft = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 2100 : 1800; + projectile.timeLeft = 1800; } public override void AI() diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b1d69db38a..86aea70ab9 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -212,7 +212,7 @@ namespace CalamityMod.Projectiles projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 14f) projectile.velocity *= 1.0025f; return false; @@ -786,6 +786,12 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] == 1f) + { + if (projectile.velocity.Length() < 20f) + projectile.velocity *= 1.01f; + } + if (defDamage == 0) defDamage = projectile.damage; diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index 7af1f17a05..95adf35cc4 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 600; - projectile.aiStyle = 1; } public override void AI() diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index eb0efe86ad..d6e8259014 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -26,11 +26,6 @@ namespace CalamityMod.Tiles.Ores Main.tileSpelunker[Type] = true; } - public override bool CanExplode(int i, int j) - { - return NPC.downedBoss2; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 0d6ea46047..41a27f994b 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedStarGod; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index cdde9877c3..ea89a4b39f 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedYharon; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/ChaoticOre.cs b/Tiles/Ores/ChaoticOre.cs index 605c9cdfcd..ee38d34235 100644 --- a/Tiles/Ores/ChaoticOre.cs +++ b/Tiles/Ores/ChaoticOre.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedGolemBoss; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/CharredOre.cs b/Tiles/Ores/CharredOre.cs index 413aef9b9f..8663bbedd4 100644 --- a/Tiles/Ores/CharredOre.cs +++ b/Tiles/Ores/CharredOre.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedBrimstoneElemental; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index d16ea586ab..ecc4a70ca8 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedCryogen; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index d77178885a..a4b60438e6 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -28,7 +28,12 @@ namespace CalamityMod.Tiles.Ores base.SetDefaults(); } - public override void NumDust(int i, int j, bool fail, ref int num) + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 2 : 4; } diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index ac1c95fe97..34c71a9f1a 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedPlantBoss; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index 070d71d91f..c0ce986162 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedMoonlord; + return false; } public override void NumDust(int i, int j, bool fail, ref int num)