From 5a1b5ee4ea3811166c6290d4e383e7a84571b80e Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Wed, 9 Oct 2019 11:36:31 -0400 Subject: [PATCH] Made movement impairing debuffs consistent. Added a data structure to allow random NPCs to be immune to them. Currently only contains Queen Bee. --- CalamityMod.cs | 239 ++++++++++++++++++++------------------ NPCs/CalamityGlobalNPC.cs | 60 ++++------ 2 files changed, 152 insertions(+), 147 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 08400366ab..4eb014a4fb 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -57,115 +57,7 @@ namespace CalamityMod public static Effect CustomShader; // DR data structure - public static SortedDictionary DRValues = new SortedDictionary - { - { NPCID.AngryBonesBig, 0.2f }, - { NPCID.AngryBonesBigHelmet, 0.2f }, - { NPCID.AngryBonesBigMuscle, 0.2f }, - { NPCID.AnomuraFungus, 0.1f }, - { NPCID.Antlion, 0.1f }, - { NPCID.Arapaima, 0.1f }, - { NPCID.ArmoredSkeleton, 0.15f }, - { NPCID.ArmoredViking, 0.1f }, - { NPCID.BigMimicCorruption, 0.3f }, - { NPCID.BigMimicCrimson, 0.3f }, - { NPCID.BigMimicHallow, 0.3f }, - { NPCID.BigMimicJungle, 0.3f }, // unused vanilla enemy - { NPCID.BlueArmoredBones, 0.2f }, - { NPCID.BlueArmoredBonesMace, 0.2f }, - { NPCID.BlueArmoredBonesNoPants, 0.2f }, - { NPCID.BlueArmoredBonesSword, 0.2f }, - { NPCID.BoneLee, 0.2f }, - { NPCID.Crab, 0.05f }, - { NPCID.Crawdad, 0.2f }, - { NPCID.Crawdad2, 0.2f }, - { NPCID.CultistBoss, 0.05f }, - { NPCID.DD2Betsy, 0.1f }, - { NPCID.DD2OgreT2, 0.1f }, - { NPCID.DD2OgreT3, 0.15f }, - { NPCID.DeadlySphere, 0.4f }, - { NPCID.DiabolistRed, 0.2f }, - { NPCID.DiabolistWhite, 0.2f }, - { NPCID.DungeonGuardian, 0.999999f }, - { NPCID.DungeonSpirit, 0.2f }, - { NPCID.ElfCopter, 0.15f }, - { NPCID.Everscream, 0.1f }, - { NPCID.FlyingAntlion, 0.05f }, - { NPCID.GiantCursedSkull, 0.2f }, - { NPCID.GiantShelly, 0.2f }, - { NPCID.GiantShelly2, 0.2f }, - { NPCID.GiantTortoise, 0.35f }, - { NPCID.Golem, 0.25f }, - { NPCID.GolemFistLeft, 0.25f }, - { NPCID.GolemFistRight, 0.25f }, - { NPCID.GolemHead, 0.25f }, - { NPCID.GolemHeadFree, 0.25f }, - { NPCID.GraniteFlyer, 0.1f }, - { NPCID.GraniteGolem, 0.15f }, - { NPCID.GreekSkeleton, 0.1f }, - { NPCID.HellArmoredBones, 0.2f }, - { NPCID.HellArmoredBonesMace, 0.2f }, - { NPCID.HellArmoredBonesSpikeShield, 0.2f }, - { NPCID.HellArmoredBonesSword, 0.2f }, - { NPCID.IceGolem, 0.1f }, - { NPCID.IceQueen, 0.1f }, - { NPCID.IceTortoise, 0.35f }, - { NPCID.HeadlessHorseman, 0.05f }, - { NPCID.MartianDrone, 0.2f }, - { NPCID.MartianSaucer, 0.2f }, - { NPCID.MartianSaucerCannon, 0.2f }, - { NPCID.MartianSaucerCore, 0.2f }, - { NPCID.MartianSaucerTurret, 0.2f }, - { NPCID.MartianTurret, 0.2f }, - { NPCID.MartianWalker, 0.35f }, - { NPCID.Mimic, 0.3f }, - { NPCID.MoonLordCore, 0.05f }, - { NPCID.MoonLordFreeEye, 0.05f }, - { NPCID.MoonLordHand, 0.05f }, - { NPCID.MoonLordHead, 0.05f }, - { NPCID.Mothron, 0.2f }, - { NPCID.MothronEgg, 0.5f }, - { NPCID.MourningWood, 0.1f }, - { NPCID.Necromancer, 0.2f }, - { NPCID.NecromancerArmored, 0.2f }, - { NPCID.Paladin, 0.45f }, - { NPCID.PirateCaptain, 0.05f }, - { NPCID.PirateShipCannon, 0.15f }, - { NPCID.PossessedArmor, 0.25f }, - { NPCID.PresentMimic, 0.3f }, - { NPCID.PrimeCannon, 0.2f }, - { NPCID.PrimeLaser, 0.2f }, - { NPCID.PrimeSaw, 0.25f }, - { NPCID.PrimeVice, 0.25f }, - { NPCID.Probe, 0.25f }, - { NPCID.Pumpking, 0.1f }, - { NPCID.QueenBee, 0.05f }, - { NPCID.RaggedCaster, 0.2f }, - { NPCID.RaggedCasterOpenCoat, 0.2f }, - { NPCID.Retinazer, 0.2f }, - { NPCID.RustyArmoredBonesAxe, 0.2f }, - { NPCID.RustyArmoredBonesFlail, 0.2f }, - { NPCID.RustyArmoredBonesSword, 0.2f }, - { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, - { NPCID.SandElemental, 0.1f }, - { NPCID.SantaNK1, 0.35f }, - { NPCID.SeaSnail, 0.05f }, - { NPCID.SkeletonArcher, 0.1f }, - { NPCID.SkeletonCommando, 0.2f }, - { NPCID.SkeletonSniper, 0.2f }, - { NPCID.SkeletronHand, 0.05f }, - { NPCID.SkeletronHead, 0.05f }, - { NPCID.SkeletronPrime, 0.25f }, - { NPCID.Spazmatism, 0.2f }, - { NPCID.TacticalSkeleton, 0.2f }, - { NPCID.TheDestroyer, 0.1f }, - { NPCID.TheDestroyerBody, 0.2f }, - { NPCID.TheDestroyerTail, 0.35f }, - { NPCID.TheHungry, 0.1f }, - { NPCID.UndeadViking, 0.1f }, - { NPCID.WalkingAntlion, 0.1f }, - { NPCID.WallofFlesh, 0.5f }, - }; + public static SortedDictionary DRValues; // Lists public static IList donatorList; @@ -198,6 +90,7 @@ namespace CalamityMod public static List revengeanceEnemyBuffList; public static List revengeanceProjectileBuffList; public static List revengeanceLifeStealExceptionList; + public static List movementImpairImmuneList; public static List trapProjectileList; public static List scopedWeaponList; public static List trueMeleeBoostExceptionList; @@ -249,7 +142,8 @@ namespace CalamityMod Config.Load(); SetupLists(); - RegisterThoriumBossDR(ModLoader.GetMod("ThoriumMod")); + SetupVanillaDR(); + SetupThoriumBossDR(ModLoader.GetMod("ThoriumMod")); CalamityLocalization.AddLocalizations(); } @@ -329,8 +223,10 @@ namespace CalamityMod AstralCactusGlowTexture = null; AstralSky = null; - donatorList = null; + DRValues?.Clear(); + DRValues = null; + donatorList = null; rangedProjectileExceptionList = null; projectileMinionList = null; enemyImmunityList = null; @@ -359,6 +255,7 @@ namespace CalamityMod revengeanceEnemyBuffList = null; revengeanceProjectileBuffList = null; revengeanceLifeStealExceptionList = null; + movementImpairImmuneList = null; trapProjectileList = null; scopedWeaponList = null; trueMeleeBoostExceptionList = null; @@ -1581,6 +1478,10 @@ namespace CalamityMod NPCID.MoonLordCore }; + movementImpairImmuneList = new List() + { + NPCID.QueenBee, + }; trapProjectileList = new List() { @@ -2155,8 +2056,122 @@ namespace CalamityMod } #endregion + #region Vanilla Enemy DR + private void SetupVanillaDR() + { + DRValues = new SortedDictionary { + { NPCID.AngryBonesBig, 0.2f }, + { NPCID.AngryBonesBigHelmet, 0.2f }, + { NPCID.AngryBonesBigMuscle, 0.2f }, + { NPCID.AnomuraFungus, 0.1f }, + { NPCID.Antlion, 0.1f }, + { NPCID.Arapaima, 0.1f }, + { NPCID.ArmoredSkeleton, 0.15f }, + { NPCID.ArmoredViking, 0.1f }, + { NPCID.BigMimicCorruption, 0.3f }, + { NPCID.BigMimicCrimson, 0.3f }, + { NPCID.BigMimicHallow, 0.3f }, + { NPCID.BigMimicJungle, 0.3f }, // unused vanilla enemy + { NPCID.BlueArmoredBones, 0.2f }, + { NPCID.BlueArmoredBonesMace, 0.2f }, + { NPCID.BlueArmoredBonesNoPants, 0.2f }, + { NPCID.BlueArmoredBonesSword, 0.2f }, + { NPCID.BoneLee, 0.2f }, + { NPCID.Crab, 0.05f }, + { NPCID.Crawdad, 0.2f }, + { NPCID.Crawdad2, 0.2f }, + { NPCID.CultistBoss, 0.05f }, + { NPCID.DD2Betsy, 0.1f }, + { NPCID.DD2OgreT2, 0.1f }, + { NPCID.DD2OgreT3, 0.15f }, + { NPCID.DeadlySphere, 0.4f }, + { NPCID.DiabolistRed, 0.2f }, + { NPCID.DiabolistWhite, 0.2f }, + { NPCID.DungeonGuardian, 0.999999f }, + { NPCID.DungeonSpirit, 0.2f }, + { NPCID.ElfCopter, 0.15f }, + { NPCID.Everscream, 0.1f }, + { NPCID.FlyingAntlion, 0.05f }, + { NPCID.GiantCursedSkull, 0.2f }, + { NPCID.GiantShelly, 0.2f }, + { NPCID.GiantShelly2, 0.2f }, + { NPCID.GiantTortoise, 0.35f }, + { NPCID.Golem, 0.25f }, + { NPCID.GolemFistLeft, 0.25f }, + { NPCID.GolemFistRight, 0.25f }, + { NPCID.GolemHead, 0.25f }, + { NPCID.GolemHeadFree, 0.25f }, + { NPCID.GraniteFlyer, 0.1f }, + { NPCID.GraniteGolem, 0.15f }, + { NPCID.GreekSkeleton, 0.1f }, + { NPCID.HellArmoredBones, 0.2f }, + { NPCID.HellArmoredBonesMace, 0.2f }, + { NPCID.HellArmoredBonesSpikeShield, 0.2f }, + { NPCID.HellArmoredBonesSword, 0.2f }, + { NPCID.IceGolem, 0.1f }, + { NPCID.IceQueen, 0.1f }, + { NPCID.IceTortoise, 0.35f }, + { NPCID.HeadlessHorseman, 0.05f }, + { NPCID.MartianDrone, 0.2f }, + { NPCID.MartianSaucer, 0.2f }, + { NPCID.MartianSaucerCannon, 0.2f }, + { NPCID.MartianSaucerCore, 0.2f }, + { NPCID.MartianSaucerTurret, 0.2f }, + { NPCID.MartianTurret, 0.2f }, + { NPCID.MartianWalker, 0.35f }, + { NPCID.Mimic, 0.3f }, + { NPCID.MoonLordCore, 0.05f }, + { NPCID.MoonLordFreeEye, 0.05f }, + { NPCID.MoonLordHand, 0.05f }, + { NPCID.MoonLordHead, 0.05f }, + { NPCID.Mothron, 0.2f }, + { NPCID.MothronEgg, 0.5f }, + { NPCID.MourningWood, 0.1f }, + { NPCID.Necromancer, 0.2f }, + { NPCID.NecromancerArmored, 0.2f }, + { NPCID.Paladin, 0.45f }, + { NPCID.PirateCaptain, 0.05f }, + { NPCID.PirateShipCannon, 0.15f }, + { NPCID.PossessedArmor, 0.25f }, + { NPCID.PresentMimic, 0.3f }, + { NPCID.PrimeCannon, 0.2f }, + { NPCID.PrimeLaser, 0.2f }, + { NPCID.PrimeSaw, 0.25f }, + { NPCID.PrimeVice, 0.25f }, + { NPCID.Probe, 0.25f }, + { NPCID.Pumpking, 0.1f }, + { NPCID.QueenBee, 0.05f }, + { NPCID.RaggedCaster, 0.2f }, + { NPCID.RaggedCasterOpenCoat, 0.2f }, + { NPCID.Retinazer, 0.2f }, + { NPCID.RustyArmoredBonesAxe, 0.2f }, + { NPCID.RustyArmoredBonesFlail, 0.2f }, + { NPCID.RustyArmoredBonesSword, 0.2f }, + { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, + { NPCID.SandElemental, 0.1f }, + { NPCID.SantaNK1, 0.35f }, + { NPCID.SeaSnail, 0.05f }, + { NPCID.SkeletonArcher, 0.1f }, + { NPCID.SkeletonCommando, 0.2f }, + { NPCID.SkeletonSniper, 0.2f }, + { NPCID.SkeletronHand, 0.05f }, + { NPCID.SkeletronHead, 0.05f }, + { NPCID.SkeletronPrime, 0.25f }, + { NPCID.Spazmatism, 0.2f }, + { NPCID.TacticalSkeleton, 0.2f }, + { NPCID.TheDestroyer, 0.1f }, + { NPCID.TheDestroyerBody, 0.2f }, + { NPCID.TheDestroyerTail, 0.35f }, + { NPCID.TheHungry, 0.1f }, + { NPCID.UndeadViking, 0.1f }, + { NPCID.WalkingAntlion, 0.1f }, + { NPCID.WallofFlesh, 0.5f }, + }; + } + #endregion + #region Thorium Boss DR - private void RegisterThoriumBossDR(Mod thorium) + private void SetupThoriumBossDR(Mod thorium) { if (thorium is null || !Config.RevengeanceAndDeathThoriumBossBuff) return; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c889a31c1a..7245d7ff0b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -435,31 +435,26 @@ namespace CalamityMod.NPCs } } - if (eFreeze && !CalamityWorld.bossRushActive) + // Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies. + if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type)) { - npc.velocity.X = 0f; - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y > 15f) + if (eFreeze && !CalamityWorld.bossRushActive) { - npc.velocity.Y = 15f; + npc.velocity.X = 0f; + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; } - } - - if (tSad) - { - npc.velocity.Y /= 2; - npc.velocity.X /= 2; - } - - if (gState) - { - npc.velocity.X = 0f; - npc.velocity.Y += 0.05f; - - if (npc.velocity.Y > 15f) + else if (gState) { - npc.velocity.Y = 15f; + npc.velocity.X = 0f; + npc.velocity.Y += 0.05f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; + } + if (tSad) + { + npc.velocity /= 2f; } } @@ -2030,24 +2025,19 @@ namespace CalamityMod.NPCs #region Post AI public override void PostAI(NPC npc) { - if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) - { - npc.velocity.X *= 0.95f; - npc.velocity.Y *= 0.95f; - } + // Bosses and any specific other NPCs are completely immune to having their movement impaired. + if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) + return; - if (!CalamityWorld.bossRushActive) + if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) + npc.velocity *= 0.95f; + + if (!CalamityWorld.bossRushActive) { if (silvaStun) - { - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - } + npc.velocity = Vector2.Zero; else if (timeSlow) - { - npc.velocity.X *= 0.85f; - npc.velocity.Y *= 0.85f; - } + npc.velocity *= 0.85f; } } #endregion