From 60cfab641ea31fbb5f4c7d93adcb74631b057c6a Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Mon, 4 Apr 2022 20:38:44 -0500 Subject: [PATCH] Split many mod/world things into systems --- Backgrounds/AstralDesertSurfaceBGStyle.cs | 19 +- Backgrounds/AstralSnowSurfaceBGStyle.cs | 18 +- Backgrounds/AstralSurfaceBGStyle.cs | 19 +- Backgrounds/AstralUndergroundBGStyle.cs | 10 +- Backgrounds/SulphurSeaSurfaceBGStyle.cs | 8 +- BiomeManagers/AbovegroundAstralBiome.cs | 30 + BiomeManagers/AbovegroundAstralDesertBiome.cs | 28 + BiomeManagers/AbovegroundAstralSnowBiome.cs | 28 + BiomeManagers/AbyssLayer1Biome.cs | 67 + BiomeManagers/AbyssLayer2Biome.cs | 35 + BiomeManagers/AbyssLayer3Biome.cs | 35 + BiomeManagers/AbyssLayer4Biome.cs | 34 + BiomeManagers/BrimstoneCragsBiome.cs | 24 + BiomeManagers/SulphurousSeaBiome.cs | 65 + BiomeManagers/SunkenSeaBiome.cs | 25 + BiomeManagers/UndergroundAstralBiome.cs | 28 + Buffs/StatBuffs/ProfanedCrystalBuff.cs | 6 +- Buffs/Summon/ProfanedBabs.cs | 2 +- CalPlayer/CalamityPlayer.cs | 240 +--- CalPlayer/CalamityPlayerFishing.cs | 166 +-- CalPlayer/CalamityPlayerLifeRegen.cs | 10 +- CalPlayer/CalamityPlayerMiscEffects.cs | 10 +- CalamityMod.cs | 835 +----------- Events/AcidRainEvent.cs | 28 +- Items/Accessories/GrandGelatin.cs | 2 +- Items/Accessories/ProfanedSoulCrystal.cs | 4 +- Items/CalamityGlobalItem.cs | 28 +- Items/CalamityGlobalItemLoot.cs | 12 +- Items/Fishing/AstralCatches/AstralCrate.cs | 18 +- .../Fishing/BrimstoneCragCatches/Brimlish.cs | 2 +- .../BrimstoneCragCatches/BrimstoneCrate.cs | 8 +- Items/Fishing/SulphurCatches/AbyssalCrate.cs | 24 +- .../SunkenSeaCatches/EutrophicSandfish.cs | 7 +- Items/Fishing/SunkenSeaCatches/SunkenCrate.cs | 15 +- Items/Fishing/SunkenSeaCatches/SurfClam.cs | 5 +- Items/Placeables/AstralFossil.cs | 2 +- Items/Placeables/AstralSilt.cs | 2 +- Items/SummonItems/CosmicWorm.cs | 2 +- Items/Tools/ClimateChange/AridArtifact.cs | 5 +- Items/TreasureBags/BrimstoneWaifuBag.cs | 4 +- Items/TreasureBags/CalamitasBag.cs | 2 +- Items/TreasureBags/DraedonTreasureBag.cs | 12 +- Items/TreasureBags/RavagerBag.cs | 6 +- Items/Weapons/Melee/Murasama.cs | 2 +- ModSupport/ModCalls.cs | 71 +- ModSupport/WeakReferenceSupport.cs | 62 +- NPCs/Abyss/Bloatfish.cs | 2 +- NPCs/Abyss/BobbitWormHead.cs | 4 +- NPCs/Abyss/ColossalSquid.cs | 4 +- NPCs/Abyss/DevilFish.cs | 4 +- NPCs/Abyss/DevilFishAlt.cs | 4 +- NPCs/Abyss/EidolonWyrmHead.cs | 8 +- NPCs/Abyss/GiantSquid.cs | 4 +- NPCs/Abyss/GulperEelHead.cs | 4 +- NPCs/Abyss/Laserfish.cs | 2 +- NPCs/Abyss/LuminousCorvina.cs | 4 +- NPCs/Abyss/MirageJelly.cs | 2 +- NPCs/Abyss/OarfishHead.cs | 2 +- NPCs/Abyss/Reaper.cs | 8 +- NPCs/Abyss/ToxicMinnow.cs | 2 +- NPCs/Abyss/Viperfish.cs | 4 +- NPCs/AcidRain/AcidEel.cs | 10 +- NPCs/AcidRain/CragmawMire.cs | 28 +- NPCs/AcidRain/FlakBaby.cs | 2 +- NPCs/AcidRain/FlakCrab.cs | 8 +- NPCs/AcidRain/NuclearToad.cs | 14 +- NPCs/AcidRain/Orthocera.cs | 12 +- NPCs/AcidRain/Radiator.cs | 6 +- NPCs/AcidRain/Skyfin.cs | 10 +- NPCs/AcidRain/SulfurousSkater.cs | 8 +- NPCs/AcidRain/Trilobite.cs | 10 +- NPCs/AcidRain/WaterLeech.cs | 8 +- NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs | 4 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 10 +- NPCs/Astral/Aries.cs | 4 +- NPCs/Astral/AstralProbe.cs | 4 +- NPCs/Astral/AstralSlime.cs | 6 +- NPCs/Astral/AstralachneaGround.cs | 4 +- NPCs/Astral/AstralachneaWall.cs | 4 +- NPCs/Astral/Atlas.cs | 6 +- NPCs/Astral/BigSightseer.cs | 4 +- NPCs/Astral/FusionFeeder.cs | 2 +- NPCs/Astral/Hadarian.cs | 4 +- NPCs/Astral/Hive.cs | 4 +- NPCs/Astral/Hiveling.cs | 2 +- NPCs/Astral/Mantis.cs | 6 +- NPCs/Astral/Nova.cs | 4 +- NPCs/Astral/SmallSightseer.cs | 2 +- NPCs/Astral/StellarCulex.cs | 4 +- NPCs/AstrumAureus/AstrumAureus.cs | 8 +- NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs | 8 +- NPCs/BrimstoneElemental/Brimling.cs | 4 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 14 +- NPCs/Bumblebirb/Bumblefuck.cs | 4 +- NPCs/Calamitas/CalamitasRun.cs | 2 +- NPCs/Calamitas/CalamitasRun2.cs | 2 +- NPCs/Calamitas/CalamitasRun3.cs | 12 +- NPCs/CalamityAI.cs | 12 +- NPCs/CalamityGlobalNPC.cs | 84 +- NPCs/CalamityGlobalNPCLoot.cs | 12 +- NPCs/CalamityGlobalTownNPC.cs | 59 +- NPCs/CeaselessVoid/CeaselessVoid.cs | 8 +- NPCs/CeaselessVoid/DarkEnergy.cs | 2 +- NPCs/Crabulon/CrabulonIdle.cs | 4 +- NPCs/Crags/CalamityEye.cs | 4 +- NPCs/Crags/CharredSlime.cs | 6 +- NPCs/Crags/CultistAssassin.cs | 4 +- NPCs/Crags/DespairStone.cs | 4 +- NPCs/Crags/Scryllar.cs | 6 +- NPCs/Crags/ScryllarRage.cs | 6 +- NPCs/Crags/SoulSlurper.cs | 6 +- NPCs/Cryogen/Cryogen.cs | 6 +- NPCs/DesertScourge/DesertScourgeHead.cs | 6 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 10 +- NPCs/ExoMechs/Ares/AresBody.cs | 26 +- NPCs/GreatSandShark/GreatSandShark.cs | 2 +- NPCs/HiveMind/HiveCyst.cs | 2 +- NPCs/HiveMind/HiveMind.cs | 8 +- NPCs/Leviathan/AquaticAberration.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 6 +- NPCs/Leviathan/LeviathanStart.cs | 2 +- NPCs/NormalNPCs/AeroSlime.cs | 2 +- NPCs/NormalNPCs/AngryDog.cs | 4 +- NPCs/NormalNPCs/BloomSlime.cs | 2 +- NPCs/NormalNPCs/Bohldohr.cs | 2 +- NPCs/NormalNPCs/CryoSlime.cs | 2 +- NPCs/NormalNPCs/Eidolist.cs | 2 +- NPCs/NormalNPCs/Parasea.cs | 2 +- NPCs/NormalNPCs/ThiccWaifu.cs | 15 +- NPCs/OldDuke/OldDuke.cs | 6 +- NPCs/Perforator/PerforatorCyst.cs | 2 +- NPCs/Perforator/PerforatorHive.cs | 8 +- .../PlaguebringerGoliath.cs | 4 +- NPCs/Polterghast/Polterghast.cs | 8 +- .../ProfanedGuardians/ProfanedGuardianBoss.cs | 4 +- NPCs/Providence/Providence.cs | 12 +- NPCs/Ravager/FlamePillar.cs | 6 +- NPCs/Ravager/RavagerBody.cs | 12 +- NPCs/Ravager/RavagerClawLeft.cs | 2 +- NPCs/Ravager/RavagerClawRight.cs | 2 +- NPCs/Ravager/RavagerHead.cs | 4 +- NPCs/Ravager/RavagerHead2.cs | 4 +- NPCs/Ravager/RavagerLegLeft.cs | 2 +- NPCs/Ravager/RavagerLegRight.cs | 2 +- NPCs/Ravager/RockPillar.cs | 4 +- NPCs/Signus/Signus.cs | 10 +- NPCs/SlimeGod/SlimeGodCore.cs | 8 +- NPCs/StormWeaver/StormWeaverBody.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 8 +- NPCs/StormWeaver/StormWeaverTail.cs | 2 +- NPCs/SulphurousSea/AnthozoanCrab.cs | 2 +- NPCs/SulphurousSea/BelchingCoral.cs | 2 +- NPCs/SunkenSea/EutrophicRay.cs | 2 +- NPCs/SunkenSea/GhostBell.cs | 2 +- NPCs/SunkenSea/GiantClam.cs | 27 +- NPCs/SunkenSea/PrismTurtle.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 40 +- NPCs/TownNPCs/DILF.cs | 2 +- NPCs/TownNPCs/FAP.cs | 10 +- NPCs/TownNPCs/SEAHOE.cs | 16 +- NPCs/TownNPCs/THIEF.cs | 10 +- NPCs/TownNPCs/WITCH.cs | 2 +- NPCs/Yharon/Yharon.cs | 8 +- Projectiles/CalamityGlobalProjectile.cs | 2 +- Projectiles/Enemy/CragmawAcidDrop.cs | 2 +- Projectiles/Enemy/CragmawSpike.cs | 2 +- Systems/BiomeTileCounterSystem.cs | 47 + Systems/DownedBossSystem.cs | 613 +++++++++ Systems/EntityUpdateInterceptionSystem.cs | 43 + Systems/LightingEffectsSystem.cs | 96 ++ Systems/MiscWorldStateSystem.cs | 283 ++++ Systems/SpeedrunTimerStoppingSystem.cs | 9 + Systems/UIManagementSystem.cs | 160 +++ .../WorldMiscUpdateSystem.cs | 54 +- Systems/WorldSyncingSystem.cs | 287 ++++ Systems/WorldgenManagementSystem.cs | 266 ++++ Tiles/Astral/AstralChestLocked.cs | 2 +- Tiles/CalamityGlobalTile.cs | 2 +- Tiles/Ores/AstralOre.cs | 2 +- Tiles/SunkenSea/EutrophicSand.cs | 4 +- Tiles/SunkenSea/Navystone.cs | 4 +- Tiles/SunkenSea/SeaPrism.cs | 4 +- Tiles/SunkenSea/SeaPrismCrystals.cs | 4 +- Utilities/ItemUtils.cs | 28 +- Waters/AbyssWater.cs | 12 +- Waters/AstralWater.cs | 14 +- Waters/SulphuricWater.cs | 37 +- Waters/SunkenSeaWater.cs | 12 +- World/CalamityWorld.cs | 1163 +---------------- World/MiscWorldgenRoutines.cs | 5 +- World/Planets/GrassPlanet.cs | 28 +- World/Planets/Planetoid.cs | 5 +- 192 files changed, 3100 insertions(+), 3012 deletions(-) create mode 100644 BiomeManagers/AbovegroundAstralBiome.cs create mode 100644 BiomeManagers/AbovegroundAstralDesertBiome.cs create mode 100644 BiomeManagers/AbovegroundAstralSnowBiome.cs create mode 100644 BiomeManagers/AbyssLayer1Biome.cs create mode 100644 BiomeManagers/AbyssLayer2Biome.cs create mode 100644 BiomeManagers/AbyssLayer3Biome.cs create mode 100644 BiomeManagers/AbyssLayer4Biome.cs create mode 100644 BiomeManagers/BrimstoneCragsBiome.cs create mode 100644 BiomeManagers/SulphurousSeaBiome.cs create mode 100644 BiomeManagers/SunkenSeaBiome.cs create mode 100644 BiomeManagers/UndergroundAstralBiome.cs create mode 100644 Systems/BiomeTileCounterSystem.cs create mode 100644 Systems/DownedBossSystem.cs create mode 100644 Systems/EntityUpdateInterceptionSystem.cs create mode 100644 Systems/LightingEffectsSystem.cs create mode 100644 Systems/MiscWorldStateSystem.cs create mode 100644 Systems/SpeedrunTimerStoppingSystem.cs create mode 100644 Systems/UIManagementSystem.cs rename World/WorldUpdateMiscEffects.cs => Systems/WorldMiscUpdateSystem.cs (90%) create mode 100644 Systems/WorldSyncingSystem.cs create mode 100644 Systems/WorldgenManagementSystem.cs diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index dae07c8cf8..7491d81993 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -1,42 +1,35 @@ -using Terraria; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class AstralDesertSurfaceBGStyle : ModSurfaceBgStyle + public class AstralDesertSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); - public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { b -= 75f; - return Mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose"); + return BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose"); } - public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneDesert; - public override void ModifyFarFades(float[] fades, float transitionSpeed) { - //This just fades in the background and fades out other backgrounds. + // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) { fades[i] += transitionSpeed; if (fades[i] > 1f) - { fades[i] = 1f; - } } else { fades[i] -= transitionSpeed; if (fades[i] < 0f) - { fades[i] = 0f; - } } } } diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index f56f360a81..7ca3a2b119 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -1,38 +1,32 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class AstralSnowSurfaceBGStyle : ModSurfaceBgStyle + public class AstralSnowSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); - public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); - - public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneSnow; + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); public override void ModifyFarFades(float[] fades, float transitionSpeed) { - //This just fades in the background and fades out other backgrounds. + // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) { fades[i] += transitionSpeed; if (fades[i] > 1f) - { fades[i] = 1f; - } } else { fades[i] -= transitionSpeed; if (fades[i] < 0f) - { fades[i] = 0f; - } } } } diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index 45632d5d2f..cc855251a7 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -1,42 +1,35 @@ -using Terraria; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class AstralSurfaceBGStyle : ModSurfaceBgStyle + public class AstralSurfaceBGStyle : ModSurfaceBackgroundStyle { - public override int ChooseFarTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); + public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); - public override int ChooseMiddleTexture() => Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); + public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { scale *= 0.75f; - return Mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); + return BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); } - public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; - public override void ModifyFarFades(float[] fades, float transitionSpeed) { - //This just fades in the background and fades out other backgrounds. + // This just fades in the background and fades out other backgrounds. for (int i = 0; i < fades.Length; i++) { if (i == Slot) { fades[i] += transitionSpeed; if (fades[i] > 1f) - { fades[i] = 1f; - } } else { fades[i] -= transitionSpeed; if (fades[i] < 0f) - { fades[i] = 0f; - } } } } diff --git a/Backgrounds/AstralUndergroundBGStyle.cs b/Backgrounds/AstralUndergroundBGStyle.cs index f4c558c716..ff7fef996c 100644 --- a/Backgrounds/AstralUndergroundBGStyle.cs +++ b/Backgrounds/AstralUndergroundBGStyle.cs @@ -1,18 +1,14 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class AstralUndergroundBGStyle : ModUgBgStyle + public class AstralUndergroundBGStyle : ModUndergroundBackgroundStyle { - public override bool ChooseBgStyle() => Main.LocalPlayer.InAstral(); - public override void FillTextureArray(int[] textureSlots) { for (int i = 0; i <= 3; i++) - { - textureSlots[i] = Mod.GetBackgroundSlot("Backgrounds/AstralUG" + i.ToString()); - } + textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/AstralUG" + i.ToString()); } } } diff --git a/Backgrounds/SulphurSeaSurfaceBGStyle.cs b/Backgrounds/SulphurSeaSurfaceBGStyle.cs index 6893e0734d..8b00eacd7c 100644 --- a/Backgrounds/SulphurSeaSurfaceBGStyle.cs +++ b/Backgrounds/SulphurSeaSurfaceBGStyle.cs @@ -1,18 +1,16 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class SulphurSeaSurfaceBGStyle : ModSurfaceBgStyle + public class SulphurSeaSurfaceBGStyle : ModSurfaceBackgroundStyle { public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { b -= 250f; - return Mod.GetBackgroundSlot("Backgrounds/SulphurSeaSurfaceClose"); + return BackgroundTextureLoader.GetBackgroundSlot("Backgrounds/SulphurSeaSurfaceClose"); } - public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InSulphur(); - public override void ModifyFarFades(float[] fades, float transitionSpeed) { //This just fades in the background and fades out other backgrounds. diff --git a/BiomeManagers/AbovegroundAstralBiome.cs b/BiomeManagers/AbovegroundAstralBiome.cs new file mode 100644 index 0000000000..568d4ef140 --- /dev/null +++ b/BiomeManagers/AbovegroundAstralBiome.cs @@ -0,0 +1,30 @@ +using CalamityMod.Backgrounds; +using CalamityMod.Systems; +using CalamityMod.Waters; +using CalamityMod.World; +using Terraria; +using Terraria.Graphics.Capture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbovegroundAstralBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AstralWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/Backgrounds/AstralSurfaceBGStyle"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Surface"); + } + + public override bool IsBiomeActive(Player player) + { + return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && + !player.ZoneDesert && !player.ZoneSnow; + } + } +} diff --git a/BiomeManagers/AbovegroundAstralDesertBiome.cs b/BiomeManagers/AbovegroundAstralDesertBiome.cs new file mode 100644 index 0000000000..c136fc8151 --- /dev/null +++ b/BiomeManagers/AbovegroundAstralDesertBiome.cs @@ -0,0 +1,28 @@ +using CalamityMod.Backgrounds; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbovegroundAstralDesertBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AstralWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/Backgrounds/AstralDesertSurfaceBGStyle"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Desert Surface"); + } + + public override bool IsBiomeActive(Player player) + { + return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) + && player.ZoneDesert && !player.ZoneSnow; + } + } +} diff --git a/BiomeManagers/AbovegroundAstralSnowBiome.cs b/BiomeManagers/AbovegroundAstralSnowBiome.cs new file mode 100644 index 0000000000..0f540d8246 --- /dev/null +++ b/BiomeManagers/AbovegroundAstralSnowBiome.cs @@ -0,0 +1,28 @@ +using CalamityMod.Backgrounds; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbovegroundAstralSnowBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AstralWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/Backgrounds/AstralSnowSurfaceBGStyle"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Snow Surface"); + } + + public override bool IsBiomeActive(Player player) + { + return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && + !player.ZoneDesert && player.ZoneSnow; + } + } +} diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs new file mode 100644 index 0000000000..147525a656 --- /dev/null +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -0,0 +1,67 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Systems; +using CalamityMod.Waters; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbyssLayer1Biome : ModBiome + { + public static bool MeetsBaseAbyssRequirement(Player player, out int playerYTileCoords) + { + Point point = player.Center.ToTileCoordinates(); + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmY = y - 250; + int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); + + bool abyssPosX = false; + bool abyssPosY = point.Y <= abyssChasmY; + if (CalamityWorld.abyssSide) + { + if (point.X < abyssChasmX + 80) + abyssPosX = true; + } + else + { + if (point.X > abyssChasmX - 80) + abyssPosX = true; + } + + playerYTileCoords = point.Y; + return point.Y > (Main.rockLayer - y * 0.05) && + !player.lavaWet && + !player.honeyWet && + abyssPosY && + abyssPosX; + } + + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AbyssWater"); + + public override int Music + { + get + { + if (CalamityPlayer.areThereAnyDamnBosses) + return Main.curMusic; + return CalamityMod.Instance.GetMusicFromMusicMod("Abyss1") ?? MusicID.Hell; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("First Layer of the Abyss"); + } + + public override bool IsBiomeActive(Player player) + { + return MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && + playerYTileCoords < (Main.rockLayer + Main.maxTilesY * 0.03); + } + } +} diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs new file mode 100644 index 0000000000..fa6bbbc722 --- /dev/null +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbyssLayer2Biome : ModBiome + { + public override int Music + { + get + { + if (CalamityPlayer.areThereAnyDamnBosses) + return Main.curMusic; + return CalamityMod.Instance.GetMusicFromMusicMod("Abyss1") ?? MusicID.Hell; + } + } + + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AbyssWater"); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Second Layer of the Abyss"); + } + + public override bool IsBiomeActive(Player player) + { + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && + playerYTileCoords > (Main.rockLayer + Main.maxTilesY * 0.03) && + playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.14); + } + } +} diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs new file mode 100644 index 0000000000..9c29bce612 --- /dev/null +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbyssLayer3Biome : ModBiome + { + public override int Music + { + get + { + if (CalamityPlayer.areThereAnyDamnBosses) + return Main.curMusic; + return CalamityMod.Instance.GetMusicFromMusicMod("Abyss2") ?? MusicID.Hell; + } + } + + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AbyssWater"); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Third Layer of the Abyss"); + } + + public override bool IsBiomeActive(Player player) + { + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && + playerYTileCoords > (Main.rockLayer + Main.maxTilesY * 0.14) && + playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.26); + } + } +} diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs new file mode 100644 index 0000000000..6a77f35602 --- /dev/null +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class AbyssLayer4Biome : ModBiome + { + public override int Music + { + get + { + if (CalamityPlayer.areThereAnyDamnBosses) + return Main.curMusic; + return CalamityMod.Instance.GetMusicFromMusicMod("Abyss3") ?? MusicID.Hell; + } + } + + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AbyssWater"); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fourth Layer of the Abyss"); + } + + public override bool IsBiomeActive(Player player) + { + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && + playerYTileCoords > Main.rockLayer + Main.maxTilesY * 0.26; + } + } +} diff --git a/BiomeManagers/BrimstoneCragsBiome.cs b/BiomeManagers/BrimstoneCragsBiome.cs new file mode 100644 index 0000000000..596362d626 --- /dev/null +++ b/BiomeManagers/BrimstoneCragsBiome.cs @@ -0,0 +1,24 @@ +using CalamityMod.Backgrounds; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class BrimstoneCragsBiome : ModBiome + { + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Crag") ?? MusicID.Eerie; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Crags"); + } + + public override bool IsBiomeActive(Player player) + { + return BiomeTileCounterSystem.BrimstoneCragTiles > 100; + } + } +} diff --git a/BiomeManagers/SulphurousSeaBiome.cs b/BiomeManagers/SulphurousSeaBiome.cs new file mode 100644 index 0000000000..af561ebf72 --- /dev/null +++ b/BiomeManagers/SulphurousSeaBiome.cs @@ -0,0 +1,65 @@ +using CalamityMod.Backgrounds; +using CalamityMod.CalPlayer; +using CalamityMod.Systems; +using CalamityMod.Waters; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SulphurousSeaBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/SulphuricWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/Backgrounds/SulphurSeaSurfaceBGStyle"); + + public override int Music + { + get + { + int music = Main.curMusic; + if (!CalamityPlayer.areThereAnyDamnBosses) + { + bool acidRain = CalamityWorld.rainingAcid; + + // Acid Rain themes + if (acidRain) + { + music = DownedBossSystem.downedPolterghast + ? CalamityMod.Instance.GetMusicFromMusicMod("AcidRain2") ?? MusicID.Eclipse // Acid Rain Tier 3 + : CalamityMod.Instance.GetMusicFromMusicMod("AcidRain1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 + } + + // Regular Sulphur Sea theme, when Acid Rain is not occurring + else + music = CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSea") ?? MusicID.Desert; + } + return music; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulpurous Sea"); + } + + public override bool IsBiomeActive(Player player) + { + Point point = player.Center.ToTileCoordinates(); + bool sulphurPosX = false; + if (CalamityWorld.abyssSide) + { + if (point.X < 380) + sulphurPosX = true; + } + else + { + if (point.X > Main.maxTilesX - 380) + sulphurPosX = true; + } + return BiomeTileCounterSystem.SulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX); + } + } +} diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs new file mode 100644 index 0000000000..57a463abe4 --- /dev/null +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -0,0 +1,25 @@ +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class SunkenSeaBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/SunkenSeaWater"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunken Sea"); + } + + public override bool IsBiomeActive(Player player) + { + return BiomeTileCounterSystem.SunkenSeaTiles > 150; + } + } +} diff --git a/BiomeManagers/UndergroundAstralBiome.cs b/BiomeManagers/UndergroundAstralBiome.cs new file mode 100644 index 0000000000..71f045c160 --- /dev/null +++ b/BiomeManagers/UndergroundAstralBiome.cs @@ -0,0 +1,28 @@ +using CalamityMod.Backgrounds; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class UndergroundAstralBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/Waters/AstralWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/Backgrounds/AstralUndergroundBGStyle"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralUnderground") ?? MusicID.Space; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Underground"); + } + + public override bool IsBiomeActive(Player player) + { + return !player.ZoneDungeon && (BiomeTileCounterSystem.AstralTiles > 950 || (player.ZoneSnow && BiomeTileCounterSystem.AstralTiles > 300)) && + (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); + } + } +} diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index df78512601..ccd48d2359 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - if (CalamityWorld.downedSCal && CalamityWorld.downedExoMechs && (player.Calamity().minionSlotStat - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce) + if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs && (player.Calamity().minionSlotStat - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce) { player.Calamity().profanedCrystalBuffs = true; } @@ -48,13 +48,13 @@ namespace CalamityMod.Buffs.StatBuffs (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); } } - else if (CalamityWorld.downedSCal && CalamityWorld.downedExoMechs) + else if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs) { tip = "Your profaned soul is constrained by your insufficient summoning powers"; } else { - tip = !CalamityWorld.downedExoMechs ? "The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations" : "The profaned soul within has been defiled by the powerful magic of a supreme witch"; + tip = !DownedBossSystem.downedExoMechs ? "The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations" : "The profaned soul within has been defiled by the powerful magic of a supreme witch"; } } } diff --git a/Buffs/Summon/ProfanedBabs.cs b/Buffs/Summon/ProfanedBabs.cs index 6471437d45..0a4809d987 100644 --- a/Buffs/Summon/ProfanedBabs.cs +++ b/Buffs/Summon/ProfanedBabs.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Buffs.Summon Player player = Main.player[Main.myPlayer]; bool offense = player.Calamity().gOffense; bool defense = player.Calamity().gDefense; - if (player.Calamity().profanedCrystal && (!player.Calamity().profanedCrystalBuffs && !CalamityWorld.downedSCal)) + if (player.Calamity().profanedCrystal && (!player.Calamity().profanedCrystalBuffs && !DownedBossSystem.downedSCal)) { tip = "The Profaned Babs will accompany you!"; } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 00a6b8b383..c6d2fb6c83 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -78,6 +78,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Audio; +using CalamityMod.BiomeManagers; namespace CalamityMod.CalPlayer { @@ -1069,15 +1070,18 @@ namespace CalamityMod.CalPlayer #endregion #region Biome - public bool ZoneCalamity = false; - public bool ZoneAstral = false; - public bool ZoneSunkenSea = false; - public bool ZoneSulphur = false; - public bool ZoneAbyss = false; - public bool ZoneAbyssLayer1 = false; - public bool ZoneAbyssLayer2 = false; - public bool ZoneAbyssLayer3 = false; - public bool ZoneAbyssLayer4 = false; + public bool ZoneCalamity => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAstral => Player.InModBiome(ModContent.GetInstance()) || + Player.InModBiome(ModContent.GetInstance()) || + Player.InModBiome(ModContent.GetInstance()) || + Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSunkenSea => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneSulphur => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4; + public bool ZoneAbyssLayer1 => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAbyssLayer2 => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAbyssLayer3 => Player.InModBiome(ModContent.GetInstance()); + public bool ZoneAbyssLayer4 => Player.InModBiome(ModContent.GetInstance()); public bool abyssDeath = false; public int abyssBreathCD; public float caveDarkness = 0f; @@ -1225,7 +1229,7 @@ namespace CalamityMod.CalPlayer cooldowns = new Dictionary(16); } - public override TagCompound Save() + public override void SaveData(TagCompound tag) { var boost = new List(); boost.AddWithCondition("extraAccessoryML", extraAccessoryML); @@ -1301,40 +1305,34 @@ namespace CalamityMod.CalPlayer cooldownsTag.Add(id, singleCDTag); } - return new TagCompound - { - { "boost", boost }, - { "rage", rage }, - { "stress", rage * (10000 / 100f) }, // Backwards compatibility -- save new rage as old stress. - { "adrenaline", adrenaline }, - { "aquaticBoostPower", aquaticBoost }, - { "sCalDeathCount", sCalDeathCount }, - { "sCalKillCount", sCalKillCount }, - { "meleeLevel", meleeLevel }, - { "exactMeleeLevel", exactMeleeLevel }, - { "rangedLevel", rangedLevel }, - { "exactRangedLevel", exactRangedLevel }, - { "magicLevel", magicLevel }, - { "exactMagicLevel", exactMagicLevel }, - { "summonLevel", summonLevel }, - { "exactSummonLevel", exactSummonLevel }, - { "rogueLevel", rogueLevel }, - { "exactRogueLevel", exactRogueLevel }, - { "deathCount", deathCount }, - { "itemTypeLastReforged", itemTypeLastReforged }, - { "reforgeTierSafety", reforgeTierSafety }, - { "moveSpeedStat", moveSpeedStat }, - { "defenseDamage", totalDefenseDamage }, - { "defenseDamageRecoveryFrames", defenseDamageRecoveryFrames }, - { "totalDefenseDamageRecoveryFrames", totalDefenseDamageRecoveryFrames }, - { "totalSpeedrunTicks", totalTicks }, - { "lastSplitType", lastSplitType }, - { "lastSplitTicks", lastSplit.Ticks }, - { "cooldowns", cooldownsTag } - }; + tag["boost"] = boost; + tag["rage"] = rage; + tag["adrenaline"] = adrenaline; + tag["aquaticBoostPower"] = aquaticBoost; + tag["sCalDeathCount"] = sCalDeathCount; + tag["sCalKillCount"] = sCalKillCount; + tag["meleeLevel"] = meleeLevel; + tag["exactMeleeLevel"] = exactMeleeLevel; + tag["rangedLevel"] = rangedLevel; + tag["exactRangedLevel"] = exactRangedLevel; + tag["magicLevel"] = magicLevel; + tag["exactMagicLevel"] = exactMagicLevel; + tag["summonLevel"] = summonLevel; + tag["exactSummonLevel"] = exactSummonLevel; + tag["rogueLevel"] = rogueLevel; + tag["exactRogueLevel"] = exactRogueLevel; + tag["itemTypeLastReforged"] = itemTypeLastReforged; + tag["reforgeTierSafety"] = reforgeTierSafety; + tag["moveSpeedStat"] = moveSpeedStat; + tag["defenseDamage"] = totalDefenseDamage; + tag["defenseDamageRecoveryFrames"] = defenseDamageRecoveryFrames; + tag["totalSpeedrunTicks"] = totalDefenseDamageRecoveryFrames; + tag["lastSplitType"] = lastSplitType; + tag["lastSplitTicks"] = lastSplit.Ticks; + tag["cooldowns"] = cooldownsTag; } - public override void Load(TagCompound tag) + public override void LoadData(TagCompound tag) { var boost = tag.GetList("boost"); extraAccessoryML = boost.Contains("extraAccessoryML"); @@ -1501,9 +1499,9 @@ namespace CalamityMod.CalPlayer (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.01f : 0f) + - (CalamityWorld.downedDoG ? 0.01f : 0f) + - (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 + (DownedBossSystem.downedProvidence ? 0.01f : 0f) + + (DownedBossSystem.downedDoG ? 0.01f : 0f) + + (DownedBossSystem.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); Player.statLifeMax2 += Player.statLifeMax / 5 / 20 * integerTypeBoost; } @@ -2592,6 +2590,7 @@ namespace CalamityMod.CalPlayer #endregion #region BiomeStuff + internal static readonly FieldInfo EffectsField = typeof(SkyManager).GetField("_effects", BindingFlags.NonPublic | BindingFlags.Instance); public override void UpdateBiomeVisuals() @@ -2687,145 +2686,16 @@ namespace CalamityMod.CalPlayer public override void UpdateBiomes() { - Point point = Player.Center.ToTileCoordinates(); - ZoneCalamity = CalamityWorld.calamityTiles > 50; - ZoneAstral = !Player.ZoneDungeon && (CalamityWorld.astralTiles > 950 || (Player.ZoneSnow && CalamityWorld.astralTiles > 300)); - ZoneSunkenSea = CalamityWorld.sunkenSeaTiles > 150; - - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmY = y - 250; - int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); - - bool abyssPosX = false; - bool sulphurPosX = false; - bool abyssPosY = point.Y <= abyssChasmY; - if (CalamityWorld.abyssSide) - { - if (point.X < 380) - { - sulphurPosX = true; - } - if (point.X < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if (point.X > Main.maxTilesX - 380) - { - sulphurPosX = true; - } - if (point.X > abyssChasmX - 80) - { - abyssPosX = true; - } - } - - ZoneAbyss = point.Y > (Main.rockLayer - y * 0.05) && - !Player.lavaWet && - !Player.honeyWet && - abyssPosY && - abyssPosX; - - ZoneAbyssLayer1 = ZoneAbyss && - point.Y <= (Main.rockLayer + y * 0.03); - - ZoneAbyssLayer2 = ZoneAbyss && - point.Y > (Main.rockLayer + y * 0.03) && - point.Y <= (Main.rockLayer + y * 0.14); - - ZoneAbyssLayer3 = ZoneAbyss && - point.Y > (Main.rockLayer + y * 0.14) && - point.Y <= (Main.rockLayer + y * 0.26); - - ZoneAbyssLayer4 = ZoneAbyss && - point.Y > (Main.rockLayer + y * 0.26); - - ZoneSulphur = (CalamityWorld.sulphurTiles >= 300 || (Player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; - //Overriding 1.4's ass req boosts if (Main.snowTiles > 300) Player.ZoneSnow = true; } - - public override bool CustomBiomesMatch(Player other) - { - CalamityPlayer modOther = other.Calamity(); - - // least common biomes checked first so it short circuits as rapidly as possible - return ZoneAbyssLayer4 == modOther.ZoneAbyssLayer4 && - ZoneAbyssLayer3 == modOther.ZoneAbyssLayer3 && - ZoneAbyssLayer2 == modOther.ZoneAbyssLayer2 && - ZoneAbyssLayer1 == modOther.ZoneAbyssLayer1 && - ZoneCalamity == modOther.ZoneCalamity && - ZoneSulphur == modOther.ZoneSulphur && - ZoneSunkenSea == modOther.ZoneSunkenSea && - ZoneAbyss == modOther.ZoneAbyss && - ZoneAstral == modOther.ZoneAstral; - } - - public override void CopyCustomBiomesTo(Player other) - { - CalamityPlayer modOther = other.Calamity(); - modOther.ZoneCalamity = ZoneCalamity; - modOther.ZoneAstral = ZoneAstral; - modOther.ZoneSulphur = ZoneSulphur; - modOther.ZoneSunkenSea = ZoneSunkenSea; - modOther.ZoneAbyss = ZoneAbyss; - modOther.ZoneAbyssLayer1 = ZoneAbyssLayer1; - modOther.ZoneAbyssLayer2 = ZoneAbyssLayer2; - modOther.ZoneAbyssLayer3 = ZoneAbyssLayer3; - modOther.ZoneAbyssLayer4 = ZoneAbyssLayer4; - } - - public override void SendCustomBiomes(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = ZoneCalamity; - flags[1] = ZoneAstral; - flags[2] = ZoneAbyss; - flags[3] = ZoneAbyssLayer1; - flags[4] = ZoneAbyssLayer2; - flags[5] = ZoneAbyssLayer3; - flags[6] = ZoneAbyssLayer4; - flags[7] = ZoneSulphur; - - BitsByte flags2 = new BitsByte(); - flags2[0] = ZoneSunkenSea; - - writer.Write(flags); - writer.Write(flags2); - } - - public override void ReceiveCustomBiomes(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - ZoneCalamity = flags[0]; - ZoneAstral = flags[1]; - ZoneAbyss = flags[2]; - ZoneAbyssLayer1 = flags[3]; - ZoneAbyssLayer2 = flags[4]; - ZoneAbyssLayer3 = flags[5]; - ZoneAbyssLayer4 = flags[6]; - ZoneSulphur = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - ZoneSunkenSea = flags2[0]; - } - public override Texture2D GetMapBackgroundImage() { if (ZoneSulphur) - { - return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"); - } + return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/SulphurBG").Value; if (ZoneAstral) - { - return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/AstralBG"); - } + return ModContent.Request("CalamityMod/Backgrounds/MapBackgrounds/AstralBG").Value; return null; } #endregion @@ -3863,9 +3733,9 @@ namespace CalamityMod.CalPlayer (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.01f : 0f) + - (CalamityWorld.downedDoG ? 0.01f : 0f) + - (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 + (DownedBossSystem.downedProvidence ? 0.01f : 0f) + + (DownedBossSystem.downedDoG ? 0.01f : 0f) + + (DownedBossSystem.downedYharon ? 0.01f : 0f); // 0.2 meleeSpeedMult += floatTypeBoost * 0.25f; } if (eArtifact) @@ -4098,7 +3968,7 @@ namespace CalamityMod.CalPlayer public override bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) { if (item.type == ModContent.ItemType()) - return CalamityWorld.downedSCal; //no easy moneycoins for post doggo/yhar + return DownedBossSystem.downedSCal; //no easy moneycoins for post doggo/yhar return base.CanSellItem(vendor, shopInventory, item); } @@ -8831,19 +8701,19 @@ namespace CalamityMod.CalPlayer // start with a vanilla cost of zero instead of 3 silver price -= Item.buyPrice(0, 0, 3, 0); - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) price += Item.buyPrice(0, 9, 0, 0); - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) price += Item.buyPrice(0, 6, 0, 0); - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) price += Item.buyPrice(0, 3, 20, 0); else if (NPC.downedMoonlord) price += Item.buyPrice(0, 2, 0, 0); - else if (NPC.downedFishron || CalamityWorld.downedPlaguebringer || CalamityWorld.downedScavenger) + else if (NPC.downedFishron || DownedBossSystem.downedPlaguebringer || DownedBossSystem.downedScavenger) price += Item.buyPrice(0, 1, 20, 0); else if (NPC.downedGolemBoss) price += Item.buyPrice(0, 0, 90, 0); - else if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + else if (NPC.downedPlantBoss || DownedBossSystem.downedCalamitas) price += Item.buyPrice(0, 0, 60, 0); else if (NPC.downedMechBossAny) price += Item.buyPrice(0, 0, 40, 0); diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 05c09d35c1..f72ef2b6a5 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; using CalamityMod.Events; using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.AstralCatches; @@ -18,17 +18,23 @@ using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems; +using Terraria.DataStructures; namespace CalamityMod.CalPlayer { public partial class CalamityPlayer : ModPlayer { #region Catch Fish - public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) + public override void CatchFish(FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition) { - bool water = liquidType == 0; - bool lava = liquidType == 1; - bool honey = liquidType == 2; + int bait = attempt.playerFishingConditions.BaitItemType; + int power = attempt.playerFishingConditions.BaitPower + attempt.playerFishingConditions.PolePower; + int questFish = attempt.questFish; + int poolSize = attempt.waterTilesCount; + bool water = !attempt.inHoney && !attempt.inLava; + bool lava = attempt.inLava; + bool honey = attempt.inHoney; Point point = Player.Center.ToTileCoordinates(); bool canSulphurFish = false; @@ -47,35 +53,35 @@ namespace CalamityMod.CalPlayer canSulphurFish = true; // Old Duke spawn - if (canSulphurFish && bait.type == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) + if (canSulphurFish && bait == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) { - CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait.type); + CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); } // Quest Fish if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } if (ZoneSunkenSea && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } if (ZoneCalamity && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } if (ZoneCalamity && questFish == ModContent.ItemType() && Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } @@ -105,7 +111,7 @@ namespace CalamityMod.CalPlayer fishList.Add(ItemID.ArmoredCavefish); fishList.Add(ItemID.Stinkfish); fishList.Add(ItemID.SpecularFish); - fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHoly); + fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHallow); fishList.AddWithCondition(ItemID.VariegatedLardfish, Player.ZoneJungle); } if (Player.ZoneOverworldHeight || Player.ZoneSkyHeight) @@ -116,8 +122,8 @@ namespace CalamityMod.CalPlayer fishList.AddWithCondition(ItemID.Ebonkoi, Player.ZoneCorrupt); fishList.AddWithCondition(ItemID.CrimsonTigerfish, Player.ZoneCrimson); fishList.AddWithCondition(ItemID.Hemopiranha, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.PrincessFish, Player.ZoneHoly); - fishList.AddWithCondition(ItemID.Prismite, Player.ZoneHoly); + fishList.AddWithCondition(ItemID.PrincessFish, Player.ZoneHallow); + fishList.AddWithCondition(ItemID.Prismite, Player.ZoneHallow); fishList.AddWithCondition(ItemID.Damselfish, Player.ZoneSkyHeight); fishList.AddWithCondition(ModContent.ItemType(), ZoneAstral); fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); @@ -129,7 +135,7 @@ namespace CalamityMod.CalPlayer { int fishAmt = fishList.Count; int caughtFish = fishList[Main.rand.Next(fishAmt)]; - caughtType = caughtFish; + itemDrop = caughtFish; return; } } @@ -170,7 +176,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(chanceForBiomeCrate)) { if (ZoneCalamity) - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } } @@ -222,24 +228,24 @@ namespace CalamityMod.CalPlayer break; } } - if (Player.ZoneSnow && Player.ZoneRockLayerHeight && (Player.ZoneCorrupt || Player.ZoneCrimson || Player.ZoneHoly)) + if (Player.ZoneSnow && Player.ZoneRockLayerHeight && (Player.ZoneCorrupt || Player.ZoneCrimson || Player.ZoneHallow)) { rareItemList.Add(ItemID.ScalyTruffle); } rareItemList.AddWithCondition(ItemID.Toxikarp, Player.ZoneCorrupt); rareItemList.AddWithCondition(ItemID.Bladetongue, Player.ZoneCrimson); - rareItemList.AddWithCondition(ItemID.CrystalSerpent, Player.ZoneHoly); + rareItemList.AddWithCondition(ItemID.CrystalSerpent, Player.ZoneHallow); if (rareItemList.Any()) { int rareItemAmt = rareItemList.Count; int caughtRareItem = rareItemList[Main.rand.Next(rareItemAmt)]; - caughtType = caughtRareItem; + itemDrop = caughtRareItem; } } else if (Main.rand.NextBool(chanceForGoldCrate)) { - caughtType = ItemID.GoldenCrate; + itemDrop = ItemID.GoldenCrate; } else if (Main.rand.NextBool(chanceForBiomeCrate)) { @@ -250,7 +256,7 @@ namespace CalamityMod.CalPlayer biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); biomeCrateList.AddWithCondition(ItemID.CorruptFishingCrate, Player.ZoneCorrupt); biomeCrateList.AddWithCondition(ItemID.CrimsonFishingCrate, Player.ZoneCrimson); - biomeCrateList.AddWithCondition(ItemID.HallowedFishingCrate, Player.ZoneHoly); + biomeCrateList.AddWithCondition(ItemID.HallowedFishingCrate, Player.ZoneHallow); biomeCrateList.AddWithCondition(ItemID.DungeonFishingCrate, Player.ZoneDungeon); biomeCrateList.AddWithCondition(ItemID.JungleFishingCrate, Player.ZoneJungle); biomeCrateList.AddWithCondition(ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); @@ -259,16 +265,16 @@ namespace CalamityMod.CalPlayer { int biomeCrateAmt = biomeCrateList.Count; int caughtBiomeCrate = biomeCrateList[Main.rand.Next(biomeCrateAmt)]; - caughtType = caughtBiomeCrate; + itemDrop = caughtBiomeCrate; } } else if (Main.rand.NextBool(chanceForIronCrate)) { - caughtType = ItemID.IronCrate; + itemDrop = ItemID.IronCrate; } else { - caughtType = ItemID.WoodenCrate; + itemDrop = ItemID.WoodenCrate; } return; } @@ -277,7 +283,7 @@ namespace CalamityMod.CalPlayer if (water) { - if (caughtType == ItemID.WoodenCrate || caughtType == ItemID.IronCrate || caughtType == ItemID.GoldenCrate || caughtType == ItemID.FrogLeg || caughtType == ItemID.BalloonPufferfish || caughtType == ItemID.ZephyrFish) + if (itemDrop == ItemID.WoodenCrate || itemDrop == ItemID.IronCrate || itemDrop == ItemID.GoldenCrate || itemDrop == ItemID.FrogLeg || itemDrop == ItemID.BalloonPufferfish || itemDrop == ItemID.ZephyrFish) { return; } @@ -285,15 +291,15 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } - if (Player.ZoneHoly && Player.ZoneRockLayerHeight && Main.hardMode) + if (Player.ZoneHallow && Player.ZoneRockLayerHeight && Main.hardMode) { if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -301,7 +307,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25)) { - caughtType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); } } @@ -309,7 +315,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(10)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -317,7 +323,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -325,7 +331,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -333,7 +339,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25) && Main.hardMode) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -341,7 +347,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(Main.hardMode ? 100 : 40)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -350,39 +356,39 @@ namespace CalamityMod.CalPlayer int astralFish = Main.rand.Next(100); if (astralFish >= 85) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (astralFish <= 84 && astralFish >= 70) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (astralFish <= 69 && astralFish >= 55) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (Player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (!Player.cratePotion && astralFish <= 13 && astralFish >= 9) // 5% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (astralFish <= 8 && astralFish >= 6) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (astralFish <= 5 && astralFish >= 3) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (astralFish <= 2 && astralFish >= 0) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else // 36% w/o crate pot, 31% w/ crate pot { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } } @@ -392,57 +398,57 @@ namespace CalamityMod.CalPlayer int sunkenFish = Main.rand.Next(100); if (sunkenFish >= 85 && Main.hardMode) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (sunkenFish <= 84 && sunkenFish >= 70) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (sunkenFish <= 69 && sunkenFish >= 55) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (Player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (!Player.cratePotion && sunkenFish <= 13 && sunkenFish >= 9) // 5% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (sunkenFish <= 31 && sunkenFish >= 29) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (sunkenFish <= 8 && sunkenFish >= 6 && Main.hardMode) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (sunkenFish <= 5 && sunkenFish >= 3) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } - else if (sunkenFish <= 2 && sunkenFish >= 0 && CalamityWorld.downedDesertScourge) // 3% + else if (sunkenFish <= 2 && sunkenFish >= 0 && DownedBossSystem.downedDesertScourge) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else // 38% w/o crate pot, 33% w/ crate pot + 18% if prehardmode { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); return; } } - if (Player.FindBuffIndex(BuffID.Gills) > -1 && CalamityWorld.downedCalamitas && Main.rand.NextBool(25)) + if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitas && Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } - if (junk) + if (attempt.common) { if (canSulphurFish) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } return; } @@ -459,10 +465,10 @@ namespace CalamityMod.CalPlayer } switch (Main.rand.Next(4)) { - case 0: caughtType = ModContent.ItemType(); break; //movement acc - case 1: caughtType = ModContent.ItemType(); break; //regen acc - case 2: caughtType = ModContent.ItemType(); break; //defense acc - case 3: caughtType = ModContent.ItemType(); break; //light pet + case 0: itemDrop = ModContent.ItemType(); break; //movement acc + case 1: itemDrop = ModContent.ItemType(); break; //regen acc + case 2: itemDrop = ModContent.ItemType(); break; //defense acc + case 3: itemDrop = ModContent.ItemType(); break; //light pet } return; }*/ @@ -471,11 +477,11 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(15)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } if (Main.rand.NextFloat() < 0.08f) { - caughtType = Utils.SelectRandom(Main.rand, new int[] + itemDrop = Utils.SelectRandom(Main.rand, new int[] { ModContent.ItemType(), ModContent.ItemType() @@ -483,11 +489,11 @@ namespace CalamityMod.CalPlayer } if (Player.cratePotion && Main.rand.NextBool(5)) // 20% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (!Player.cratePotion && Main.rand.NextBool(10)) // 10% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } @@ -495,7 +501,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } } @@ -507,43 +513,43 @@ namespace CalamityMod.CalPlayer int cragFish = Main.rand.Next(100); if (cragFish >= 85) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (cragFish <= 84 && cragFish >= 70) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (cragFish <= 69 && cragFish >= 55) // 15% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (cragFish <= 54 && cragFish >= 41 && Main.hardMode) // 14% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (Player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (!Player.cratePotion && cragFish <= 25 && cragFish >= 21) // 5% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } - else if (cragFish <= 20 && cragFish >= 11 && CalamityWorld.downedProvidence) // 10% + else if (cragFish <= 20 && cragFish >= 11 && DownedBossSystem.downedProvidence) // 10% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (cragFish <= 10 && cragFish >= (Main.hardMode ? 8 : 6)) // 5% (3% hardmode) { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else if (cragFish <= 2 && cragFish >= 0) // 3% { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } else // 32% w/o crate pot, 27% w/ crate pot, add 10% pre-Prov, add another 12% prehardmode { - caughtType = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } } @@ -551,7 +557,7 @@ namespace CalamityMod.CalPlayer #endregion #region Get Fishing Level - public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel) + public override void GetFishingLevel(Item fishingRod, Item bait, ref float fishingLevel) { if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 5589aefa09..7c4d79aaee 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -230,9 +230,9 @@ namespace CalamityMod.CalPlayer Player.lifeRegenTime = 0; lifeRegenLost += 6; - if (CalamityWorld.downedAquaticScourge) + if (DownedBossSystem.downedAquaticScourge) lifeRegenLost += 6; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) lifeRegenLost += 12; } @@ -731,9 +731,9 @@ namespace CalamityMod.CalPlayer (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.01f : 0f) + - (CalamityWorld.downedDoG ? 0.01f : 0f) + - (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 + (DownedBossSystem.downedProvidence ? 0.01f : 0f) + + (DownedBossSystem.downedDoG ? 0.01f : 0f) + + (DownedBossSystem.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); int regenBoost = 1 + (integerTypeBoost / 5); bool lesserEffect = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e4a5ba0fa3..e02623586b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -757,7 +757,7 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % slimeRainRate == 0f) { - if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12)) + if (DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast && Main.rand.NextBool(12)) { NPC.NewNPC((int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); } @@ -875,7 +875,7 @@ namespace CalamityMod.CalPlayer AllCritBoost(critUp); } - bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && CalamityWorld.downedSCal && CalamityWorld.downedExoMechs); + bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs); bool attack = Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out @@ -2643,9 +2643,9 @@ namespace CalamityMod.CalPlayer (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.01f : 0f) + - (CalamityWorld.downedDoG ? 0.01f : 0f) + - (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 + (DownedBossSystem.downedProvidence ? 0.01f : 0f) + + (DownedBossSystem.downedDoG ? 0.01f : 0f) + + (DownedBossSystem.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); int critBoost = integerTypeBoost / 2; float damageBoost = floatTypeBoost * 0.5f; diff --git a/CalamityMod.cs b/CalamityMod.cs index f04548ea0c..6f33279276 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,4 +1,4 @@ -using CalamityMod.Balancing; +using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; @@ -57,6 +57,7 @@ using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using System; using System.Collections.Generic; using System.Diagnostics; @@ -64,6 +65,7 @@ using System.IO; using System.Reflection; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Dyes; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; @@ -84,11 +86,11 @@ namespace CalamityMod public static int sharkKillCount = 0; // Textures - public static Texture2D heartOriginal2; - public static Texture2D heartOriginal; - public static Texture2D rainOriginal; - public static Texture2D manaOriginal; - public static Texture2D carpetOriginal; + public static Asset heartOriginal2; + public static Asset heartOriginal; + public static Asset rainOriginal; + public static Asset manaOriginal; + public static Asset carpetOriginal; public static Texture2D AstralCactusTexture; public static Texture2D AstralCactusGlowTexture; public static Texture2D AstralSky; @@ -141,11 +143,11 @@ namespace CalamityMod Instance = this; // Save vanilla textures. - heartOriginal2 = Main.heartTexture; - heartOriginal = Main.heart2Texture; - rainOriginal = Main.rainTexture; - manaOriginal = Main.manaTexture; - carpetOriginal = Main.flyingCarpetTexture; + heartOriginal2 = TextureAssets.Heart; + heartOriginal = TextureAssets.Heart2; + rainOriginal = TextureAssets.Rain; + manaOriginal = TextureAssets.Mana; + carpetOriginal = TextureAssets.FlyingCarpet; // Apply IL edits instantly afterwards. ILChanges.Load(); @@ -173,12 +175,10 @@ namespace CalamityMod CalamityGlobalItem.LoadTweaks(); // Mount balancing occurs during runtime and is undone when Calamity is unloaded. - Mount.mounts[Mount.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[Mount.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[Mount.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; - Mount.mounts[Mount.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; - - + Mount.mounts[MountID.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[MountID.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[MountID.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[MountID.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; if (!Main.dedServ) { @@ -240,9 +240,9 @@ namespace CalamityMod AddEquipTexture(null, EquipType.Legs, "CirrusDress_Legs", "CalamityMod/Items/Armor/CirrusDress_Legs"); - AstralCactusTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactus"); - AstralCactusGlowTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); - AstralSky = ModContent.Request("CalamityMod/ExtraTextures/AstralSky"); + AstralCactusTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactus", AssetRequestMode.ImmediateLoad).Value; + AstralCactusGlowTexture = ModContent.Request("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow", AssetRequestMode.ImmediateLoad).Value; + AstralSky = ModContent.Request("CalamityMod/ExtraTextures/AstralSky", AssetRequestMode.ImmediateLoad).Value; Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -365,17 +365,17 @@ namespace CalamityMod if (!Main.dedServ) { - Main.heartTexture = heartOriginal2; - Main.heart2Texture = heartOriginal; - Main.rainTexture = rainOriginal; - Main.manaTexture = manaOriginal; - Main.flyingCarpetTexture = carpetOriginal; + TextureAssets.Heart = heartOriginal2; + TextureAssets.Heart2 = heartOriginal; + TextureAssets.Rain = rainOriginal; + TextureAssets.Mana = manaOriginal; + TextureAssets.FlyingCarpet = carpetOriginal; GeneralParticleHandler.Unload(); } - Mount.mounts[Mount.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[Mount.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower; - Mount.mounts[Mount.MinecartMech].dashSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; - Mount.mounts[Mount.MinecartMech].runSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[MountID.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[MountID.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[MountID.MinecartMech].dashSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[MountID.MinecartMech].runSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; heartOriginal2 = null; heartOriginal = null; @@ -418,19 +418,6 @@ namespace CalamityMod } #endregion - #region Fusable Particle Updating - public override void MidUpdateProjectileItem() - { - // Update all fusable particles. - // These are really only visual and as such don't really need any complex netcode. - foreach (BaseFusableParticleSet.FusableParticleRenderCollection particleSet in FusableParticleManager.ParticleSets) - { - foreach (BaseFusableParticleSet.FusableParticle particle in particleSet.ParticleSet.Particles) - particleSet.ParticleSet.UpdateBehavior(particle); - } - } - #endregion - #region Vanilla Enemy DR private void SetupVanillaDR() { @@ -763,7 +750,7 @@ namespace CalamityMod #region Music // This function returns an available Calamity Music Mod track, or null if the Calamity Music Mod is not available. - public int? GetMusicFromMusicMod(string songFilename) => MusicAvailable ? (int?)musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/" + songFilename) : null; + public int? GetMusicFromMusicMod(string songFilename) => MusicAvailable ? MusicLoader.GetMusicSlot(musicMod, "Sounds/Music/" + songFilename) : null; public override void UpdateMusic(ref int music, ref MusicPriority priority) { @@ -772,80 +759,6 @@ namespace CalamityMod if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) { Player p = Main.LocalPlayer; - if (p.InCalamity()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("Crag") ?? MusicID.Eerie; - priority = MusicPriority.Environment; - } - } - if (p.InSunkenSea()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; - priority = MusicPriority.Environment; - } - } - if (p.InAstral(1)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("Astral") ?? MusicID.Space; - priority = MusicPriority.Environment; - } - } - if (p.InAstral(2)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("AstralUnderground") ?? MusicID.Space; - priority = MusicPriority.Environment; - } - } - if (p.InAbyss(1) || p.InAbyss(2)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("Abyss1") ?? MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InAbyss(3)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("Abyss2") ?? MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InAbyss(4)) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - music = GetMusicFromMusicMod("Abyss3") ?? MusicID.Hell; - priority = MusicPriority.BiomeHigh; - } - } - if (p.InSulphur()) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - bool acidRain = CalamityWorld.rainingAcid; - priority = acidRain ? MusicPriority.Event : MusicPriority.BiomeHigh; - - // Acid Rain themes - if (acidRain) - music = CalamityWorld.downedPolterghast - ? GetMusicFromMusicMod("AcidRain2") ?? MusicID.Eclipse // Acid Rain Tier 3 - : GetMusicFromMusicMod("AcidRain1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 - - // Regular Sulphur Sea theme, when Acid Rain is not occurring - else - music = GetMusicFromMusicMod("SulphurousSea") ?? MusicID.Desert; - } - } if (CalamityWorld.DoGSecondStageCountdown <= 530 && CalamityWorld.DoGSecondStageCountdown > 50) // 8 seconds before DoG returns { music = GetMusicFromMusicMod("DevourerOfGodsP2") ?? MusicID.LunarBoss; @@ -866,613 +779,12 @@ namespace CalamityMod } #endregion - #region Lighting Effects - public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) - { - if (Main.gameMenu) - BossRushEvent.StartTimer = 0; - - float bossRushWhiteFade = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; - if (BossRushSky.ShouldDrawRegularly) - bossRushWhiteFade = 1f; - - if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0 || BossRushSky.ShouldDrawRegularly) - { - backgroundColor = Color.Lerp(backgroundColor, Color.LightGray, bossRushWhiteFade); - tileColor = Color.Lerp(tileColor, Color.LightGray, bossRushWhiteFade); - } - else if (SkyManager.Instance["CalamityMod:ExoMechs"].IsActive()) - { - float intensity = SkyManager.Instance["CalamityMod:ExoMechs"].Opacity; - backgroundColor = Color.Lerp(backgroundColor, Color.DarkGray, intensity * 0.9f); - backgroundColor = Color.Lerp(backgroundColor, Color.Black, intensity * 0.67f); - tileColor = Color.Lerp(tileColor, Color.DarkGray, intensity * 0.8f); - tileColor = Color.Lerp(tileColor, Color.Black, intensity * 0.3f); - } - } - #endregion - #region Mod Support public override void PostSetupContent() => WeakReferenceSupport.Setup(); public override object Call(params object[] args) => ModCalls.Call(args); #endregion - #region DrawingStuff - public override void ModifyInterfaceLayers(List layers) - { - int buffDisplayIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Resource Bars"); - if (buffDisplayIndex != -1) - { - layers.Insert(buffDisplayIndex, new LegacyGameInterfaceLayer("Cooldown Rack UI", delegate () - { - CooldownRackUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.UI)); - } - - int mouseIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); - if (mouseIndex != -1) - { - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () - { - if (Main.LocalPlayer.Calamity().drawBossHPBar) - { - BossHealthBarManager.Update(); - BossHealthBarManager.Draw(Main.spriteBatch); - } - return true; - }, InterfaceScaleType.None)); - - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Hologram", () => - { - LabHologramProjectorUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // For these layers, InterfaceScaleType.Game tells the game that this UI should take zoom into account. - // These must be separate layers or they will malfunction when hovering one at non-100% zoom. - - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charging Station UI", () => - { - ChargingStationUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.Game)); - - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Power Cell Factory UI", () => - { - PowerCellFactoryUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.Game)); - - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () - { - if (Main.LocalPlayer.Calamity().drawBossHPBar) - { - BossHealthBarManager.Update(); - BossHealthBarManager.Draw(Main.spriteBatch); - } - return true; - }, InterfaceScaleType.None)); - - // Mode Indicator UI. - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Mode Indicator UI", delegate () - { - ModeIndicatorUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.UI)); - - // Astral Arcanum overlay (if open) - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () - { - AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // Rage and Adrenaline bars - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Rage and Adrenaline UI", delegate () - { - RipperUI.Draw(Main.spriteBatch, Main.LocalPlayer); - return true; - }, InterfaceScaleType.None)); - - // Stealth bar - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Stealth UI", () => - { - StealthUI.Draw(Main.spriteBatch, Main.LocalPlayer); - return true; - }, InterfaceScaleType.None)); - - // Charge meter - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charge UI", () => - { - ChargeMeterUI.Draw(Main.spriteBatch, Main.LocalPlayer); - return true; - }, InterfaceScaleType.None)); - - // Enchantment meters - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Enchantment Meters", () => - { - EnchantmentMetersUI.Draw(Main.spriteBatch, Main.LocalPlayer); - return true; - }, InterfaceScaleType.None)); - - // Calamitas Enchantment UI - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Calamitas Enchantment", () => - { - CalamitasEnchantUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // Codebreaker UI. - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Codebreaker Decryption GUI", () => - { - CodebreakerUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // Popup GUIs. - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => - { - PopupGUIManager.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // Exo Mech selection. - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Exo Mech Selection", () => - { - if (Main.LocalPlayer.Calamity().AbleToSelectExoMech) - ExoMechSelectionUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - - // Defense damage indicator. - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Defense Damage Indicator", () => - { - if (Main.EquipPage != 1 && Main.EquipPage != 2) - DefenseDamageDisplayUI.Draw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - } - - // Invasion UIs. - int invasionIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Diagnose Net"); - if (invasionIndex != -1) - { - layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Calamity Invasion UIs", () => - { - InvasionProgressUIManager.UpdateAndDraw(Main.spriteBatch); - return true; - }, InterfaceScaleType.None)); - } - } - - public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f) - { - return npc.GetAlpha(BuffEffects( - npc, GetLightColor(position != null ? (Vector2)position : npc.Center), - shadowOverride != 0f ? shadowOverride : 0f, effects, npc.poisoned, npc.onFire, npc.onFire2, - Main.player[Main.myPlayer].detectCreature, false, false, false, npc.venom, npc.midas, npc.ichor, - npc.onFrostBurn, false, false, npc.dripping, npc.drippingSlime, npc.loveStruck, npc.stinky) - ); - } - - public static Color GetLightColor(Vector2 position) => Lighting.GetColor((int)(position.X / 16f), (int)(position.Y / 16f)); - - public static Color BuffEffects(Entity codable, Color lightColor, float shadow = 0f, bool effects = true, - bool poisoned = false, bool onFire = false, bool onFire2 = false, bool hunter = false, bool noItems = false, - bool blind = false, bool bleed = false, bool venom = false, bool midas = false, bool ichor = false, - bool onFrostBurn = false, bool burned = false, bool honey = false, bool dripping = false, - bool drippingSlime = false, bool loveStruck = false, bool stinky = false) - { - float cr = 1f; - float cg = 1f; - float cb = 1f; - float ca = 1f; - if (effects && honey && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 152, 0f, 0f, 150, default, 1f); - Main.dust[dustID].velocity.Y = 0.3f; - Main.dust[dustID].velocity.X *= 0.1f; - Main.dust[dustID].scale += Main.rand.Next(3, 4) * 0.1f; - Main.dust[dustID].alpha = 100; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity += codable.velocity * 0.1f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (poisoned) - { - if (effects && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 46, 0f, 0f, 120, default, 0.2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.9f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cr *= 0.65f; - cb *= 0.75f; - } - if (venom) - { - if (effects && Main.rand.NextBool(10)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 171, 0f, 0f, 100, default, 0.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].fadeIn = 1.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.45f; - cr *= 0.75f; - } - if (midas) - { - cb *= 0.3f; - cr *= 0.85f; - } - if (ichor) - { - if (codable is NPC) - { - lightColor = new Color(255, 255, 0, 255); - } - else - { - cb = 0f; - } - } - if (burned) - { - if (effects) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 2f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.75f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - if (codable is Player) - { - cr = 1f; - cb *= 0.6f; - cg *= 0.7f; - } - } - if (onFrostBurn) - { - if (effects) - { - if (Main.rand.Next(4) < 3) - { - int dustID = Dust.NewDust(new Vector2(codable.position.X - 2f, codable.position.Y - 2f), codable.width + 4, codable.height + 4, 135, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 0.1f, 0.6f, 1f); - } - if (codable is Player) - { - cr *= 0.5f; - cg *= 0.7f; - } - } - if (onFire) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 6, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (dripping && shadow == 0f && Main.rand.Next(4) != 0) - { - Vector2 position = codable.position; - position.X -= 2f; - position.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int dustID = Dust.NewDust(position, codable.width + 4, codable.height + 2, 211, 0f, 0f, 50, default, 0.8f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - else - { - int dustID = Dust.NewDust(position, codable.width + 8, codable.height + 8, 211, 0f, 0f, 50, default, 1.1f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 1f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - if (drippingSlime && shadow == 0f) - { - int alpha = 175; - Color newColor = new Color(0, 80, 255, 100); - if (Main.rand.Next(4) != 0) - { - if (Main.rand.NextBool(2)) - { - Vector2 position2 = codable.position; - position2.X -= 2f; - position2.Y -= 2f; - int dustID = Dust.NewDust(position2, codable.width + 4, codable.height + 2, 4, 0f, 0f, alpha, newColor, 1.4f); - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[dustID].alpha += 25; - } - Main.dust[dustID].noLight = true; - Main.dust[dustID].velocity *= 0.2f; - Main.dust[dustID].velocity.Y += 0.2f; - Main.dust[dustID].velocity += codable.velocity; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - cr *= 0.8f; - cg *= 0.8f; - } - if (onFire2) - { - if (effects) - { - if (Main.rand.Next(4) != 0) - { - int dustID = Dust.NewDust(codable.position - new Vector2(2f, 2f), codable.width + 4, codable.height + 4, 75, codable.velocity.X * 0.4f, codable.velocity.Y * 0.4f, 100, default, 3.5f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 1.8f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (Main.rand.NextBool(4)) - { - Main.dust[dustID].noGravity = false; - Main.dust[dustID].scale *= 0.5f; - } - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - Lighting.AddLight((int)(codable.position.X / 16f), (int)(codable.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); - } - if (codable is Player) - { - cb *= 0.6f; - cg *= 0.7f; - } - } - if (noItems) - { - cr *= 0.65f; - cg *= 0.8f; - } - if (blind) - { - cr *= 0.7f; - cg *= 0.65f; - } - if (bleed) - { - bool dead = codable is Player ? ((Player)codable).dead : codable is NPC ? ((NPC)codable).life <= 0 : false; - if (effects && !dead && Main.rand.NextBool(30)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 5, 0f, 0f, 0, default, 1f); - Main.dust[dustID].velocity.Y += 0.5f; - Main.dust[dustID].velocity *= 0.25f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - cg *= 0.9f; - cb *= 0.9f; - } - if (loveStruck && effects && shadow == 0f && Main.instance.IsActive && !Main.gamePaused && Main.rand.NextBool(5)) - { - Vector2 value = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); - value.Normalize(); - value.X *= 0.66f; - int goreID = Gore.NewGore(codable.position + new Vector2(Main.rand.Next(codable.width + 1), Main.rand.Next(codable.height + 1)), value * Main.rand.Next(3, 6) * 0.33f, 331, Main.rand.Next(40, 121) * 0.01f); - Main.gore[goreID].sticky = false; - Main.gore[goreID].velocity *= 0.4f; - Main.gore[goreID].velocity.Y -= 0.6f; - if (codable is Player) - { - Main.playerDrawGore.Add(goreID); - } - } - if (stinky && shadow == 0f) - { - cr *= 0.7f; - cb *= 0.55f; - if (effects && Main.rand.NextBool(5) && Main.instance.IsActive && !Main.gamePaused) - { - Vector2 value2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); - value2.Normalize(); - value2.X *= 0.66f; - value2.Y = Math.Abs(value2.Y); - Vector2 vector = value2 * Main.rand.Next(3, 5) * 0.25f; - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 188, vector.X, vector.Y * 0.5f, 100, default, 1.5f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].velocity.Y -= 0.5f; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - } - lightColor.R = (byte)(lightColor.R * cr); - lightColor.G = (byte)(lightColor.G * cg); - lightColor.B = (byte)(lightColor.B * cb); - lightColor.A = (byte)(lightColor.A * ca); - if (codable is NPC) - { - NPCLoader.DrawEffects((NPC)codable, ref lightColor); - } - if (hunter && (codable is NPC ? ((NPC)codable).lifeMax > 1 : true)) - { - if (effects && !Main.gamePaused && Main.instance.IsActive && Main.rand.NextBool(50)) - { - int dustID = Dust.NewDust(codable.position, codable.width, codable.height, 15, 0f, 0f, 150, default, 0.8f); - Main.dust[dustID].velocity *= 0.1f; - Main.dust[dustID].noLight = true; - if (codable is Player) - { - Main.playerDrawDust.Add(dustID); - } - } - byte colorR = 50, colorG = 255, colorB = 50; - if (codable is NPC && !(((NPC)codable).friendly || ((NPC)codable).catchItem > 0 || (((NPC)codable).damage == 0 && ((NPC)codable).lifeMax == 5))) - { - colorR = 255; - colorG = 50; - } - if (!(codable is NPC) && lightColor.R < 150) - { - lightColor.A = Main.mouseTextColor; - } - if (lightColor.R < colorR) - { - lightColor.R = colorR; - } - if (lightColor.G < colorG) - { - lightColor.G = colorG; - } - if (lightColor.B < colorB) - { - lightColor.B = colorB; - } - } - return lightColor; - } - - public static void DrawTexture(object sb, Texture2D texture, int shader, Entity codable, Color? overrideColor = null, bool drawCentered = false) - { - Color lightColor = overrideColor != null ? (Color)overrideColor : codable is NPC ? GetNPCColor((NPC)codable, codable.Center, false) : codable is Projectile ? ((Projectile)codable).GetAlpha(GetLightColor(codable.Center)) : GetLightColor(codable.Center); - int frameCount = codable is NPC ? Main.npcFrameCount[((NPC)codable).type] : 1; - Rectangle frame = codable is NPC ? ((NPC)codable).frame : new Rectangle(0, 0, texture.Width, texture.Height); - float scale = codable is NPC ? ((NPC)codable).scale : ((Projectile)codable).scale; - float rotation = codable is NPC ? ((NPC)codable).rotation : ((Projectile)codable).rotation; - int spriteDirection = codable is NPC ? ((NPC)codable).spriteDirection : ((Projectile)codable).spriteDirection; - float offsetY = codable is NPC ? ((NPC)codable).gfxOffY : 0f; - DrawTexture(sb, texture, shader, codable.position + new Vector2(0f, offsetY), codable.width, codable.height, scale, rotation, spriteDirection, frameCount, frame, lightColor, drawCentered); - } - - public static void DrawTexture(object sb, Texture2D texture, int shader, Vector2 position, int width, int height, float scale, float rotation, int direction, int framecount, Rectangle frame, Color? overrideColor = null, bool drawCentered = false) - { - Vector2 origin = new Vector2(texture.Width / 2, texture.Height / framecount / 2); - Color lightColor = overrideColor != null ? (Color)overrideColor : GetLightColor(position + new Vector2(width * 0.5f, height * 0.5f)); - if (sb is List) - { - DrawData dd = new DrawData(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0) - { - shader = shader - }; - ((List)sb).Add(dd); - } - else if (sb is SpriteBatch) - { - bool applyDye = shader > 0; - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); - GameShaders.Armor.ApplySecondary(shader, Main.player[Main.myPlayer], null); - } - ((SpriteBatch)sb).Draw(texture, GetDrawPosition(position, origin, width, height, texture.Width, texture.Height, framecount, scale, drawCentered), frame, lightColor, rotation, origin, scale, direction == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); - if (applyDye) - { - ((SpriteBatch)sb).End(); - ((SpriteBatch)sb).Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); - } - } - } - - public static Vector2 GetDrawPosition(Vector2 position, Vector2 origin, int width, int height, int texWidth, int texHeight, int framecount, float scale, bool drawCentered = false) - { - Vector2 screenPos = new Vector2((int)Main.screenPosition.X, (int)Main.screenPosition.Y); - if (drawCentered) - { - Vector2 texHalf = new Vector2(texWidth / 2, texHeight / framecount / 2); - return position + new Vector2(width * 0.5f, height * 0.5f) - (texHalf * scale) + (origin * scale) - screenPos; - } - return position - screenPos + new Vector2(width * 0.5f, height) - new Vector2(texWidth * scale / 2f, texHeight * scale / framecount) + (origin * scale) + new Vector2(0f, 5f); - } - #endregion - #region Recipes public override void AddRecipeGroups() => CalamityRecipes.AddRecipeGroups(); @@ -1510,66 +822,6 @@ namespace CalamityMod } #endregion - #region Lighting - const float MaxSignusDarkness = -0.4f; - const float MaxAbyssDarkness = -0.7f; - public override void ModifyLightingBrightness(ref float scale) - { - // Apply the calculated darkness value for the local player. - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f); - - if (modPlayer.ZoneAbyss) - scale += MaxAbyssDarkness * darkRatio; - - if (CalamityWorld.revenge) - { - if (CalamityGlobalNPC.signus != -1) - { - if (Main.npc[CalamityGlobalNPC.signus].active) - { - if (Vector2.Distance(Main.LocalPlayer.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) - { - float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - - // Reduce the power of Signus darkness based on your light level. - float multiplier = 1f; - switch (modPlayer.GetTotalLightStrength()) - { - case 0: - break; - case 1: - case 2: - multiplier = 0.75f; - break; - case 3: - case 4: - multiplier = 0.5f; - break; - case 5: - case 6: - multiplier = 0.25f; - break; - default: - multiplier = 0f; - break; - } - - // Increased darkness in Death Mode - if (CalamityWorld.death) - multiplier += (1f - multiplier) * 0.1f; - - // Total darkness - float signusDarkness = signusLifeRatio * multiplier; - darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); - scale += MaxSignusDarkness * darkRatio; - } - } - } - } - } - #endregion - #region Stop Rain public static void StopRain() { @@ -1583,32 +835,5 @@ namespace CalamityMod #region Netcode public override void HandlePacket(BinaryReader reader, int whoAmI) => CalamityNetcode.HandlePacket(this, reader, whoAmI); #endregion - - #region Tile Entity Time Handler - public override void MidUpdateTimeWorld() => TileEntityTimeHandler.Update(); - #endregion - - #region Ash Drawing - public override void MidUpdateItemDust() => DeathAshParticle.UpdateAll(); - #endregion Ash Drawing - - #region Post NPC Updating - // TODO - Apply caching to this process. For now most of the looping issues should be eradicated but it can be reduced further. - public override void MidUpdateNPCGore() => CalamityGlobalNPC.ResetTownNPCNameBools(); - #endregion - - #region Speedrun Timer Stopper - public override void PreSaveAndQuit() => SpeedrunTimer?.Stop(); - #endregion - - #region Particles updating - public override void PostUpdateEverything() - { - if (!Main.dedServ) - { - GeneralParticleHandler.Update(); - } - } - #endregion } } diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index dc05c4d9f5..46cb2ba2a3 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -130,9 +130,9 @@ namespace CalamityMod.Events playerCount++; } } - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) return (int)(Math.Log(playerCount + Math.E - 1) * 170f); - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) return (int)(Math.Log(playerCount + Math.E - 1) * 135f); else return (int)(Math.Log(playerCount + Math.E - 1) * 110f); @@ -143,7 +143,7 @@ namespace CalamityMod.Events /// public static void TryStartEvent(bool forceRain = false) { - if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !CalamityWorld.downedAquaticScourge) || BossRushEvent.BossRushActive) + if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !DownedBossSystem.downedAquaticScourge) || BossRushEvent.BossRushActive) return; int playerCount = 0; @@ -252,7 +252,7 @@ namespace CalamityMod.Events } // Summon Old Duke tornado post-Polter as needed - if (CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 1) + if (DownedBossSystem.downedPolterghast && CalamityWorld.acidRainPoints == 1) { if (!NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) @@ -296,8 +296,8 @@ namespace CalamityMod.Events Main.maxRaining = 0f; if (win) { - CalamityWorld.downedEoCAcidRain = true; - CalamityWorld.downedAquaticScourgeAcidRain = CalamityWorld.downedAquaticScourge; + DownedBossSystem.downedEoCAcidRain = true; + DownedBossSystem.downedAquaticScourgeAcidRain = DownedBossSystem.downedAquaticScourge; } CalamityWorld.triedToSummonOldDuke = false; CalamityMod.StopRain(); @@ -338,7 +338,7 @@ namespace CalamityMod.Events { // Attempt to start the acid rain at the 4:29AM. // This does not happen if a player has the Broken Water Filter in use. - bool increasedEventChance = !CalamityWorld.downedEoCAcidRain || (!CalamityWorld.downedAquaticScourgeAcidRain && CalamityWorld.downedAquaticScourge) || (!CalamityWorld.downedBoomerDuke && CalamityWorld.downedPolterghast); + bool increasedEventChance = !DownedBossSystem.downedEoCAcidRain || (!DownedBossSystem.downedAquaticScourgeAcidRain && DownedBossSystem.downedAquaticScourge) || (!DownedBossSystem.downedBoomerDuke && DownedBossSystem.downedPolterghast); if ((int)Main.time == (int)(Main.nightLength - 1f) && !Main.dayTime && Main.rand.NextBool(increasedEventChance ? 3 : 300)) { bool shouldNotStartEvent = false; @@ -360,7 +360,7 @@ namespace CalamityMod.Events } // Attempt to force an Acid Rain immediately after the EoC is dead when someone wanders to the sea. - if (NPC.downedBoss1 && !CalamityWorld.downedEoCAcidRain && !CalamityWorld.forcedRainAlready) + if (NPC.downedBoss1 && !DownedBossSystem.downedEoCAcidRain && !CalamityWorld.forcedRainAlready) { for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { @@ -387,9 +387,9 @@ namespace CalamityMod.Events { Dictionary possibleEnemies = PossibleEnemiesPreHM; - if (CalamityWorld.downedAquaticScourge) + if (DownedBossSystem.downedAquaticScourge) possibleEnemies = PossibleEnemiesAS; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) possibleEnemies = PossibleEnemiesPolter; if (CalamityWorld.rainingAcid) @@ -397,7 +397,7 @@ namespace CalamityMod.Events if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type)) { CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } @@ -405,11 +405,11 @@ namespace CalamityMod.Events // UpdateInvasion incorporates a world sync, so this is indeed synced as a result. Main.rainTime += Main.rand.Next(240, 300 + 1); // Add some time to the rain, so that it doesn't end mid-way. } - Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? PossibleMinibossesPolter : PossibleMinibossesAS; + Dictionary possibleMinibosses = DownedBossSystem.downedPolterghast ? PossibleMinibossesPolter : PossibleMinibossesAS; if (possibleMinibosses.Select(miniboss => miniboss.Key).Contains(npc.type)) { CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } @@ -421,7 +421,7 @@ namespace CalamityMod.Events CalamityWorld.acidRainPoints = (int)MathHelper.Max(0, CalamityWorld.acidRainPoints); // To prevent negative completion ratios - if (CalamityWorld.rainingAcid && CalamityWorld.downedPolterghast && + if (CalamityWorld.rainingAcid && DownedBossSystem.downedPolterghast && npc.type == ModContent.NPCType() && CalamityWorld.acidRainPoints <= 2f) { diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 38a18354b5..6f69e19d46 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe() .AddIngredient() .AddIngredient() - .AddIngredient( + .AddIngredient() .AddIngredient(ItemID.SoulofLight, 2) .AddIngredient(ItemID.SoulofNight, 2) .AddTile(TileID.Anvils) diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index d04c28aa65..085a8635c9 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -53,8 +53,8 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List tooltips) { - bool scal = CalamityWorld.downedSCal; - bool draedon = CalamityWorld.downedExoMechs; + bool scal = DownedBossSystem.downedSCal; + bool draedon = DownedBossSystem.downedExoMechs; if (!scal || !draedon) { string rejectionReason = (!draedon) ? "[c/f05a5a:The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations]" : "[c/f05a5a:The soul within this crystal has been defiled by the powerful magic of a supreme witch]"; //there might be a better way to word the draedon line, not sure diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 47b0c57cb7..2d4f97e447 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1424,11 +1424,11 @@ namespace CalamityMod.Items * Post-Yharon = 4 */ - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) player.statDefense += 3; - else if (CalamityWorld.downedPolterghast || CalamityWorld.downedDoG) + else if (DownedBossSystem.downedPolterghast || DownedBossSystem.downedDoG) player.statDefense += 2; - else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || CalamityWorld.downedProvidence) + else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || DownedBossSystem.downedProvidence) player.statDefense += 1; player.endurance += 0.0025f; @@ -1445,11 +1445,11 @@ namespace CalamityMod.Items * Post-Yharon = 8 */ - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) player.statDefense += 6; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) player.statDefense += 4; - else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedProvidence || DownedBossSystem.downedPolterghast) player.statDefense += 3; else if (NPC.downedGolemBoss || NPC.downedMoonlord) player.statDefense += 2; @@ -1470,13 +1470,13 @@ namespace CalamityMod.Items * Post-Yharon = 11 */ - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) player.statDefense += 8; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) player.statDefense += 6; - else if (CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedPolterghast) player.statDefense += 5; - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) player.statDefense += 4; else if (NPC.downedMoonlord) player.statDefense += 3; @@ -1497,13 +1497,13 @@ namespace CalamityMod.Items * Post-Yharon = 15 */ - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) player.statDefense += 11; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) player.statDefense += 8; - else if (CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedPolterghast) player.statDefense += 6; - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) player.statDefense += 5; else if (NPC.downedMoonlord) player.statDefense += 4; diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 636e9cc583..8891833124 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -262,14 +262,14 @@ namespace CalamityMod.Items case ItemID.HallowedFishingCrate: BlockCrateDrops(); int potion = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.15f, 5, 10); - DropHelper.DropItemCondition(player, potion, CalamityWorld.downedProvidence, 0.1f, 1, 2); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 0.15f, 5, 10); + DropHelper.DropItemCondition(player, potion, DownedBossSystem.downedProvidence, 0.1f, 1, 2); break; case ItemID.DungeonFishingCrate: BlockCrateDrops(); DropHelper.DropItemCondition(player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.1f, 1, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedPolterghast, 0.1f, 1, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 0.1f, 1, 5); break; case ItemID.JungleFishingCrate: @@ -277,15 +277,15 @@ namespace CalamityMod.Items DropHelper.DropItemChance(player, ModContent.ItemType(), 0.2f, 1, 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, CalamityWorld.downedCalamitas || NPC.downedPlantBoss, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, 0.1f, 1, 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedPlantBoss, 0.1f, 1, 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 0.1f, 1, 3); break; case ItemID.FloatingIslandFishingCrate: BlockCrateDrops(); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator, 0.1f, 1, 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); break; diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 451885d1a0..34fdb23eb2 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -50,13 +50,13 @@ namespace CalamityMod.Items.Fishing.AstralCatches DropHelper.DropItem(player, ItemID.FallenStar, 5, 10); DropHelper.DropItemChance(player, ItemID.Meteorite, 0.2f, 10, 20); DropHelper.DropItemChance(player, ItemID.MeteoriteBar, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.2f, 2, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.2f, 10, 20); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.25f, 5, 10); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedStarGod, 0.2f, 10, 20); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedStarGod, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedStarGod, 0.25f, 5, 10); // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.1f, + DropHelper.DropItemFromSetCondition(player, DownedBossSystem.downedAstrageldon, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -83,16 +83,16 @@ namespace CalamityMod.Items.Fishing.AstralCatches DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 0.1f, 1, 3); int healingPotID = ItemID.HealingPotion; int manaPotID = ItemID.ManaPotion; - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { healingPotID = ModContent.ItemType(); manaPotID = ModContent.ItemType(); } - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) { healingPotID = ItemID.SuperHealingPotion; manaPotID = ItemID.SuperManaPotion; diff --git a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs index 244340cd13..d78757754b 100644 --- a/Items/Fishing/BrimstoneCragCatches/Brimlish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Brimlish.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override bool IsAnglerQuestAvailable() { - return CalamityWorld.downedBrimstoneElemental; + return DownedBossSystem.downedBrimstoneElemental; } public override void AnglerQuestChat(ref string description, ref string catchLocation) diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index bb36177725..6d3dd4acf6 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -45,8 +45,8 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DropHelper.DropItem(player, ModContent.ItemType(), 1, 4); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.15f, 2, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence && CalamityWorld.downedPolterghast, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedBrimstoneElemental, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence && DownedBossSystem.downedPolterghast, 0.1f, 1, 3); // Weapons (none) @@ -67,12 +67,12 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DropHelper.DropItemChance(player, ItemID.InfernoPotion, 10, 1, 3); int healingPotID = ItemID.LesserHealingPotion; int manaPotID = ItemID.LesserManaPotion; - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { healingPotID = ModContent.ItemType(); manaPotID = ModContent.ItemType(); } - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) { healingPotID = ItemID.SuperHealingPotion; manaPotID = ItemID.SuperManaPotion; diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index 4d79c621b7..d84aa433d0 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -51,24 +51,24 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedEoCAcidRain, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedEoCAcidRain, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedAquaticScourgeAcidRain, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.2f, 2, 5); DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.1f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedPolterghast && CalamityWorld.downedBoomerDuke, 0.1f, 1, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke, 0.1f, 1, 5); // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedSlimeGod || Main.hardMode, 0.1f, + DropHelper.DropItemFromSetCondition(player, DownedBossSystem.downedSlimeGod || Main.hardMode, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, + DropHelper.DropItemFromSetCondition(player, DownedBossSystem.downedAquaticScourgeAcidRain, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType()); // Equipment - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedSlimeGod || Main.hardMode, 0.25f, + DropHelper.DropItemFromSetCondition(player, DownedBossSystem.downedSlimeGod || Main.hardMode, 0.25f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -102,12 +102,12 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ModContent.ItemType(), 10, 1, 3); int healingPotID = ItemID.LesserHealingPotion; int manaPotID = ItemID.LesserManaPotion; - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { healingPotID = ModContent.ItemType(); manaPotID = ModContent.ItemType(); } - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) { healingPotID = ItemID.SuperHealingPotion; manaPotID = ItemID.SuperManaPotion; diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs index 7d39048b6d..b5662a32b1 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs @@ -1,6 +1,7 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Systems; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -28,12 +29,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool IsAnglerQuestAvailable() { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void AnglerQuestChat(ref string description, ref string catchLocation) { - description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it’s way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; + description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it’s way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; catchLocation = "Caught in the Sunken Sea."; } } diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index 6fc3230c17..5e8e95d56a 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables; using CalamityMod.Items.Potions; @@ -11,6 +11,7 @@ using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -45,12 +46,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches //Modded materials DropHelper.DropItem(player, ModContent.ItemType(), 10, 30); DropHelper.DropItem(player, ModContent.ItemType(), 10, 30); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f, 2, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCLAMHardMode, 0.12f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 5, 10); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedCLAMHardMode, 0.12f, 2, 5); // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAMHardMode, 0.07f, + DropHelper.DropItemFromSetCondition(player, DownedBossSystem.downedCLAMHardMode, 0.07f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -73,12 +74,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion int healingPotID = ItemID.LesserHealingPotion; int manaPotID = ItemID.LesserManaPotion; - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { healingPotID = ModContent.ItemType(); manaPotID = ModContent.ItemType(); } - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) { healingPotID = ItemID.SuperHealingPotion; manaPotID = ItemID.SuperManaPotion; diff --git a/Items/Fishing/SunkenSeaCatches/SurfClam.cs b/Items/Fishing/SunkenSeaCatches/SurfClam.cs index 0cb798181e..1d9b95dab0 100644 --- a/Items/Fishing/SunkenSeaCatches/SurfClam.cs +++ b/Items/Fishing/SunkenSeaCatches/SurfClam.cs @@ -1,6 +1,7 @@ -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; +using CalamityMod.Systems; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool IsAnglerQuestAvailable() { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void AnglerQuestChat(ref string description, ref string catchLocation) diff --git a/Items/Placeables/AstralFossil.cs b/Items/Placeables/AstralFossil.cs index 152ee562fe..3184b67f11 100644 --- a/Items/Placeables/AstralFossil.cs +++ b/Items/Placeables/AstralFossil.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Items.Placeables resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } - else if (CalamityWorld.downedStarGod) + else if (DownedBossSystem.downedStarGod) { resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 2); diff --git a/Items/Placeables/AstralSilt.cs b/Items/Placeables/AstralSilt.cs index 08d2189f28..67b31cde7e 100644 --- a/Items/Placeables/AstralSilt.cs +++ b/Items/Placeables/AstralSilt.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Items.Placeables resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } - else if (CalamityWorld.downedStarGod) + else if (DownedBossSystem.downedStarGod) { resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 2); diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 4bb94e19fa..17f83b87da 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.SummonItems public override void ModifyTooltips(List list) { TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - bool sentinelsNotDefeated = !CalamityWorld.downedSentinel1 || !CalamityWorld.downedSentinel2 || !CalamityWorld.downedSentinel3; + bool sentinelsNotDefeated = !DownedBossSystem.downedSentinel1 || !DownedBossSystem.downedSentinel2 || !DownedBossSystem.downedSentinel3; if (line != null) line.Text = sentinelsNotDefeated ? "WARNING! Some sentinels have not been truly defeated yet and will spawn at full power during this fight!" : ""; diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 89e42cc9a9..c5cea17f5e 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Systems; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index 0946ab4225..098ff6bdf3 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 5, 9); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 25, 35); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 25, 35); // Weapons float w = DropHelper.BagWeaponDropRateFloat; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.1f); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.1f); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence); // Vanity DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge); diff --git a/Items/TreasureBags/CalamitasBag.cs b/Items/TreasureBags/CalamitasBag.cs index d8e08423a8..8e3e5667cc 100644 --- a/Items/TreasureBags/CalamitasBag.cs +++ b/Items/TreasureBags/CalamitasBag.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ModContent.ItemType(), 14, 18); DropHelper.DropItem(player, ModContent.ItemType(), 1, 3); DropHelper.DropItem(player, ModContent.ItemType(), 5, 9); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 35, 45); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence, 35, 45); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/TreasureBags/DraedonTreasureBag.cs b/Items/TreasureBags/DraedonTreasureBag.cs index a508b00b83..143d2d512e 100644 --- a/Items/TreasureBags/DraedonTreasureBag.cs +++ b/Items/TreasureBags/DraedonTreasureBag.cs @@ -47,21 +47,21 @@ namespace CalamityMod.Items.TreasureBags // Weapons // Higher chance due to how the drops work float w = DropHelper.BagWeaponDropRateFloat * 2f; - if (CalamityWorld.downedAres) + if (DownedBossSystem.downedAres) { DropHelper.DropEntireWeightedSet(player, DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); } - if (CalamityWorld.downedThanatos) + if (DownedBossSystem.downedThanatos) { DropHelper.DropEntireWeightedSet(player, DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); } - if (CalamityWorld.downedArtemisAndApollo) + if (DownedBossSystem.downedArtemisAndApollo) { DropHelper.DropEntireWeightedSet(player, DropHelper.WeightStack(w), @@ -76,16 +76,16 @@ namespace CalamityMod.Items.TreasureBags // Vanity // Higher chance due to how the drops work float maskDropRate = 1f / 3.5f; - if (CalamityWorld.downedThanatos) + if (DownedBossSystem.downedThanatos) DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); - if (CalamityWorld.downedArtemisAndApollo) + if (DownedBossSystem.downedArtemisAndApollo) { DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); } - if (CalamityWorld.downedAres) + if (DownedBossSystem.downedAres) DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); DropHelper.DropItemChance(player, ModContent.ItemType(), maskDropRate); diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 42b408eb12..6cdd48ac50 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.TreasureBags player.TryGettingDevArmor(player.GetItemSource_OpenItem(Item.type)); // Materials - DropHelper.DropItemCondition(player, ModContent.ItemType(), !CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, ModContent.ItemType(), !DownedBossSystem.downedProvidence); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence); // Weapons float w = DropHelper.BagWeaponDropRateFloat; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(player, ModContent.ItemType(), DownedBossSystem.downedProvidence); DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().rageBoostTwo); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.1f); diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 48afdab4cb..bae859bd45 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.ownedProjectileCounts[Item.shoot] > 0) return false; - return CalamityWorld.downedYharon || player.name == "Jetstream Sam" || player.name == "Samuel Rodrigues"; + return DownedBossSystem.downedYharon || player.name == "Jetstream Sam" || player.name == "Samuel Rodrigues"; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 43c11cd18e..85f62321c6 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -1,9 +1,10 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Particles; using CalamityMod.Projectiles; +using CalamityMod.Systems; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; @@ -40,25 +41,25 @@ namespace CalamityMod case "acid rain eoc": case "acidrain eoc": case "acidraineoc": - return CalamityWorld.downedEoCAcidRain; + return DownedBossSystem.downedEoCAcidRain; case "desertscourge": case "desert scourge": - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; case "clam": case "giantclam": case "giant clam": - return CalamityWorld.downedCLAM; + return DownedBossSystem.downedCLAM; case "crabulon": - return CalamityWorld.downedCrabulon; + return DownedBossSystem.downedCrabulon; case "hivemind": case "hive mind": case "thehivemind": case "the hive mind": - return CalamityWorld.downedHiveMind; + return DownedBossSystem.downedHiveMind; case "perforator": case "perforators": @@ -68,13 +69,13 @@ namespace CalamityMod case "perforator hive": case "theperforatorhive": case "the perforator hive": - return CalamityWorld.downedPerforator; + return DownedBossSystem.downedPerforator; case "slimegod": case "slime god": case "theslimegod": case "the slime god": - return CalamityWorld.downedSlimeGod; + return DownedBossSystem.downedSlimeGod; case "hmclam": case "clamhm": @@ -88,10 +89,10 @@ namespace CalamityMod case "hardmode clam": case "hardmodegiantclam": case "hardmode giant clam": - return CalamityWorld.downedCLAMHardMode; + return DownedBossSystem.downedCLAMHardMode; case "cryogen": - return CalamityWorld.downedCryogen; + return DownedBossSystem.downedCryogen; case "acid rain 2": case "acidrain 2": @@ -104,15 +105,15 @@ namespace CalamityMod case "acidrain aquaticscourge": case "acidrainscourge": case "acidrainaquaticscourge": - return CalamityWorld.downedAquaticScourgeAcidRain; + return DownedBossSystem.downedAquaticScourgeAcidRain; case "aquaticscourge": case "aquatic scourge": - return CalamityWorld.downedAquaticScourge; + return DownedBossSystem.downedAquaticScourge; case "brimstoneelemental": case "brimstone elemental": - return CalamityWorld.downedBrimstoneElemental; + return DownedBossSystem.downedBrimstoneElemental; case "calamitas": case "clone": @@ -121,12 +122,12 @@ namespace CalamityMod case "clonelamitas": case "calamitasdoppelganger": case "calamitas doppelganger": - return CalamityWorld.downedCalamitas; + return DownedBossSystem.downedCalamitas; case "gss": case "greatsandshark": case "great sand shark": - return CalamityWorld.downedGSS; + return DownedBossSystem.downedGSS; // Don't remove the old references to "Siren" here to avoid breaking other mods case "sirenleviathan": @@ -146,12 +147,12 @@ namespace CalamityMod case "anahitaandleviathan": case "anahita and leviathan": case "anahita and the leviathan": - return CalamityWorld.downedLeviathan; + return DownedBossSystem.downedLeviathan; case "aureus": case "astrumaureus": case "astrum aureus": - return CalamityWorld.downedAstrageldon; + return DownedBossSystem.downedAstrageldon; case "pbg": case "plaguebringer": @@ -159,17 +160,17 @@ namespace CalamityMod case "plaguebringer goliath": case "theplaguebringergoliath": case "the plaguebringer goliath": - return CalamityWorld.downedPlaguebringer; + return DownedBossSystem.downedPlaguebringer; case "scavenger": // backwards compatibility case "ravager": - return CalamityWorld.downedScavenger; + return DownedBossSystem.downedScavenger; case "stargod": // backwards compatibility case "star god": // backwards compatibility case "astrumdeus": case "astrum deus": - return CalamityWorld.downedStarGod; + return DownedBossSystem.downedStarGod; case "guardians": case "donuts": @@ -177,24 +178,24 @@ namespace CalamityMod case "profaned guardians": case "theprofanedguardians": case "the profaned guardians": - return CalamityWorld.downedGuardians; + return DownedBossSystem.downedGuardians; case "dragonfolly": case "the dragonfolly": case "bumblebirb": case "bumblefuck": - return CalamityWorld.downedBumble; + return DownedBossSystem.downedBumble; case "providence": case "providencetheprofanedgoddess": case "providence the profaned goddess": case "providence, the profaned goddess": - return CalamityWorld.downedProvidence; + return DownedBossSystem.downedProvidence; case "polterghast": case "necroghast": case "necroplasm": - return CalamityWorld.downedPolterghast; + return DownedBossSystem.downedPolterghast; // Old Duke is also Acid Rain tier 3, so he gets those names too case "oldduke": @@ -213,18 +214,18 @@ namespace CalamityMod case "acid rain duke": case "acidrain duke": case "acidrainduke": - return CalamityWorld.downedBoomerDuke; + return DownedBossSystem.downedBoomerDuke; case "sentinel1": // backwards compatibility case "void": case "ceaselessvoid": case "ceaseless void": - return CalamityWorld.downedSentinel1; + return DownedBossSystem.downedSentinel1; case "sentinel2": // backwards compatibility case "stormweaver": case "storm weaver": - return CalamityWorld.downedSentinel2; + return DownedBossSystem.downedSentinel2; case "sentinel3": // backwards compatibility case "cosmicwraith": @@ -233,7 +234,7 @@ namespace CalamityMod case "signusenvoyofthedevourer": case "signus envoy of the devourer": case "signus, envoy of the devourer": - return CalamityWorld.downedSentinel3; + return DownedBossSystem.downedSentinel3; case "sentinelany": // backwards compatibility case "anysentinel": @@ -241,27 +242,27 @@ namespace CalamityMod case "onesentinel": case "one sentinel": case "sentinel": - return CalamityWorld.downedSentinel1 || CalamityWorld.downedSentinel2 || CalamityWorld.downedSentinel3; + return DownedBossSystem.downedSentinel1 || DownedBossSystem.downedSentinel2 || DownedBossSystem.downedSentinel3; case "sentinelall": // backwards compatibility case "sentinels": case "allsentinel": case "allsentinels": case "all sentinels": - return CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + return DownedBossSystem.downedSentinel1 && DownedBossSystem.downedSentinel2 && DownedBossSystem.downedSentinel3; case "dog": case "devourerofgods": case "devourer of gods": case "thedevourerofgods": case "the devourer of gods": - return CalamityWorld.downedDoG; + return DownedBossSystem.downedDoG; case "yharon": case "jungledragonyharon": case "jungle dragon yharon": case "jungle dragon, yharon": - return CalamityWorld.downedYharon; + return DownedBossSystem.downedYharon; case "draedon": case "exomechs": @@ -271,12 +272,12 @@ namespace CalamityMod case "artemis": case "thanatos": case "ares": - return CalamityWorld.downedExoMechs; + return DownedBossSystem.downedExoMechs; case "scal": case "supremecalamitas": case "supreme calamitas": - return CalamityWorld.downedSCal; + return DownedBossSystem.downedSCal; case "adulteidolonwyrm": case "adult eidolon wyrm": @@ -284,7 +285,7 @@ namespace CalamityMod case "adult wyrm": case "adulteidolon": case "adult eidolon": - return CalamityWorld.downedAdultEidolonWyrm; + return DownedBossSystem.downedAdultEidolonWyrm; } } #endregion diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 6d825ef3d2..b3f9bcda8e 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -79,38 +79,38 @@ namespace CalamityMod { internal class Downed { - public static readonly Func DownedDesertScourge = () => CalamityWorld.downedDesertScourge; - public static readonly Func DownedGiantClam = () => CalamityWorld.downedCLAM; - public static readonly Func DownedCrabulon = () => CalamityWorld.downedCrabulon; - public static readonly Func DownedHiveMind = () => CalamityWorld.downedHiveMind; - public static readonly Func DownedPerfs = () => CalamityWorld.downedPerforator; - public static readonly Func DownedSlimeGod = () => CalamityWorld.downedSlimeGod; - public static readonly Func DownedCryogen = () => CalamityWorld.downedCryogen; - public static readonly Func DownedBrimstoneElemental = () => CalamityWorld.downedBrimstoneElemental; - public static readonly Func DownedAquaticScourge = () => CalamityWorld.downedAquaticScourge; - public static readonly Func DownedCalamitas = () => CalamityWorld.downedCalamitas; - public static readonly Func DownedGSS = () => CalamityWorld.downedGSS; - public static readonly Func DownedLeviathan = () => CalamityWorld.downedLeviathan; - public static readonly Func DownedAureus = () => CalamityWorld.downedAstrageldon; - public static readonly Func DownedPBG = () => CalamityWorld.downedPlaguebringer; - public static readonly Func DownedRavager = () => CalamityWorld.downedScavenger; - public static readonly Func DownedDeus = () => CalamityWorld.downedStarGod; - public static readonly Func DownedGuardians = () => CalamityWorld.downedGuardians; - public static readonly Func DownedBirb = () => CalamityWorld.downedBumble; - public static readonly Func DownedProvidence = () => CalamityWorld.downedProvidence; - public static readonly Func DownedCeaselessVoid = () => CalamityWorld.downedSentinel1; - public static readonly Func DownedStormWeaver = () => CalamityWorld.downedSentinel2; - public static readonly Func DownedSignus = () => CalamityWorld.downedSentinel3; - public static readonly Func DownedPolterghast = () => CalamityWorld.downedPolterghast; - public static readonly Func DownedBoomerDuke = () => CalamityWorld.downedBoomerDuke; - public static readonly Func DownedDoG = () => CalamityWorld.downedDoG; - public static readonly Func DownedYharon = () => CalamityWorld.downedYharon; - public static readonly Func DownedExoMechs = () => CalamityWorld.downedExoMechs; - public static readonly Func DownedSCal = () => CalamityWorld.downedSCal; - public static readonly Func DownedAdultEidolonWyrm = () => CalamityWorld.downedAdultEidolonWyrm; + public static readonly Func DownedDesertScourge = () => DownedBossSystem.downedDesertScourge; + public static readonly Func DownedGiantClam = () => DownedBossSystem.downedCLAM; + public static readonly Func DownedCrabulon = () => DownedBossSystem.downedCrabulon; + public static readonly Func DownedHiveMind = () => DownedBossSystem.downedHiveMind; + public static readonly Func DownedPerfs = () => DownedBossSystem.downedPerforator; + public static readonly Func DownedSlimeGod = () => DownedBossSystem.downedSlimeGod; + public static readonly Func DownedCryogen = () => DownedBossSystem.downedCryogen; + public static readonly Func DownedBrimstoneElemental = () => DownedBossSystem.downedBrimstoneElemental; + public static readonly Func DownedAquaticScourge = () => DownedBossSystem.downedAquaticScourge; + public static readonly Func DownedCalamitas = () => DownedBossSystem.downedCalamitas; + public static readonly Func DownedGSS = () => DownedBossSystem.downedGSS; + public static readonly Func DownedLeviathan = () => DownedBossSystem.downedLeviathan; + public static readonly Func DownedAureus = () => DownedBossSystem.downedAstrageldon; + public static readonly Func DownedPBG = () => DownedBossSystem.downedPlaguebringer; + public static readonly Func DownedRavager = () => DownedBossSystem.downedScavenger; + public static readonly Func DownedDeus = () => DownedBossSystem.downedStarGod; + public static readonly Func DownedGuardians = () => DownedBossSystem.downedGuardians; + public static readonly Func DownedBirb = () => DownedBossSystem.downedBumble; + public static readonly Func DownedProvidence = () => DownedBossSystem.downedProvidence; + public static readonly Func DownedCeaselessVoid = () => DownedBossSystem.downedSentinel1; + public static readonly Func DownedStormWeaver = () => DownedBossSystem.downedSentinel2; + public static readonly Func DownedSignus = () => DownedBossSystem.downedSentinel3; + public static readonly Func DownedPolterghast = () => DownedBossSystem.downedPolterghast; + public static readonly Func DownedBoomerDuke = () => DownedBossSystem.downedBoomerDuke; + public static readonly Func DownedDoG = () => DownedBossSystem.downedDoG; + public static readonly Func DownedYharon = () => DownedBossSystem.downedYharon; + public static readonly Func DownedExoMechs = () => DownedBossSystem.downedExoMechs; + public static readonly Func DownedSCal = () => DownedBossSystem.downedSCal; + public static readonly Func DownedAdultEidolonWyrm = () => DownedBossSystem.downedAdultEidolonWyrm; - public static readonly Func DownedAcidRainInitial = () => CalamityWorld.downedEoCAcidRain; - public static readonly Func DownedAcidRainHardmode = () => CalamityWorld.downedAquaticScourgeAcidRain; + public static readonly Func DownedAcidRainInitial = () => DownedBossSystem.downedEoCAcidRain; + public static readonly Func DownedAcidRainHardmode = () => DownedBossSystem.downedAquaticScourgeAcidRain; } internal class WeakReferenceSupport diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index f794164b19..3a6bc58e2b 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 20); int minCells = Main.expertMode ? 7 : 5; int maxCells = Main.expertMode ? 10 : 7; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 03c16f5a6e..b7011f7733 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -241,8 +241,8 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 7 : 5; int maxCells = Main.expertMode ? 10 : 7; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 3, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 85d14311e9..00fba2df9b 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -554,8 +554,8 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItem(NPC, ItemID.BlackInk, 3, 5); int minCells = Main.expertMode ? 31 : 26; int maxCells = Main.expertMode ? 45 : 38; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 3, 1, 1); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10, 1, 1); } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index b8f4b4fad4..7f359aceb4 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -303,10 +303,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 4db6bef6c1..2c18bfc730 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -303,10 +303,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index f941800b22..4c30f9df49 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -496,12 +496,12 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { DropHelper.DropItem(NPC, ModContent.ItemType(), 30, 40); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 10, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 10, 1, 1); int minLumenyl = Main.expertMode ? 8 : 6; int maxLumenyl = Main.expertMode ? 11 : 8; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 1f, minLumenyl, maxLumenyl); DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 8, 12); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index b3f692cf38..9d1bb6b870 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -249,10 +249,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 3 : 2; int maxCells = Main.expertMode ? 6 : 4; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); int inkBombDropRate = Main.expertMode ? 25 : 40; DropHelper.DropItemChance(NPC, ModContent.ItemType(), inkBombDropRate, 1, 1); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index e93a3e383f..29285b876e 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -339,10 +339,10 @@ namespace CalamityMod.NPCs.Abyss { int minLumenyl = Main.expertMode ? 3 : 2; int maxLumenyl = Main.expertMode ? 4 : 3; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minLumenyl, maxLumenyl); int minCells = Main.expertMode ? 8 : 6; int maxCells = Main.expertMode ? 11 : 8; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 01ee19e89b..cab04dbb2f 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -113,7 +113,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 19cffb8f9b..c849e3aef2 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -289,10 +289,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { DropHelper.DropItem(NPC, ModContent.ItemType(), 8, 15); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 533684f0b8..8af6d01d4e 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -206,7 +206,7 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItemCondition(NPC, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); int minCells = Main.expertMode ? 10 : 5; int maxCells = Main.expertMode ? 14 : 7; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 5 : 7); diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 3d9790f7ba..48fe61db13 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -301,7 +301,7 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 4 : 3; int maxCells = Main.expertMode ? 7 : 5; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 1c4be6c7cb..e7e926bf24 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -653,10 +653,10 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); int minCells = Main.expertMode ? 14 : 10; int maxCells = Main.expertMode ? 22 : 17; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 1f, 3, 4); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - if (CalamityWorld.downedPolterghast) + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 1f, 3, 4); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast, 3, 1, 1); + if (DownedBossSystem.downedPolterghast) { DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 704644c86a..cff8d6f463 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.Abyss { int minCells = Main.expertMode ? 4 : 2; int maxCells = Main.expertMode ? 6 : 3; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 015e714359..9ba890b20b 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -116,10 +116,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.25f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.25f); int minCells = Main.expertMode ? 2 : 1; int maxCells = Main.expertMode ? 3 : 2; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, minCells, maxCells); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 0.5f, minCells, maxCells); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index f95fd946c3..fde0b12b99 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 4; NPC.knockBackResist = 0.9f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.DR_NERD(0.05f); NPC.damage = 100; @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 20; NPC.knockBackResist = 0.7f; } - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 50; NPC.lifeMax = 240; @@ -91,9 +91,9 @@ namespace CalamityMod.NPCs.AcidRain public void SwimTowardsTarget() { float swimSpeed = 12f; - if (CalamityWorld.downedAquaticScourge) + if (DownedBossSystem.downedAquaticScourge) swimSpeed += 3f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) swimSpeed += 4f; // Swim upwards if sufficiently under water. @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAquaticScourge, 0.05f); } public override void FindFrame(int frameHeight) diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index a9d55cf473..d9b4696d9d 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.AcidRain get { float phase2CeilingRatio = CalamityWorld.revenge ? 0.85f : 0.7f; - return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && CalamityWorld.downedPolterghast; + return NPC.life / (float)NPC.lifeMax < phase2CeilingRatio && DownedBossSystem.downedPolterghast; } } @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 4000; NPC.defense = 25; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 160; NPC.lifeMax = 80630; @@ -128,7 +128,7 @@ namespace CalamityMod.NPCs.AcidRain int spikesPerBurst = 5; float burstSpeed = 8f; int burstShootRate = 92; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { spikesPerBurst += 3; burstSpeed += 3.25f; @@ -166,7 +166,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = CalamityWorld.downedPolterghast ? 52 : 33; + int damage = DownedBossSystem.downedPolterghast ? 52 : 33; float shootOffsetAngle = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < spikesPerBurst; i++) { @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.AcidRain float slamAcceleration = 0.375f; float maxSlamSpeed = 19f; int slamCount = 2; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { opacityFadeoutIncrement += 0.03f; slamAcceleration += 0.07f; @@ -272,7 +272,7 @@ namespace CalamityMod.NPCs.AcidRain SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int nukeDamage = CalamityWorld.downedPolterghast ? 72 : 38; + int nukeDamage = DownedBossSystem.downedPolterghast ? 72 : 38; int dropletDamage = (int)(nukeDamage * 0.6f); int explosion = Projectile.NewProjectile(NPC.Center, Vector2.Zero, ModContent.ProjectileType(), nukeDamage, 0f); if (Main.projectile.IndexInRange(explosion)) @@ -312,7 +312,7 @@ namespace CalamityMod.NPCs.AcidRain float digReapperSpeed = 4f; int chargeupTelegraphTime = 60; float opacityFadeoutIncrement = 0.025f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { opacityFadeoutIncrement += 0.025f; chargeupTelegraphTime -= 15; @@ -398,7 +398,7 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { - int laserbeamDamage = CalamityWorld.downedPolterghast ? 120 : 40; + int laserbeamDamage = DownedBossSystem.downedPolterghast ? 120 : 40; Projectile.NewProjectile(NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), laserbeamDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } @@ -447,10 +447,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = (int)(NPC.damage * 0.85f); } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire"); - CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, NPC.GetAlpha(drawColor), true); + Texture2D texture = InPhase2 ? ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire2").Value : ModContent.Request("CalamityMod/NPCs/AcidRain/CragmawMire").Value; + Main.EntitySpriteDraw(texture, screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } @@ -479,8 +479,8 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); - DropHelper.DropItemChance(NPC, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast ? 0.1f : 1f); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), DownedBossSystem.downedPolterghast ? 0.1f : 1f); } } } diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index 0b3d21abf1..c71d999999 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.AcidRain public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !DownedBossSystem.downedAquaticScourge) { return 0f; } diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index cf1554ea18..3ff6696254 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.aiStyle = AIType = -1; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.lifeMax = 4125; NPC.DR_NERD(0.2f); @@ -147,10 +147,10 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode == NetmodeID.MultiplayerClient) return; - float speed = CalamityWorld.downedPolterghast ? 29f : 17f; + float speed = DownedBossSystem.downedPolterghast ? 29f : 17f; speed *= Main.rand.NextFloat(0.8f, 1.2f); - int damage = Main.expertMode ? CalamityWorld.downedPolterghast ? 32 : 18 : CalamityWorld.downedPolterghast ? 42 : 23; + int damage = Main.expertMode ? DownedBossSystem.downedPolterghast ? 32 : 18 : DownedBossSystem.downedPolterghast ? 42 : 23; Vector2 spawnPosition = NPC.Top + Vector2.UnitY * 6f; Vector2 shootVelocity = (closestTargetToTop.Center - spawnPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.25f) * speed; Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 2f); @@ -169,7 +169,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (DownedBossSystem.downedPolterghast ? 5 : 1), 1, 3); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.05f); } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index cf0688dac8..d0d458b1e5 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -35,13 +35,13 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 60; NPC.defense = 3; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 80; NPC.lifeMax = 2750; NPC.defense = 15; } - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 35; NPC.lifeMax = 200; @@ -92,8 +92,8 @@ namespace CalamityMod.NPCs.AcidRain if (Main.rand.NextBool(480)) SoundEngine.PlaySound(SoundID.Zombie, NPC.Center, 13); - float explodeDistance = CalamityWorld.downedAquaticScourge ? 295f : 195f; - if (CalamityWorld.downedPolterghast) + float explodeDistance = DownedBossSystem.downedAquaticScourge ? 295f : 195f; + if (DownedBossSystem.downedPolterghast) explodeDistance = 470f; // Explode if a player gets too close. @@ -101,9 +101,9 @@ namespace CalamityMod.NPCs.AcidRain { if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = Main.expertMode ? CalamityWorld.downedAquaticScourge ? 21 : 8 : CalamityWorld.downedAquaticScourge ? 27 : 10; + int damage = Main.expertMode ? DownedBossSystem.downedAquaticScourge ? 21 : 8 : DownedBossSystem.downedAquaticScourge ? 27 : 10; float speed = Main.rand.NextFloat(6f, 9f); - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { speed *= 1.8f; damage = Main.expertMode ? 36 : 45; @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; + float dropChance = DownedBossSystem.downedAquaticScourge ? 0.01f : 0.05f; DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 2a0051dc1c..567a3ffa9a 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 15; NPC.DR_NERD(0.075f); - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 120; NPC.lifeMax = 3850; @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.AcidRain { Time++; NPC.TargetClosest(false); - float maxSpeed = CalamityWorld.downedPolterghast ? 12.8f : 10.5f; + float maxSpeed = DownedBossSystem.downedPolterghast ? 12.8f : 10.5f; if (!Main.player.IndexInRange(NPC.target)) return; @@ -125,7 +125,7 @@ namespace CalamityMod.NPCs.AcidRain // And jump/shoot. else if (Time % 220f > 180f) { - float verticalAcceleration = CalamityWorld.downedPolterghast ? 0.07f : 0.05f; + float verticalAcceleration = DownedBossSystem.downedPolterghast ? 0.07f : 0.05f; if (Time % 220f < 200f) NPC.velocity.Y -= verticalAcceleration; else @@ -161,12 +161,12 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.spriteDirection == -1) spitDirection += MathHelper.PiOver2; - int damage = CalamityWorld.downedPolterghast ? 40 : CalamityWorld.downedAquaticScourge ? 26 : 18; + int damage = DownedBossSystem.downedPolterghast ? 40 : DownedBossSystem.downedAquaticScourge ? 26 : 18; if (Main.expertMode) damage = (int)Math.Round(damage * 0.8); // Spit two extra streams of acid at the target post-Polterghast. - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { for (int i = 0; i < 2; i++) { @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (DownedBossSystem.downedPolterghast ? 5 : 1), 1, 3); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 20); } diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index f7867a7a27..4ab22c55b5 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -27,13 +27,13 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 5; NPC.lifeMax = 50; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 60; NPC.lifeMax = 3250; NPC.defense = 20; } - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 30; NPC.lifeMax = 130; @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.AcidRain { player.AddBuff(ModContent.BuffType(), 3, false); player.AddBuff(BuffID.Poisoned, 2, false); - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { player.AddBuff(ModContent.BuffType(), 3, false); player.AddBuff(BuffID.Venom, 2, false); diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 5d63fb4fa7..9537d6903e 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 6; NPC.knockBackResist = 1f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.knockBackResist = 0.8f; NPC.damage = 88; @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 18; NPC.DR_NERD(0.05f); } - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 38; NPC.lifeMax = 220; @@ -99,9 +99,9 @@ namespace CalamityMod.NPCs.AcidRain // Charge once sufficiently slowed down. float chargeSpeed = 11.5f; - if (CalamityWorld.downedAquaticScourge) + if (DownedBossSystem.downedAquaticScourge) chargeSpeed += 4f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) chargeSpeed += 3.5f; if (NPC.velocity.Length() < 1.25f) { @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { DropHelper.DropItemChance(NPC, ModContent.ItemType(), 2, 1, 3); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAquaticScourge, 0.05f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 1c6bda239c..1658e9275f 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 280; NPC.defense = 3; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 85; NPC.lifeMax = 3850; @@ -140,8 +140,8 @@ namespace CalamityMod.NPCs.AcidRain NPC.knockBackResist = 0.5f; NPC.DR_NERD(0f); - float flySpeed = CalamityWorld.downedPolterghast ? 17f : 14f; - float flyInertia = CalamityWorld.downedPolterghast ? 20f : 24.5f; + float flySpeed = DownedBossSystem.downedPolterghast ? 17f : 14f; + float flyInertia = DownedBossSystem.downedPolterghast ? 20f : 24.5f; // Fly more sharply if close to the target. if (NPC.WithinRange(Target.Center, 200f)) @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (DownedBossSystem.downedPolterghast ? 5 : 1), 1, 3); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 20); } diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 9d55405aec..df855da144 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 15; NPC.DR_NERD(0.25f); - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.damage = 80; NPC.lifeMax = 4125; @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.velocity.Length() < MinSpeedLungePrompt) { NPC.TargetClosest(); - float lungeSpeed = CalamityWorld.downedPolterghast ? 18.5f : 15f; + float lungeSpeed = DownedBossSystem.downedPolterghast ? 18.5f : 15f; NPC.velocity = NPC.SafeDirectionTo(Target.Center, -Vector2.UnitY) * lungeSpeed; NPC.velocity.X *= 1.6f; @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.AcidRain { float speedX = 18f; float speedY = 9f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { speedX = 22f; speedY = 11f; @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (CalamityWorld.downedPolterghast ? 5 : 1), 1, 3); + DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3 * (DownedBossSystem.downedPolterghast ? 5 : 1), 1, 3); } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.AcidRain if (SpikeShootCountdown <= 0f) { SoundEngine.PlaySound(SoundID.NPCDeath11, NPC.Center); - int projDamage = CalamityWorld.downedPolterghast ? 35 : CalamityWorld.downedAquaticScourge ? 29 : 21; + int projDamage = DownedBossSystem.downedPolterghast ? 35 : DownedBossSystem.downedAquaticScourge ? 29 : 21; if (Main.expertMode) projDamage = (int)Math.Round(projDamage * 0.8); diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index 1ac58ffad3..142bf76157 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -37,12 +37,12 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 30; NPC.damage = 0; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { NPC.lifeMax = 1235; NPC.defense = 10; } - else if (CalamityWorld.downedAquaticScourge) + else if (DownedBossSystem.downedAquaticScourge) NPC.lifeMax = 90; NPC.value = Item.buyPrice(0, 0, 2, 5); @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.AcidRain { float swimSpeed = Target.wet ? 23f : 17f; float swimIntertia = 24f; - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { swimSpeed *= 1.6f; swimIntertia = 17f; @@ -208,7 +208,7 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() { - float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; + float dropChance = DownedBossSystem.downedAquaticScourge ? 0.01f : 0.05f; DropHelper.DropItemChance(NPC, ModContent.ItemType(), dropChance); } } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs index eb6439fc08..4f09cc647d 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs @@ -1349,11 +1349,11 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm int minLumenyl = Main.expertMode ? 65 : 50; int maxLumenyl = Main.expertMode ? 135 : 108; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 1f, minLumenyl, maxLumenyl); DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); // Mark Adult Eidolon Wyrm as defeated - CalamityWorld.downedAdultEidolonWyrm = true; + DownedBossSystem.downedAdultEidolonWyrm = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 206ea72bbd..c28dbb0882 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -195,10 +195,10 @@ namespace CalamityMod.NPCs.AquaticScourge DropHelper.DropItem(NPC, ItemID.GreaterHealingPotion, 8, 14); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAquaticScourge); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedAquaticScourge); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedAquaticScourge); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedAquaticScourge); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAquaticScourge); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.AquaticScourge DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // If Aquatic Scourge has not yet been killed, notify players of buffed Acid Rain - if (!CalamityWorld.downedAquaticScourge) + if (!DownedBossSystem.downedAquaticScourge) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MaulerRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); @@ -242,7 +242,7 @@ namespace CalamityMod.NPCs.AquaticScourge } // Mark Aquatic Scourge as dead - CalamityWorld.downedAquaticScourge = true; + DownedBossSystem.downedAquaticScourge = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 85e05a27a5..85e5bc551b 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Astral NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 85; NPC.defense = 24; @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 798711b027..59a5d8a5bc 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Astral NPC.DeathSound = SoundID.NPCDeath14; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 30; NPC.defense = 20; @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.Astral if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { int num8 = Main.expertMode ? 14 : 18; - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) num8 += 6; int num9 = ProjectileID.PinkLaser; diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 4a6634c65f..3158344e3d 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.BlueSlime; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 65; NPC.defense = 18; @@ -84,8 +84,8 @@ namespace CalamityMod.NPCs.Astral DropHelper.DropItemChance(NPC, ModContent.ItemType(), Main.expertMode ? 1 : 2, 1, 3); int oreMin = Main.expertMode ? 11 : 8; int oreMax = Main.expertMode ? 16 : 12; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedStarGod, oreMin, oreMax); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.05f, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedStarGod, oreMin, oreMax); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 0.05f, 1, 1); } } } diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 869753505b..139808cf56 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.WallCreeper; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 90; NPC.defense = 30; @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 141604944b..20617f6254 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.BlackRecluseWall; Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 90; NPC.defense = 30; @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 3ed3d34119..dbf335e5a6 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -116,7 +116,7 @@ namespace CalamityMod.NPCs.Astral NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 100; NPC.defense = 50; @@ -617,7 +617,7 @@ namespace CalamityMod.NPCs.Astral { return 0f; } - else if (spawnInfo.Player.InAstral(1) && NPC.downedAncientCultist && !CalamityWorld.downedStarGod) + else if (spawnInfo.Player.InAstral(1) && NPC.downedAncientCultist && !DownedBossSystem.downedStarGod) { return 0.27f; } @@ -639,7 +639,7 @@ namespace CalamityMod.NPCs.Astral int maxStardust = Main.expertMode ? 9 : 8; DropHelper.DropItem(NPC, ModContent.ItemType(), minStardust, maxStardust); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); DropHelper.DropItem(NPC, ModContent.ItemType()); } } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index c3a6980091..69af71617d 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 85; NPC.defense = 30; @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.Astral NPC.noTileCollide = true; NPC.alpha = 80; NPC.aiStyle = -1; - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 75; } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 476d5f91a6..ea72bd21df 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.SandShark; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 65; NPC.defense = 22; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index cda959b1fd..9ece81c9ea 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Astral NPC.value = Item.buyPrice(0, 0, 15, 0); Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 80; NPC.defense = 18; @@ -205,7 +205,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 2, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 2, 2, 3); } } } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index b97ae720c6..42abbcb62a 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Astral NPC.value = Item.buyPrice(0, 0, 15, 0); Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 90; NPC.defense = 25; @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 82121e676b..b014552936 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Astral NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.value = Item.buyPrice(0, 0, 5, 0); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 50; NPC.defense = 8; diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 9fe9aa4ba1..bf0c772719 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Astral NPC.DeathSound = Mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 85; NPC.defense = 16; @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Astral SoundEngine.PlaySound(SoundID.Item71, NPC.position); Vector2 vector = Main.player[NPC.target].Center - NPC.Center; vector.Normalize(); - int damage = CalamityWorld.downedAstrageldon ? 55 : 45; + int damage = DownedBossSystem.downedAstrageldon ? 55 : 45; Projectile.NewProjectile(NPC.Center + (NPC.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); } } @@ -240,7 +240,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 36dfbf9947..30ea3ab641 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 75; NPC.defense = 25; @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(NPC, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7, 1, 1); } } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index be5d12c4ab..eb7e8c9347 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 58; NPC.defense = 26; diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index fe7c6f9a93..f409b334b4 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.GiantFlyingFox; Banner = NPC.type; BannerItem = ModContent.ItemType(); - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { NPC.damage = 90; NPC.defense = 28; @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItemChance(NPC, ModContent.ItemType(), 0.5f, 1, 2); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 847e054b4c..7f3bc2070e 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -317,9 +317,9 @@ namespace CalamityMod.NPCs.AstrumAureus DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedAstrageldon); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedAstrageldon); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard, ModContent.NPCType() }, CalamityWorld.downedAstrageldon); + CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard, ModContent.NPCType() }, DownedBossSystem.downedAstrageldon); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -358,7 +358,7 @@ namespace CalamityMod.NPCs.AstrumAureus ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor()); // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops - if (!CalamityWorld.downedAstrageldon) + if (!DownedBossSystem.downedAstrageldon) { string key = "Mods.CalamityMod.AureusBossText"; string key2 = "Mods.CalamityMod.AureusBossText2"; @@ -369,7 +369,7 @@ namespace CalamityMod.NPCs.AstrumAureus } // Mark Astrum Aureus as dead - CalamityWorld.downedAstrageldon = true; + DownedBossSystem.downedAstrageldon = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index e5b7fe5dc6..b6a44ae487 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -251,8 +251,8 @@ namespace CalamityMod.NPCs.AstrumDeus DropHelper.DropItem(NPC, ItemID.GreaterHealingPotion, 8, 14); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedStarGod); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedStarGod); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !DownedBossSystem.downedStarGod); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !DownedBossSystem.downedStarGod); // Drop a large spray of all 4 lunar fragments int minFragments = Main.expertMode ? 20 : 16; @@ -287,7 +287,7 @@ namespace CalamityMod.NPCs.AstrumDeus } // Notify players that Astral Ore can be mined if Deus has never been killed yet - if (!CalamityWorld.downedStarGod) + if (!DownedBossSystem.downedStarGod) { string key = "Mods.CalamityMod.AstralBossText"; Color messageColor = Color.Gold; @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.AstrumDeus } // Mark Astrum Deus as dead - CalamityWorld.downedStarGod = true; + DownedBossSystem.downedStarGod = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 10bad1ac6f..96250d478a 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.lifeMax = 26000; } @@ -76,7 +76,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental } bool goIntoShell = NPC.life <= NPC.lifeMax * 0.25; - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) { boostDR = true; diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 59616264f1..e379839081 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.value = Item.buyPrice(0, 40, 0, 0); NPC.LifeMaxNERB(41000, 49200, 780000); NPC.DR_NERD(0.15f); - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage *= 3; NPC.defense *= 4; @@ -156,16 +156,16 @@ namespace CalamityMod.NPCs.BrimstoneElemental DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedBrimstoneElemental); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedBrimstoneElemental); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, CalamityWorld.downedBrimstoneElemental); + CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, DownedBossSystem.downedBrimstoneElemental); if (!Main.expertMode) { //Materials DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 4, 8); - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 20, 30, 2); // Weapons @@ -180,7 +180,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Equipment DropHelper.DropItem(NPC, ModContent.ItemType(), true); DropHelper.DropItem(NPC, ModContent.ItemType(), true); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence); // Vanity DropHelper.DropItemChance(NPC, ModContent.ItemType(), 7); @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // mark brimmy as dead - CalamityWorld.downedBrimstoneElemental = true; + DownedBossSystem.downedBrimstoneElemental = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 879ade2813..710b4eff77 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.Bumblebirb DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBumble); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedBumble); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -424,7 +424,7 @@ namespace CalamityMod.NPCs.Bumblebirb DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark The Dragonfolly as dead - CalamityWorld.downedBumble = true; + DownedBossSystem.downedBumble = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index dccc8dab0c..3711e6256f 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Calamitas NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); NPC.LifeMaxNERB(11000, 13200, 80000); - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage *= 3; NPC.defense *= 5; diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 9e792746d0..30bba136ab 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Calamitas NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); NPC.LifeMaxNERB(9200, 11025, 80000); - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage *= 3; NPC.defense *= 5; diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 51afba89e7..9af228816c 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Calamitas NPC.value = Item.buyPrice(0, 50, 0, 0); NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); NPC.LifeMaxNERB(37500, 45000, 520000); - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage *= 3; NPC.defense *= 3; @@ -169,9 +169,9 @@ namespace CalamityMod.NPCs.Calamitas DropHelper.DropItem(NPC, ItemID.BrokenHeroSword, true); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedCalamitas); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !DownedBossSystem.downedCalamitas); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedCalamitas); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitas); if (!Main.expertMode) { @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.Calamitas DropHelper.DropItemSpray(NPC, ModContent.ItemType(), 4, 8); DropHelper.DropItem(NPC, ModContent.ItemType(), 9, 14); DropHelper.DropItem(NPC, ModContent.ItemType(), 1, 2); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 30, 40); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 1f, 30, 40); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.Calamitas string key = "Mods.CalamityMod.PlantBossText"; Color messageColor = Color.RoyalBlue; - if (!CalamityWorld.downedCalamitas) + if (!DownedBossSystem.downedCalamitas) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/WyrmScream"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); @@ -218,7 +218,7 @@ namespace CalamityMod.NPCs.Calamitas } // Mark Calamitas as dead - CalamityWorld.downedCalamitas = true; + DownedBossSystem.downedCalamitas = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 3c972e21d2..22dc2bc24f 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -695,7 +695,7 @@ namespace CalamityMod.NPCs float lifeRatio = npc.life / (float)npc.lifeMax; // Variables for buffing the AI - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; @@ -1235,7 +1235,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -1894,7 +1894,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2175,7 +2175,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -4234,7 +4234,7 @@ namespace CalamityMod.NPCs } // Destroy all Dark Energies if their total HP is below 20% - int darkEnergyMaxHP = BossRushEvent.BossRushActive ? 44000 : (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) ? 12000 : 3000; + int darkEnergyMaxHP = BossRushEvent.BossRushActive ? 44000 : (CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel1) ? 12000 : 3000; int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); @@ -6671,7 +6671,7 @@ namespace CalamityMod.NPCs float lifeRatio = npc.life / (float)npc.lifeMax; // Variables for buffing the AI - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 084b023513..73a12a43d4 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2000,7 +2000,7 @@ namespace CalamityMod.NPCs // Reduce prehardmode desert enemy stats pre-Desert Scourge case NPCID.WalkingAntlion: - if (!CalamityWorld.downedDesertScourge) + if (!DownedBossSystem.downedDesertScourge) { npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); @@ -2015,7 +2015,7 @@ namespace CalamityMod.NPCs case NPCID.Antlion: case NPCID.FlyingAntlion: - if (!CalamityWorld.downedDesertScourge) + if (!DownedBossSystem.downedDesertScourge) { npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); @@ -2034,8 +2034,8 @@ namespace CalamityMod.NPCs // Reduce Tomb Crawler stats case NPCID.TombCrawlerHead: - npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); - if (!CalamityWorld.downedDesertScourge) + npc.lifeMax = (int)(npc.lifeMax * (DownedBossSystem.downedDesertScourge ? 0.6 : 0.45)); + if (!DownedBossSystem.downedDesertScourge) { npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; @@ -2049,8 +2049,8 @@ namespace CalamityMod.NPCs case NPCID.TombCrawlerBody: case NPCID.TombCrawlerTail: - npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); - if (!CalamityWorld.downedDesertScourge) + npc.lifeMax = (int)(npc.lifeMax * (DownedBossSystem.downedDesertScourge ? 0.6 : 0.45)); + if (!DownedBossSystem.downedDesertScourge) { npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; @@ -2114,7 +2114,7 @@ namespace CalamityMod.NPCs npc.defDamage = npc.damage; } - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type)) { @@ -2721,7 +2721,7 @@ namespace CalamityMod.NPCs return DukeFishronAI.BuffedDukeFishronAI(npc, Mod); case NPCID.Pumpking: - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { return CalamityGlobalAI.BuffedPumpkingAI(npc); } @@ -2729,7 +2729,7 @@ namespace CalamityMod.NPCs break; case NPCID.PumpkingBlade: - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { return CalamityGlobalAI.BuffedPumpkingBladeAI(npc); } @@ -2737,7 +2737,7 @@ namespace CalamityMod.NPCs break; case NPCID.IceQueen: - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { return CalamityGlobalAI.BuffedIceQueenAI(npc); } @@ -2745,7 +2745,7 @@ namespace CalamityMod.NPCs break; case NPCID.Mothron: - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { return CalamityGlobalAI.BuffedMothronAI(npc); } @@ -4240,7 +4240,7 @@ namespace CalamityMod.NPCs } // Boosts - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) + if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { spawnRate = (int)(spawnRate * 0.75); maxSpawns = (int)(maxSpawns * 3f); @@ -4426,11 +4426,11 @@ namespace CalamityMod.NPCs { pool.Clear(); - if (!(CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 1)) + if (!(DownedBossSystem.downedPolterghast && CalamityWorld.acidRainPoints == 1)) { Dictionary PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; Dictionary PossibleMinibosses = new Dictionary(); - if (CalamityWorld.downedAquaticScourge) + if (DownedBossSystem.downedAquaticScourge) { PossibleEnemies = AcidRainEvent.PossibleEnemiesAS; PossibleMinibosses = AcidRainEvent.PossibleMinibossesAS; @@ -4439,7 +4439,7 @@ namespace CalamityMod.NPCs PossibleEnemies.Add(NPCType(), new AcidRainSpawnData(1, 0f, AcidRainSpawnRequirement.Anywhere)); } } - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { PossibleEnemies = AcidRainEvent.PossibleEnemiesPolter; PossibleMinibosses = AcidRainEvent.PossibleMinibossesPolter; @@ -5362,111 +5362,111 @@ namespace CalamityMod.NPCs if (type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } else if (type == NPCType()) { - return CalamityWorld.downedCrabulon; + return DownedBossSystem.downedCrabulon; } else if (type == NPCType()) { - return CalamityWorld.downedHiveMind; + return DownedBossSystem.downedHiveMind; } else if (type == NPCType()) { - return CalamityWorld.downedPerforator; + return DownedBossSystem.downedPerforator; } else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedSlimeGod; + return DownedBossSystem.downedSlimeGod; } else if (type == NPCType()) { - return CalamityWorld.downedCryogen; + return DownedBossSystem.downedCryogen; } else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedAquaticScourge; + return DownedBossSystem.downedAquaticScourge; } else if (type == NPCType()) { - return CalamityWorld.downedBrimstoneElemental; + return DownedBossSystem.downedBrimstoneElemental; } else if (type == NPCType()) { - return CalamityWorld.downedCalamitas; + return DownedBossSystem.downedCalamitas; } else if (type == NPCType() || type == NPCType()) { - return CalamityWorld.downedLeviathan; + return DownedBossSystem.downedLeviathan; } else if (type == NPCType()) { - return CalamityWorld.downedAstrageldon; + return DownedBossSystem.downedAstrageldon; } else if (type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedStarGod; + return DownedBossSystem.downedStarGod; } else if (type == NPCType()) { - return CalamityWorld.downedPlaguebringer; + return DownedBossSystem.downedPlaguebringer; } else if (type == NPCType()) { - return CalamityWorld.downedScavenger; + return DownedBossSystem.downedScavenger; } else if (type == NPCType()) { - return CalamityWorld.downedGuardians; + return DownedBossSystem.downedGuardians; } else if (type == NPCType()) { - return CalamityWorld.downedBumble; + return DownedBossSystem.downedBumble; } else if (type == NPCType()) { - return CalamityWorld.downedProvidence; + return DownedBossSystem.downedProvidence; } else if (type == NPCType() || type == NPCType()) { - return CalamityWorld.downedSentinel1; + return DownedBossSystem.downedSentinel1; } else if (type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedSentinel2; + return DownedBossSystem.downedSentinel2; } else if (type == NPCType()) { - return CalamityWorld.downedSentinel3; + return DownedBossSystem.downedSentinel3; } else if (type == NPCType()) { - return CalamityWorld.downedPolterghast; + return DownedBossSystem.downedPolterghast; } else if (type == NPCType()) { - return CalamityWorld.downedBoomerDuke; + return DownedBossSystem.downedBoomerDuke; } else if (type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedDoG; + return DownedBossSystem.downedDoG; } else if (type == NPCType()) { - return CalamityWorld.downedYharon; + return DownedBossSystem.downedYharon; } else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) { - return CalamityWorld.downedExoMechs; + return DownedBossSystem.downedExoMechs; } else if (type == NPCType()) { - return CalamityWorld.downedSCal; + return DownedBossSystem.downedSCal; } else if (type == NPCType()) { - return CalamityWorld.downedAdultEidolonWyrm; + return DownedBossSystem.downedAdultEidolonWyrm; } return true; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 194556f8d8..3c000d498c 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -392,7 +392,7 @@ namespace CalamityMod.NPCs CalamityUtils.DisplayLocalizedText(key, messageColor); } } - else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) + else if (npc.type == NPCID.DD2Betsy && !DownedBossSystem.downedBetsy) { // Drop weapons Calamity style instead of mutually exclusive. if (!Main.expertMode) @@ -409,7 +409,7 @@ namespace CalamityMod.NPCs } // Mark Betsy as dead (Vanilla does not keep track of her) - CalamityWorld.downedBetsy = true; + DownedBossSystem.downedBetsy = true; CalamityNetcode.SyncWorld(); } else if (npc.type == NPCID.DukeFishron) @@ -765,7 +765,7 @@ namespace CalamityMod.NPCs private void CheckBossSpawn(NPC npc) { if ((npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || - npc.type == ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !CalamityWorld.downedPolterghast) + npc.type == ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !DownedBossSystem.downedPolterghast) { CalamityMod.ghostKillCount++; if (CalamityMod.ghostKillCount == 10) @@ -1045,7 +1045,7 @@ namespace CalamityMod.NPCs break; case NPCID.GiantCursedSkull: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedLeviathan, Main.expertMode ? 15 : 25, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), DownedBossSystem.downedLeviathan, Main.expertMode ? 15 : 25, 1, 1); break; case NPCID.Necromancer: @@ -1172,7 +1172,7 @@ namespace CalamityMod.NPCs case NPCID.Reaper: case NPCID.Psycho: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas || NPC.downedPlantBoss, Main.expertMode ? 0.75f : 0.5f, 1, 4); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, Main.expertMode ? 0.75f : 0.5f, 1, 4); break; case NPCID.MartianOfficer: @@ -1241,7 +1241,7 @@ namespace CalamityMod.NPCs private void EventLoot(NPC npc, bool pumpkin, bool frost, bool eclipse) { // Nightmare Fuel, Endothermic Energy and Darksun Fragments - if (!CalamityWorld.downedDoG) + if (!DownedBossSystem.downedDoG) { return; } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index c6a81b4876..caf40f18bd 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor; @@ -19,6 +19,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -427,13 +428,13 @@ namespace CalamityMod.NPCs Vector2 drawPos = npc2.Center - Main.screenPosition; // The height of a single frame of the npc - float npcHeight = (float)(Main.npcTexture[npc2.type].Height / Main.npcFrameCount[npc2.type] / 2) * npc2.scale; + float npcHeight = (float)(TextureAssets.Npc[npc2.type].Value.Height / Main.npcFrameCount[npc2.type] / 2) * npc2.scale; // Offset the debuff display based on the npc's graphical offset, and 16 units, to create some space between the sprite and the display float drawPosY = npcHeight + npc.gfxOffY + 36f; // Texture animation variables - Texture2D texture = GetTexture("CalamityMod/ExtraTextures/UI/NPCAlertDisplay"); + Texture2D texture = Request("CalamityMod/ExtraTextures/UI/NPCAlertDisplay").Value; shopAlertAnimTimer++; if (shopAlertAnimTimer >= 6) { @@ -642,7 +643,7 @@ namespace CalamityMod.NPCs chat = "The dungeon seems even more restless than usual, watch out for the powerful abominations stirring up in there."; } - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { if (Main.rand.NextBool(20)) { @@ -757,7 +758,7 @@ namespace CalamityMod.NPCs { chat = "I hate sand. It's coarse, and rough and gets in my paint."; } - if (Main.rand.NextBool(4) && Main.LocalPlayer.ZoneHoly) + if (Main.rand.NextBool(4) && Main.LocalPlayer.ZoneHallow) { chat = "Do you think unicorn blood could be used as a good pigment or resin? No I'm not going to find out myself."; } @@ -805,7 +806,7 @@ namespace CalamityMod.NPCs break; case NPCID.Dryad: - if (Main.rand.NextBool(5) && CalamityWorld.downedDoG && Main.eclipse) + if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG && Main.eclipse) { chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful... hmm... what power was Yharon holding back?"; } @@ -883,7 +884,7 @@ namespace CalamityMod.NPCs chat = "That's the biggest moth I've ever seen for sure. You'd need one big gun to take one of those down."; } - if (Main.rand.NextBool(10) && CalamityWorld.downedDoG) + if (Main.rand.NextBool(10) && DownedBossSystem.downedDoG) { chat = "Is it me or are your weapons getting bigger and bigger?"; } @@ -950,12 +951,12 @@ namespace CalamityMod.NPCs break; case NPCID.Pirate: - if (Main.rand.NextBool(5) && !CalamityWorld.downedLeviathan) + if (Main.rand.NextBool(5) && !DownedBossSystem.downedLeviathan) { chat = "Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there."; } - if (Main.rand.NextBool(5) && CalamityWorld.downedAquaticScourge) + if (Main.rand.NextBool(5) && DownedBossSystem.downedAquaticScourge) { chat = "I have to thank ye again for takin' care of that sea serpent. Or was that another one..."; } @@ -1005,7 +1006,7 @@ namespace CalamityMod.NPCs } } - if (Main.rand.NextBool(10) && !CalamityWorld.downedPlaguebringer && NPC.downedGolemBoss) + if (Main.rand.NextBool(10) && !DownedBossSystem.downedPlaguebringer && NPC.downedGolemBoss) { chat = "Those oversized bugs terrorizing the jungle... Surely you of all people could shut them down!"; } @@ -1031,7 +1032,7 @@ namespace CalamityMod.NPCs } } - if (Main.rand.NextBool(10) && CalamityWorld.downedPolterghast) + if (Main.rand.NextBool(10) && DownedBossSystem.downedPolterghast) { chat = "Whatever that thing was, I'm glad it's gone now."; } @@ -1069,7 +1070,7 @@ namespace CalamityMod.NPCs chat = "Some of my machines are starting to go haywire thanks to this Astral Infection. I probably shouldn't have built them here"; } - if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneHoly) + if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneHallow) { chat = "I'm sorry I really don't have any Unicorn proof tech here, you're on your own."; } @@ -1116,12 +1117,12 @@ namespace CalamityMod.NPCs chat = "Where and how are you getting all of this money?"; } - if (Main.rand.NextBool(5) && !CalamityWorld.downedBrimstoneElemental) + if (Main.rand.NextBool(5) && !DownedBossSystem.downedBrimstoneElemental) { chat = "Perhaps with all that time you've got you could check those old ruins? Certainly something of value in it for you!"; } - if (Main.rand.NextBool(10) && CalamityWorld.downedDoG) + if (Main.rand.NextBool(10) && DownedBossSystem.downedDoG) { chat = "Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by!"; } @@ -1134,7 +1135,7 @@ namespace CalamityMod.NPCs break; case NPCID.Demolitionist: - if (Main.rand.NextBool(5) && CalamityWorld.downedDoG) + if (Main.rand.NextBool(5) && DownedBossSystem.downedDoG) { chat = "God Slayer Dynamite? Boy do I like the sound of that!"; } @@ -1170,27 +1171,27 @@ namespace CalamityMod.NPCs damageMult += 0.6f; defense += 20; } - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { damageMult += 0.2f; defense += 12; } - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) { damageMult += 0.2f; defense += 12; } - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { damageMult += 0.2f; defense += 12; } - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) { damageMult += 0.2f; defense += 12; } - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) { damageMult += 0.6f; defense += 20; @@ -1269,7 +1270,7 @@ namespace CalamityMod.NPCs { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPolterghast); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedPolterghast); } if (type == NPCID.Dryad) @@ -1282,8 +1283,8 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.NaturesGift, price: Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BandofStarpower : ItemID.PanicNecklace, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.WormScarf : ItemID.BrainOfConfusion, Main.expertMode && NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPerforator && Main.expertMode); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedHiveMind && Main.expertMode); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedPerforator && Main.expertMode); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedHiveMind && Main.expertMode); SetShopItem(ref shop, ref nextSlot, ItemType()); } @@ -1316,11 +1317,11 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(gold: 10)); SetShopItem(ref shop, ref nextSlot, ItemID.GoldenKey, Main.hardMode, Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedDoG, price: Item.buyPrice(gold: 8)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedDoG, price: Item.buyPrice(gold: 8)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedDoG, price: Item.buyPrice(gold: 8)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedDoG, price: Item.buyPrice(gold: 8)); - SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedDoG, price: Item.buyPrice(gold: 8)); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedDoG, price: Item.buyPrice(gold: 8)); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedDoG, price: Item.buyPrice(gold: 8)); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedDoG, price: Item.buyPrice(gold: 8)); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedDoG, price: Item.buyPrice(gold: 8)); + SetShopItem(ref shop, ref nextSlot, ItemType(), DownedBossSystem.downedDoG, price: Item.buyPrice(gold: 8)); } if (type == NPCID.Painter) @@ -1340,7 +1341,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.GravitationPotion, true, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.MagicMissile, price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemID.RodofDiscord, Main.hardMode && Main.LocalPlayer.ZoneHoly, price: Item.buyPrice(20), true); + SetShopItem(ref shop, ref nextSlot, ItemID.RodofDiscord, Main.hardMode && Main.LocalPlayer.ZoneHallow, price: Item.buyPrice(20), true); SetShopItem(ref shop, ref nextSlot, ItemID.SpectreStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.InfernoFork, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.ShadowbeamStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 43f8ce9613..aa8cf65369 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.CeaselessVoid CalamityGlobalNPC global = NPC.Calamity(); global.DR = 0.5f; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel1; NPC.LifeMaxNERB(notDoGFight ? 64400 : 16100, notDoGFight ? 77280 : 19320, 72000); // If fought alone, Ceaseless Void plays its own theme @@ -180,7 +180,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void NPCLoot() { // Only drop items if fought at full strength - bool fullStrength = !CalamityWorld.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; + bool fullStrength = !DownedBossSystem.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { CalamityGlobalNPC.SetNewBossJustDowned(NPC); @@ -188,7 +188,7 @@ namespace CalamityMod.NPCs.CeaselessVoid DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + bool lastSentinelKilled = !DownedBossSystem.downedSentinel1 && DownedBossSystem.downedSentinel2 && DownedBossSystem.downedSentinel3; DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) @@ -231,7 +231,7 @@ namespace CalamityMod.NPCs.CeaselessVoid // Mark Ceaseless Void as dead if (fullStrength) { - CalamityWorld.downedSentinel1 = true; + DownedBossSystem.downedSentinel1 = true; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 0cb8526b67..95337f2528 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.height = 80; NPC.defense = 50; NPC.lifeMax = 3000; - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel1) { NPC.lifeMax = 12000; } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index cfd5ca0c50..9a156d302b 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -723,7 +723,7 @@ namespace CalamityMod.NPCs.Crabulon DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedCrabulon); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedCrabulon); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -750,7 +750,7 @@ namespace CalamityMod.NPCs.Crabulon } // Mark Crabulon as dead - CalamityWorld.downedCrabulon = true; + DownedBossSystem.downedCrabulon = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index ccbe7877fd..63e3de2c73 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Crags NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 80; NPC.defense = 20; @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 2, 1, 1); DropHelper.DropItemChance(NPC, ItemID.Lens, 2); diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index ebfc93d424..05259d4670 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Crags NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 80; NPC.defense = 20; @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Crags public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (!CalamityWorld.downedBrimstoneElemental) + if (!DownedBossSystem.downedBrimstoneElemental) { return 0f; } @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { DropHelper.DropItem(NPC, ModContent.ItemType(), 10, 26); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3, 1, 1); } } diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index ebb31cc954..ecbf77ef22 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Crags NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath50; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 100; NPC.defense = 30; @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 1c75cb3e31..dd4308dc4e 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Crags NPC.DeathSound = SoundID.NPCDeath14; NPC.behindTiles = true; NPC.lavaImmune = true; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 80; NPC.defense = 50; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 8f6f75a9bb..decd29e13b 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Crags NPC.noGravity = true; NPC.noTileCollide = true; NPC.lavaImmune = true; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 90; NPC.defense = 30; @@ -257,8 +257,8 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 20, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 77ce82a0b9..3d3e86d623 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Crags NPC.noGravity = true; NPC.noTileCollide = true; NPC.lavaImmune = true; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 110; NPC.defense = 20; @@ -257,8 +257,8 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 20, 1, 1); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 20, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 564d4d7e8b..987993f099 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Crags NPC.lavaImmune = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { NPC.damage = 60; NPC.defense = 45; @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.Crags public override void AI() { - bool provy = CalamityWorld.downedProvidence; + bool provy = DownedBossSystem.downedProvidence; Player target = Main.player[NPC.target]; if (NPC.target < 0 || NPC.target == 255 || target.dead) { @@ -278,7 +278,7 @@ namespace CalamityMod.NPCs.Crags public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence, 2, 1, 1); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.hardMode, 3, 1, 1); DropHelper.DropItemChance(NPC, ModContent.ItemType(), (Main.hardMode ? 30 : 10)); } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 8b3f763a76..b077520ff1 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1050,7 +1050,7 @@ namespace CalamityMod.NPCs.Cryogen DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedCryogen); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedCryogen); if (!Main.expertMode) { @@ -1089,7 +1089,7 @@ namespace CalamityMod.NPCs.Cryogen } // If Cryogen has not been killed, notify players about Cryonic Ore - if (!CalamityWorld.downedCryogen) + if (!DownedBossSystem.downedCryogen) { string key = "Mods.CalamityMod.IceOreText"; Color messageColor = Color.LightSkyBlue; @@ -1099,7 +1099,7 @@ namespace CalamityMod.NPCs.Cryogen } // Mark Cryogen as dead - CalamityWorld.downedCryogen = true; + DownedBossSystem.downedCryogen = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index aa62ca9261..b39ef64d91 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -564,7 +564,7 @@ namespace CalamityMod.NPCs.DesertScourge DropHelper.DropItem(NPC, ItemID.LesserHealingPotion, 8, 14); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedDesertScourge); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedDesertScourge); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -599,7 +599,7 @@ namespace CalamityMod.NPCs.DesertScourge } // If Desert Scourge has not been killed yet, notify players that the Sunken Sea is open and Sandstorms can happen - if (!CalamityWorld.downedDesertScourge) + if (!DownedBossSystem.downedDesertScourge) { string key = "Mods.CalamityMod.OpenSunkenSea"; Color messageColor = Color.Aquamarine; @@ -614,7 +614,7 @@ namespace CalamityMod.NPCs.DesertScourge } // Mark Desert Scourge as dead - CalamityWorld.downedDesertScourge = true; + DownedBossSystem.downedDesertScourge = true; CalamityNetcode.SyncWorld(); } #endregion diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 89abda5a18..793247ba44 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -433,7 +433,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Skip the sentinel phase entirely if DoG has already been killed - CalamityWorld.DoGSecondStageCountdown = (CalamityWorld.downedDoG || CalamityWorld.downedSecondSentinels || BossRushEvent.BossRushActive) ? 600 : 21600; + CalamityWorld.DoGSecondStageCountdown = (DownedBossSystem.downedDoG || DownedBossSystem.downedSecondSentinels || BossRushEvent.BossRushActive) ? 600 : 21600; if (Main.netMode == NetmodeID.Server) { var netMessage = Mod.GetPacket(); @@ -2247,9 +2247,9 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.DropItem(NPC, ModContent.ItemType(), 5, 15); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedDoG); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedDoG); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedDoG); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedDoG); // Mount CalamityPlayer mp = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Calamity(); @@ -2284,7 +2284,7 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // If DoG has not been killed yet, notify players that the holiday moons are buffed - if (!CalamityWorld.downedDoG) + if (!DownedBossSystem.downedDoG) { string key = "Mods.CalamityMod.DoGBossText"; Color messageColor = Color.Cyan; @@ -2298,7 +2298,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Mark DoG as dead - CalamityWorld.downedDoG = true; + DownedBossSystem.downedDoG = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 9a0c7e1bf3..da6bbe1718 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1261,7 +1261,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public static void DropExoMechLoot(NPC npc, int mechType) { // Dropped before the downed variable is set to true - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedExoMechs); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !DownedBossSystem.downedExoMechs); switch (mechType) { @@ -1269,8 +1269,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares DropHelper.DropItem(npc, ModContent.ItemType()); - CalamityWorld.downedAres = true; - CalamityWorld.downedExoMechs = true; + DownedBossSystem.downedAres = true; + DownedBossSystem.downedExoMechs = true; CalamityNetcode.SyncWorld(); break; @@ -1279,8 +1279,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares DropHelper.DropItem(npc, ModContent.ItemType()); - CalamityWorld.downedThanatos = true; - CalamityWorld.downedExoMechs = true; + DownedBossSystem.downedThanatos = true; + DownedBossSystem.downedExoMechs = true; CalamityNetcode.SyncWorld(); break; @@ -1290,8 +1290,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares DropHelper.DropItem(npc, ModContent.ItemType()); DropHelper.DropItem(npc, ModContent.ItemType()); - CalamityWorld.downedArtemisAndApollo = true; - CalamityWorld.downedExoMechs = true; + DownedBossSystem.downedArtemisAndApollo = true; + DownedBossSystem.downedExoMechs = true; CalamityNetcode.SyncWorld(); break; @@ -1310,21 +1310,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Weapons // Higher chance due to how the drops work float w = DropHelper.NormalWeaponDropRateFloat * 2f; - if (CalamityWorld.downedAres) + if (DownedBossSystem.downedAres) { DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); } - if (CalamityWorld.downedThanatos) + if (DownedBossSystem.downedThanatos) { DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); } - if (CalamityWorld.downedArtemisAndApollo) + if (DownedBossSystem.downedArtemisAndApollo) { DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), @@ -1339,16 +1339,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Vanity // Higher chance due to how the drops work float maskDropRate = 1f / 3.5f; - if (CalamityWorld.downedThanatos) + if (DownedBossSystem.downedThanatos) DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); - if (CalamityWorld.downedArtemisAndApollo) + if (DownedBossSystem.downedArtemisAndApollo) { DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); } - if (CalamityWorld.downedAres) + if (DownedBossSystem.downedAres) DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); DropHelper.DropItemChance(npc, ModContent.ItemType(), maskDropRate); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 8cd9f0cc44..acc4556fcc 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -603,7 +603,7 @@ namespace CalamityMod.NPCs.GreatSandShark DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, 3, 1, 1); // Mark Great Sand Shark as dead - CalamityWorld.downedGSS = true; + DownedBossSystem.downedGSS = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 5ff2c444f7..e029ff8a67 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.HiveMind if (anyBossElements || spawnInfo.playerSafe || !corrupt) return 0f; - if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) + if (NPC.downedBoss2 && !DownedBossSystem.downedHiveMind) return 1.5f; return Main.hardMode ? 0.05f : 0.5f; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index b360a6997f..3412a5845b 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1073,9 +1073,9 @@ namespace CalamityMod.NPCs.HiveMind DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedHiveMind); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedHiveMind); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedHiveMind); + CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, DownedBossSystem.downedHiveMind); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -1110,7 +1110,7 @@ namespace CalamityMod.NPCs.HiveMind } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore - if (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) + if (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; @@ -1120,7 +1120,7 @@ namespace CalamityMod.NPCs.HiveMind } // Mark The Hive Mind as dead - CalamityWorld.downedHiveMind = true; + DownedBossSystem.downedHiveMind = true; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 04cf396b25..8bda607c13 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -241,7 +241,7 @@ namespace CalamityMod.NPCs.Leviathan public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !DownedBossSystem.downedCalamitas)) { return 0f; } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 001714eee1..7ef3743d66 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -715,8 +715,8 @@ namespace CalamityMod.NPCs.Leviathan DropHelper.DropBags(npc); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !DownedBossSystem.downedLeviathan); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !DownedBossSystem.downedLeviathan); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -753,7 +753,7 @@ namespace CalamityMod.NPCs.Leviathan DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark Siren & Levi as dead - CalamityWorld.downedLeviathan = true; + DownedBossSystem.downedLeviathan = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 55b7af16c1..7a40d898e7 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -125,7 +125,7 @@ namespace CalamityMod.NPCs.Leviathan if (!Main.hardMode) return SpawnCondition.OceanMonster.Chance * 0.025f; - if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) + if (!NPC.downedPlantBoss && !DownedBossSystem.downedCalamitas) return SpawnCondition.OceanMonster.Chance * 0.1f; return SpawnCondition.OceanMonster.Chance * 0.4f; diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 20984f75b2..83c921f3d6 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.Player.Calamity().ZoneAbyss || + if (spawnInfo.playerSafe || (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 4f11043960..3d7dd86c7d 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 56; NPC.defense = 4; NPC.lifeMax = 50; - if (CalamityWorld.downedCryogen) + if (DownedBossSystem.downedCryogen) { NPC.damage = 60; NPC.defense = 10; @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { DropHelper.DropItemChance(NPC, ItemID.Leather, 1, 1, 2); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCryogen, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCryogen, 3, 1, 1); } } } diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index f80ce022cd..c6e006b47b 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedProvidence || spawnInfo.Player.Calamity().ZoneAbyss || + if (spawnInfo.playerSafe || !DownedBossSystem.downedProvidence || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index cbc8763722..8bac29e628 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) { // RIP LORDE // DropHelper.DropItem(npc, ModContent.ItemType()); diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 264bb0eae8..ae0f716a3d 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !CalamityWorld.downedCryogen || (!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1) || spawnInfo.Player.Calamity().ZoneAbyss || + if (spawnInfo.playerSafe || !DownedBossSystem.downedCryogen || (!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1) || spawnInfo.Player.Calamity().ZoneAbyss || spawnInfo.Player.Calamity().ZoneSunkenSea) { return 0f; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 4094fd4db9..e09d87772f 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -337,7 +337,7 @@ namespace CalamityMod.NPCs.NormalNPCs DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !NPC.LunarApocalypseIsUp, 0.25f); int minLumenyl = Main.expertMode ? 10 : 8; int maxLumenyl = Main.expertMode ? 14 : 10; - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1f, minLumenyl, maxLumenyl); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedCalamitas, 1f, minLumenyl, maxLumenyl); DropHelper.DropItemCondition(NPC, ItemID.Ectoplasm, NPC.downedPlantBoss, 1f, 3, 5); } } diff --git a/NPCs/NormalNPCs/Parasea.cs b/NPCs/NormalNPCs/Parasea.cs index dff68d0eb8..3f08b71ac8 100644 --- a/NPCs/NormalNPCs/Parasea.cs +++ b/NPCs/NormalNPCs/Parasea.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas)) + if (spawnInfo.playerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!NPC.downedPlantBoss && !DownedBossSystem.downedCalamitas)) { return 0f; } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 3225d8f553..811db319a9 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.NormalNPCs { @@ -361,13 +362,17 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack"); + Texture2D texture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/ThiccWaifuAttack").Value; + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (CurrentAttackState != AttackState.Hover) - CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, drawColor); + Main.EntitySpriteDraw(texture, screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); else - CalamityMod.DrawTexture(spriteBatch, Main.npcTexture[NPC.type], 0, NPC, drawColor); + { + texture = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(texture, screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); + } return false; } @@ -386,7 +391,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !Main.hardMode || !Main.raining || NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.PlayerSafe || !Main.hardMode || !Main.raining || NPC.AnyNPCs(ModContent.NPCType())) return 0f; return SpawnCondition.Sky.Chance * 0.1f; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index ce4b284b09..b092bfd59a 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -379,9 +379,9 @@ namespace CalamityMod.NPCs.OldDuke DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedBoomerDuke); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedBoomerDuke); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedBoomerDuke); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedBoomerDuke); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -408,7 +408,7 @@ namespace CalamityMod.NPCs.OldDuke DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark Old Duke as dead - CalamityWorld.downedBoomerDuke = true; + DownedBossSystem.downedBoomerDuke = true; // Mark first acid rain encounter as true even if he wasn't fought in the acid rain, because it makes sense CalamityWorld.encounteredOldDuke = true; diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index d06884246f..2329cc4c53 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -76,7 +76,7 @@ namespace CalamityMod.NPCs.Perforator if (spawnInfo.playerSafe || anyBossElements || !crimson) return 0f; - if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) + if (NPC.downedBoss2 && !DownedBossSystem.downedPerforator) return 1.5f; return Main.hardMode ? 0.05f : 0.5f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 4d892ea8de..7abe6247fe 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -459,9 +459,9 @@ namespace CalamityMod.NPCs.Perforator DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPerforator); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedPerforator); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedPerforator); + CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, DownedBossSystem.downedPerforator); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -497,7 +497,7 @@ namespace CalamityMod.NPCs.Perforator } // If neither The Hive Mind nor The Perforator Hive have been killed yet, notify players of Aerialite Ore - if (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) + if (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; @@ -507,7 +507,7 @@ namespace CalamityMod.NPCs.Perforator } // Mark The Perforator Hive as dead - CalamityWorld.downedPerforator = true; + DownedBossSystem.downedPerforator = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 9368b9973a..b3e319cacc 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1194,7 +1194,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPlaguebringer); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedPlaguebringer); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -1231,7 +1231,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark PBG as dead - CalamityWorld.downedPlaguebringer = true; + DownedBossSystem.downedPlaguebringer = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index ab52c84399..20ae66c0c8 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -965,9 +965,9 @@ namespace CalamityMod.NPCs.Polterghast DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedPolterghast); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedPolterghast); - CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, CalamityWorld.downedPolterghast); + CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, DownedBossSystem.downedPolterghast); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -996,7 +996,7 @@ namespace CalamityMod.NPCs.Polterghast } // If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items - if (!CalamityWorld.downedPolterghast) + if (!DownedBossSystem.downedPolterghast) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ReaperSearchRoar"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); @@ -1016,7 +1016,7 @@ namespace CalamityMod.NPCs.Polterghast } // Mark Polterghast as dead - CalamityWorld.downedPolterghast = true; + DownedBossSystem.downedPolterghast = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 5aa52c3f21..f9d47fed67 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -481,10 +481,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians DropHelper.DropItemChance(NPC, ModContent.ItemType(), 4); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); DropHelper.DropItem(NPC, ModContent.ItemType()); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedGuardians); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedGuardians); // Mark the Profaned Guardians as dead - CalamityWorld.downedGuardians = true; + DownedBossSystem.downedGuardians = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index bcd47840a6..b844be33b8 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1474,18 +1474,18 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedProvidence); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedProvidence); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedProvidence); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedProvidence); // Accessories clientside only in Expert. Both drop if she is defeated at night. DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, biomeType != 2 || !hasTakenDaytimeDamage); DropHelper.DropItemCondition(NPC, ModContent.ItemType(), Main.expertMode, biomeType == 2 || !hasTakenDaytimeDamage); // Drops pre-scal, cannot be sold, does nothing aka purely vanity. Requires at least expert for consistency with other post scal dev items. - bool shouldDrop = challenge/* || (Main.expertMode && Main.rand.NextBool(CalamityWorld.downedSCal ? 10 : 200))*/; + bool shouldDrop = challenge/* || (Main.expertMode && Main.rand.NextBool(DownedBossSystem.downedSCal ? 10 : 200))*/; DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, shouldDrop); // Special drop for defeating her at night @@ -1523,7 +1523,7 @@ namespace CalamityMod.NPCs.Providence SpawnLootBox(); // If Providence has not been killed, notify players of Uelibloom Ore - if (!CalamityWorld.downedProvidence) + if (!DownedBossSystem.downedProvidence) { string key2 = "Mods.CalamityMod.ProfanedBossText3"; Color messageColor2 = Color.Orange; @@ -1545,7 +1545,7 @@ namespace CalamityMod.NPCs.Providence } // Mark Providence as dead - CalamityWorld.downedProvidence = true; + DownedBossSystem.downedProvidence = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 7323a79519..19e70a39b6 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Ravager NPC.DR_NERD(0.2f); NPC.chaseable = false; NPC.canGhostHeal = false; - NPC.lifeMax = CalamityWorld.downedProvidence ? 14000 : 3500; + NPC.lifeMax = DownedBossSystem.downedProvidence ? 14000 : 3500; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { - bool provy = CalamityWorld.downedProvidence; + bool provy = DownedBossSystem.downedProvidence; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) NPC.damage = (int)(NPC.defDamage * 1.5); else NPC.damage = NPC.defDamage; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 0db66fc007..e315653210 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Ravager NPC.value = Item.buyPrice(0, 75, 0, 0); NPC.DR_NERD(0.35f); NPC.LifeMaxNERB(44600, 53500, 460000); - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); NPC.defense *= 2; @@ -772,14 +772,14 @@ namespace CalamityMod.NPCs.Ravager DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedScavenger); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedScavenger); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Materials - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !CalamityWorld.downedProvidence); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !DownedBossSystem.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedProvidence); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; @@ -792,7 +792,7 @@ namespace CalamityMod.NPCs.Ravager ); // Equipment - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, CalamityWorld.downedProvidence); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, DownedBossSystem.downedProvidence); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 3); @@ -803,7 +803,7 @@ namespace CalamityMod.NPCs.Ravager DropHelper.DropItemCondition(NPC, ModContent.ItemType(), !Main.expertMode, 0.1f); // Mark Ravager as dead - CalamityWorld.downedScavenger = true; + DownedBossSystem.downedScavenger = true; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index e83046dfec..199bdbcbeb 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Ravager NPC.netAlways = true; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); NPC.defense *= 2; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index fb43e2842a..1e53ab5bf3 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Ravager NPC.alpha = 255; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.damage = (int)(NPC.damage * 1.5); NPC.defense *= 2; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 1a73696fee..9982dc4530 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Ravager NPC.alpha = 255; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = null; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; NPC.lifeMax *= 4; @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.Ravager return; } - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Setting this in SetDefaults will disable expert mode scaling, so put it here instead diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 291d4688cf..ff697f26fb 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Ravager NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; NPC.lifeMax *= 4; @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.Ravager bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 103194d4c8..8a29fff6a2 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Ravager NPC.alpha = 255; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; NPC.lifeMax *= 4; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 45e2d4882b..8efd4f800d 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Ravager NPC.alpha = 255; NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; NPC.lifeMax *= 4; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 086e692be4..fbdc6514fb 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Ravager NPC.DR_NERD(0.3f); NPC.chaseable = false; NPC.canGhostHeal = false; - NPC.lifeMax = CalamityWorld.downedProvidence ? 20000 : 5000; + NPC.lifeMax = DownedBossSystem.downedProvidence ? 20000 : 5000; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) NPC.damage = (int)(NPC.defDamage * 1.5); else NPC.damage = NPC.defDamage; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 16dd9edfb8..7d8013a27a 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Signus NPC.height = 130; NPC.defense = 60; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel3; NPC.LifeMaxNERB(notDoGFight ? 297000 : 73000, notDoGFight ? 356400 : 87600, 240000); // If fought alone, Signus plays his own theme @@ -751,7 +751,7 @@ namespace CalamityMod.NPCs.Signus public override void NPCLoot() { // Only drop items if fought at full strength - bool fullStrength = !CalamityWorld.downedSentinel3 || CalamityWorld.DoGSecondStageCountdown <= 0; + bool fullStrength = !DownedBossSystem.downedSentinel3 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { CalamityGlobalNPC.SetNewBossJustDowned(NPC); @@ -759,7 +759,7 @@ namespace CalamityMod.NPCs.Signus DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; + bool lastSentinelKilled = DownedBossSystem.downedSentinel1 && DownedBossSystem.downedSentinel2 && !DownedBossSystem.downedSentinel3; DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) @@ -798,14 +798,14 @@ namespace CalamityMod.NPCs.Signus } // Mark DoG fight sentinels as dead - CalamityWorld.downedSecondSentinels = true; + DownedBossSystem.downedSecondSentinels = true; CalamityNetcode.SyncWorld(); } // Mark Signus as dead if (fullStrength) { - CalamityWorld.downedSentinel3 = true; + DownedBossSystem.downedSentinel3 = true; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index e67ed7ca9d..0aa73c99a2 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -596,15 +596,15 @@ namespace CalamityMod.NPCs.SlimeGod DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSlimeGod); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !DownedBossSystem.downedSlimeGod); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedSlimeGod); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedSlimeGod); // Purified Jam is once per player, but drops for all players. CalamityPlayer mp = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity(); if (!mp.revJamDrop) { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSlimeGod, 6, 8); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !DownedBossSystem.downedSlimeGod, 6, 8); mp.revJamDrop = true; } @@ -636,7 +636,7 @@ namespace CalamityMod.NPCs.SlimeGod } // Mark the Slime God as dead - CalamityWorld.downedSlimeGod = true; + DownedBossSystem.downedSlimeGod = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 9b70710b90..89577ef09c 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 40; // 10% of HP is phase one - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel2; NPC.lifeMax = notDoGFight ? 825500 : 139750; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 383fc7105f..666afa1fef 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 74; // 10% of HP is phase one - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel2; NPC.lifeMax = notDoGFight ? 825500 : 139750; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); @@ -747,7 +747,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void NPCLoot() { // Only drop items if fought at full strength - bool fullStrength = !CalamityWorld.downedSentinel2 || CalamityWorld.DoGSecondStageCountdown <= 0; + bool fullStrength = !DownedBossSystem.downedSentinel2 || CalamityWorld.DoGSecondStageCountdown <= 0; if (fullStrength) { CalamityGlobalNPC.SetNewBossJustDowned(NPC); @@ -755,7 +755,7 @@ namespace CalamityMod.NPCs.StormWeaver DropHelper.DropBags(NPC); DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + bool lastSentinelKilled = DownedBossSystem.downedSentinel1 && !DownedBossSystem.downedSentinel2 && DownedBossSystem.downedSentinel3; DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, lastSentinelKilled); if (!Main.expertMode) @@ -798,7 +798,7 @@ namespace CalamityMod.NPCs.StormWeaver // Mark Storm Weaver as dead if (fullStrength) { - CalamityWorld.downedSentinel2 = true; + DownedBossSystem.downedSentinel2 = true; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index ed7e59580e..5afafd3dd7 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.height = 80; // 10% of HP is phase one - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !DownedBossSystem.downedSentinel2; NPC.lifeMax = notDoGFight ? 825500 : 139750; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 475000); diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index a0126a5e15..af5d9701ef 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !DownedBossSystem.downedAquaticScourge) { return 0f; } diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index f77f9a4054..8e21e1b432 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) + if (spawnInfo.playerSafe || !spawnInfo.Player.Calamity().ZoneSulphur || !DownedBossSystem.downedAquaticScourge) { return 0f; } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 5a29b76d1b..54e04b9b5a 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -199,7 +199,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 3, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 55d9bbe824..f61d3aee46 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 0.2f); DropHelper.DropItemChance(NPC, ItemID.JellyfishNecklace, 0.01f); } } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 3108ab28cb..1c02d14ccc 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -357,7 +357,7 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(ModContent.NPCType())) + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.water && DownedBossSystem.downedDesertScourge && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.24f; } @@ -384,24 +384,25 @@ namespace CalamityMod.NPCs.SunkenSea } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Texture2D texture = Main.npcTexture[NPC.type]; - CalamityMod.DrawTexture(spriteBatch, texture, 0, NPC, drawColor, true); + Texture2D texture = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(texture, screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, 0, 0); return false; } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + public override void PostDraw(Color drawColor) { + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Value; SpriteEffects spriteEffects = SpriteEffects.None; Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[NPC.type].Width / 2), (float)(Main.npcTexture[NPC.type].Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Width, (float)(ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow").Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector -= new Vector2((float)glowmask.Width, (float)(glowmask.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/SunkenSea/GiantClamGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); + Main.EntitySpriteDraw(glowmask, vector, NPC.frame, color, NPC.rotation, vector11, 1f, spriteEffects, 0); } public override void NPCLoot() @@ -431,12 +432,12 @@ namespace CalamityMod.NPCs.SunkenSea } // Equipment - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 3, 1, 1); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 3, 1, 1); // Mark Giant Clam as dead - CalamityWorld.downedCLAM = true; - CalamityWorld.downedCLAMHardMode = Main.hardMode || CalamityWorld.downedCLAMHardMode; + DownedBossSystem.downedCLAM = true; + DownedBossSystem.downedCLAMHardMode = Main.hardMode || DownedBossSystem.downedCLAMHardMode; CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index a473b3c44f..62e1a38062 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -140,7 +140,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 1, 1, 3); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), DownedBossSystem.downedDesertScourge, 1, 1, 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 003f5c5a43..c34296fc7e 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -208,7 +208,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void BossHeadSlot(ref int index) { bool inPhase2 = NPC.ai[0] == 3f; - if (!CalamityWorld.downedSCal || BossRushEvent.BossRushActive) + if (!DownedBossSystem.downedSCal || BossRushEvent.BossRushActive) index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; else index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; @@ -386,7 +386,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalSummonText"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -574,7 +574,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, NPC.Opacity, true); if (NPC.alpha >= 230) { - if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedSCal && !BossRushEvent.BossRushActive) { // Create a teleport line effect Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); @@ -775,7 +775,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalBH2Text"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -839,7 +839,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalBH3Text"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -912,7 +912,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalBH4Text"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -983,7 +983,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1008,7 +1008,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) NPC.velocity.X *= 0.96f; - if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) + if (DownedBossSystem.downedSCal && !BossRushEvent.BossRushActive) { if (giveUpCounter == 720) { @@ -1077,7 +1077,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalDesparationText4"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1089,7 +1089,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalDesparationText3"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1101,7 +1101,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalDesparationText2"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1113,7 +1113,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalDesparationText1"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1182,7 +1182,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalPhase2Text"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1196,7 +1196,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalSeekerRingText"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -2524,7 +2524,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -2642,7 +2642,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalBrothersText"; - if (CalamityWorld.downedSCal) + if (DownedBossSystem.downedSCal) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -2761,7 +2761,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Other DropHelper.DropItemChance(NPC, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedSCal); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedSCal); // Increase the player's SCal kill count if (Main.player[NPC.target].Calamity().sCalKillCount < 5) @@ -2771,7 +2771,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.NewNPC(NPC.GetSpawnSourceForNPCFromNPCAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, ModContent.NPCType()); // Mark Supreme Calamitas as defeated - CalamityWorld.downedSCal = true; + DownedBossSystem.downedSCal = true; CalamityNetcode.SyncWorld(); } #endregion @@ -2850,7 +2850,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = CalamityWorld.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[NPC.type] : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); + Texture2D texture2D15 = DownedBossSystem.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[NPC.type] : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Color color36 = Color.White; @@ -2882,7 +2882,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (inPhase2) { // Make the sprite jitter with rage in phase 2. This does not happen in rematches since it would make little sense logically. - if (!CalamityWorld.downedSCal) + if (!DownedBossSystem.downedSCal) vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 4f11961adf..a5f9fcabe4 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.TownNPCs } } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedCryogen; + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => DownedBossSystem.downedCryogen; public override string TownNPCName() => "Permafrost"; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index b8021c1914..3375f090ff 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -162,10 +162,10 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.invasionType == InvasionID.MartianMadness) dialogue.Add("You should probably deal with those ayy lmaos before anything else, but whatever."); - if (CalamityWorld.downedCryogen) + if (DownedBossSystem.downedCryogen) dialogue.Add("God I can't wait to smash some ice again! ...For drinks, of course."); - if (CalamityWorld.downedLeviathan) + if (DownedBossSystem.downedLeviathan) dialogue.Add("How could you murder such a beautiful creature!? ...The blue sexy one, not the obese cucumber."); if (NPC.downedMoonlord) @@ -174,10 +174,10 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityWorld.rainingAcid) dialogue.Add("I'm melting! Put a stop to this inclement weather this instant before it ruins my hair!"); - if (CalamityWorld.downedPolterghast) + if (DownedBossSystem.downedPolterghast) dialogue.Add("I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were."); - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) dialogue.Add("I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); @@ -348,7 +348,7 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; } - if (CalamityWorld.downedAstrageldon) + if (DownedBossSystem.downedAstrageldon) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 32f5218d30..85fec95c57 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.TownNPCs public override bool CanTownNPCSpawn(int numTownNPCs, int money) { - return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedCLAM && DownedBossSystem.downedDesertScourge; } public override string TownNPCName() @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("Some of these beings I had thought previously to be only legends. To see them in all their glory... what a macabre privilege."); } - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { dialogue.Add("To see that Tyrant’s serpent free of its shackles. It gave me chills."); } @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.TownNPCs string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; string displayThisText = "If this shows up, something went wrong."; - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) { switch (NPC.Calamity().newAI[0] % 3f) { @@ -161,7 +161,7 @@ namespace CalamityMod.NPCs.TownNPCs break; } } - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) { switch (NPC.Calamity().newAI[0] % 3f) { @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.TownNPCs break; } } - else if (CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedPolterghast) { switch (NPC.Calamity().newAI[0] % 2f) { @@ -188,7 +188,7 @@ namespace CalamityMod.NPCs.TownNPCs break; } } - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) { switch (NPC.Calamity().newAI[0] % 3f) { @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.TownNPCs switch (NPC.Calamity().newAI[0] % 8f) { case 0f: - displayThisText = !CalamityWorld.downedCryogen ? "Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed." : "You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."; + displayThisText = !DownedBossSystem.downedCryogen ? "Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed." : "You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."; break; case 1f: displayThisText = "I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."; @@ -379,7 +379,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); nextSlot++; } - if (CalamityWorld.downedBoomerDuke) + if (DownedBossSystem.downedBoomerDuke) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 8add87c8ad..092297cf82 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -271,7 +271,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].SetDefaults(ItemID.TrapsightPotion); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); nextSlot++; - if (CalamityWorld.downedSlimeGod) + if (DownedBossSystem.downedSlimeGod) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; @@ -304,7 +304,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; nextSlot++; } - if (CalamityWorld.downedCalamitas) + if (DownedBossSystem.downedCalamitas) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value; @@ -334,19 +334,19 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); nextSlot++; } - if (CalamityWorld.downedProvidence) + if (DownedBossSystem.downedProvidence) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); nextSlot++; } - if (CalamityWorld.downedDoG) + if (DownedBossSystem.downedDoG) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(25, 0, 0, 0); nextSlot++; } - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(40, 0, 0, 0); diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 434ca17103..fd2d59e792 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.TownNPCs animationType = NPCID.Wizard; } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal && !NPC.AnyNPCs(NPCType()); + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => DownedBossSystem.downedSCal && !NPC.AnyNPCs(NPCType()); public override string TownNPCName() => "Calamitas"; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 1553fd56b7..f8ebe8de38 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2827,7 +2827,7 @@ namespace CalamityMod.NPCs.Yharon #region Loot public override void NPCLoot() { - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedYharon); CalamityGlobalNPC.SetNewBossJustDowned(NPC); @@ -2872,10 +2872,10 @@ namespace CalamityMod.NPCs.Yharon // Other // DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !CalamityWorld.downedYharon); + DropHelper.DropItemCondition(NPC, ModContent.ItemType(), true, !DownedBossSystem.downedYharon); // If Yharon has not been killed yet, notify players of Auric Ore - if (!CalamityWorld.downedYharon) + if (!DownedBossSystem.downedYharon) { CalamityUtils.SpawnOre(ModContent.TileType(), 2E-05, 0.6f, 0.8f, 10, 20); @@ -2885,7 +2885,7 @@ namespace CalamityMod.NPCs.Yharon } // Mark Yharon as dead - CalamityWorld.downedYharon = true; + DownedBossSystem.downedYharon = true; CalamityNetcode.SyncWorld(); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 3e7b62047c..d8846da35f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1869,7 +1869,7 @@ namespace CalamityMod.Projectiles } } - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) + if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) projectile.damage = defDamage + 15; diff --git a/Projectiles/Enemy/CragmawAcidDrop.cs b/Projectiles/Enemy/CragmawAcidDrop.cs index 4ee9dbff1c..0b0c1e7c56 100644 --- a/Projectiles/Enemy/CragmawAcidDrop.cs +++ b/Projectiles/Enemy/CragmawAcidDrop.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void AI() { - float homingSpeed = CalamityWorld.downedPolterghast ? 16.5f : 10f; + float homingSpeed = DownedBossSystem.downedPolterghast ? 16.5f : 10f; Player target = Main.player[Player.FindClosest(Projectile.Center, 1, 1)]; if (Projectile.WithinRange(target.Center, 1200f) && Projectile.timeLeft < 210) Projectile.velocity = (Projectile.velocity * 59f + Projectile.SafeDirectionTo(target.Center) * homingSpeed) / 60f; diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs index 6bbc9626d7..c5838aab32 100644 --- a/Projectiles/Enemy/CragmawSpike.cs +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void AI() { - float maxSpeed = CalamityWorld.downedPolterghast ? 19.5f : 11.5f; + float maxSpeed = DownedBossSystem.downedPolterghast ? 19.5f : 11.5f; if (Projectile.velocity.Length() < maxSpeed) Projectile.velocity *= 1.024f; diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/BiomeTileCounterSystem.cs new file mode 100644 index 0000000000..aed3aa3e5b --- /dev/null +++ b/Systems/BiomeTileCounterSystem.cs @@ -0,0 +1,47 @@ +using System; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.SunkenSea; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class BiomeTileCounterSystem : ModSystem + { + public static int BrimstoneCragTiles = 0; + public static int SulphurTiles = 0; + public static int AbyssTiles = 0; + public static int AstralTiles = 0; + public static int SunkenSeaTiles = 0; + + public override void ResetNearbyTileEffects() + { + BrimstoneCragTiles = 0; + AstralTiles = 0; + SunkenSeaTiles = 0; + SulphurTiles = 0; + AbyssTiles = 0; + } + + public override void TileCountsAvailable(ReadOnlySpan tileCounts) + { + BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + + int astralDesertTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + int astralSnowTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + + Main.SceneMetrics.SandTileCount += astralDesertTiles; + Main.SceneMetrics.SnowTileCount += astralSnowTiles; + + AstralTiles = astralDesertTiles + astralSnowTiles + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + } + } +} diff --git a/Systems/DownedBossSystem.cs b/Systems/DownedBossSystem.cs new file mode 100644 index 0000000000..31456e3d6f --- /dev/null +++ b/Systems/DownedBossSystem.cs @@ -0,0 +1,613 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +// This does not use the Systems directory in its namespace for the sake of allowing ease of access. +// It can be changed at some point in the future if really necessary but there are hundreds of references to downed bools and it just +// sounds like more trouble than it's worth. +namespace CalamityMod +{ + public class DownedBossSystem : ModSystem + { + private static bool _downedDesertScourge = false; + private static bool _downedCrabulon = false; + private static bool _downedHiveMind = false; + private static bool _downedPerforator = false; + private static bool _downedSlimeGod = false; + private static bool _downedCryogen = false; + private static bool _downedAquaticScourge = false; + private static bool _downedBrimstoneElemental = false; + private static bool _downedCalamitas = false; + private static bool _downedLeviathan = false; + private static bool _downedAstrageldon = false; + private static bool _downedStarGod = false; + private static bool _downedPlaguebringer = false; + private static bool _downedScavenger = false; + private static bool _downedBoomerDuke = false; + private static bool _downedGuardians = false; + private static bool _downedProvidence = false; + private static bool _downedSentinel1 = false; // Ceaseless Void + private static bool _downedSentinel2 = false; // Storm Weaver + private static bool _downedSentinel3 = false; // Signus, Envoy of the Devourer + private static bool _downedSecondSentinels = false; + private static bool _downedPolterghast = false; + private static bool _downedDoG = false; + private static bool _downedBumble = false; + private static bool _downedYharon = false; + private static bool _downedExoMechs = false; + private static bool _downedSCal = false; + private static bool _downedAdultEidolonWyrm = false; + private static bool _downedGSS = false; + private static bool _downedCLAM = false; + private static bool _downedCLAMHardMode = false; + private static bool _downedBetsy = false; // Betsy + + // These are purely used for loot drops, nothing else + private static bool _downedAres = false; + private static bool _downedThanatos = false; + private static bool _downedArtemisAndApollo = false; + + private static bool _downedEoCAcidRain = false; + private static bool _downedAquaticScourgeAcidRain = false; + + public static bool downedDesertScourge + { + get => _downedDesertScourge; + set + { + if (!value) + _downedDesertScourge = false; + else + NPC.SetEventFlagCleared(ref _downedDesertScourge, -1); + } + } + public static bool downedCrabulon + { + get => _downedCrabulon; + set + { + if (!value) + _downedCrabulon = false; + else + NPC.SetEventFlagCleared(ref _downedCrabulon, -1); + } + } + public static bool downedHiveMind + { + get => _downedHiveMind; + set + { + if (!value) + _downedHiveMind = false; + else + NPC.SetEventFlagCleared(ref _downedHiveMind, -1); + } + } + public static bool downedPerforator + { + get => _downedPerforator; + set + { + if (!value) + _downedPerforator = false; + else + NPC.SetEventFlagCleared(ref _downedPerforator, -1); + } + } + public static bool downedSlimeGod + { + get => _downedSlimeGod; + set + { + if (!value) + _downedSlimeGod = false; + else + NPC.SetEventFlagCleared(ref _downedSlimeGod, -1); + } + } + public static bool downedCryogen + { + get => _downedCryogen; + set + { + if (!value) + _downedCryogen = false; + else + NPC.SetEventFlagCleared(ref _downedCryogen, -1); + } + } + public static bool downedAquaticScourge + { + get => _downedAquaticScourge; + set + { + if (!value) + _downedAquaticScourge = false; + else + NPC.SetEventFlagCleared(ref _downedAquaticScourge, -1); + } + } + public static bool downedBrimstoneElemental + { + get => _downedBrimstoneElemental; + set + { + if (!value) + _downedBrimstoneElemental = false; + else + NPC.SetEventFlagCleared(ref _downedBrimstoneElemental, -1); + } + } + public static bool downedCalamitas + { + get => _downedCalamitas; + set + { + if (!value) + _downedCalamitas = false; + else + NPC.SetEventFlagCleared(ref _downedCalamitas, -1); + } + } + public static bool downedLeviathan + { + get => _downedLeviathan; + set + { + if (!value) + _downedLeviathan = false; + else + NPC.SetEventFlagCleared(ref _downedLeviathan, -1); + } + } + public static bool downedAstrageldon + { + get => _downedAstrageldon; + set + { + if (!value) + _downedAstrageldon = false; + else + NPC.SetEventFlagCleared(ref _downedAstrageldon, -1); + } + } + public static bool downedStarGod + { + get => _downedStarGod; + set + { + if (!value) + _downedStarGod = false; + else + NPC.SetEventFlagCleared(ref _downedStarGod, -1); + } + } + public static bool downedPlaguebringer + { + get => _downedPlaguebringer; + set + { + if (!value) + _downedPlaguebringer = false; + else + NPC.SetEventFlagCleared(ref _downedPlaguebringer, -1); + } + } + public static bool downedScavenger + { + get => _downedScavenger; + set + { + if (!value) + _downedScavenger = false; + else + NPC.SetEventFlagCleared(ref _downedScavenger, -1); + } + } + public static bool downedBoomerDuke + { + get => _downedBoomerDuke; + set + { + if (!value) + _downedBoomerDuke = false; + else + NPC.SetEventFlagCleared(ref _downedBoomerDuke, -1); + } + } + public static bool downedGuardians + { + get => _downedGuardians; + set + { + if (!value) + _downedGuardians = false; + else + NPC.SetEventFlagCleared(ref _downedGuardians, -1); + } + } + public static bool downedProvidence + { + get => _downedProvidence; + set + { + if (!value) + _downedProvidence = false; + else + NPC.SetEventFlagCleared(ref _downedProvidence, -1); + } + } + // Ceaseless Void + public static bool downedSentinel1 + { + get => _downedSentinel1; + set + { + if (!value) + _downedSentinel1 = false; + else + NPC.SetEventFlagCleared(ref _downedSentinel1, -1); + } + } + // Storm Weaver + public static bool downedSentinel2 + { + get => _downedSentinel2; + set + { + if (!value) + _downedSentinel2 = false; + else + NPC.SetEventFlagCleared(ref _downedSentinel2, -1); + } + } + // Signus, Envoy of the Devourer + public static bool downedSentinel3 + { + get => _downedSentinel3; + set + { + if (!value) + _downedSentinel3 = false; + else + NPC.SetEventFlagCleared(ref _downedSentinel3, -1); + } + } + public static bool downedSecondSentinels + { + get => _downedSecondSentinels; + set => _downedSecondSentinels = value; + } + public static bool downedPolterghast + { + get => _downedPolterghast; + set + { + if (!value) + _downedPolterghast = false; + else + NPC.SetEventFlagCleared(ref _downedPolterghast, -1); + } + } + public static bool downedDoG + { + get => _downedDoG; + set + { + if (!value) + _downedDoG = false; + else + NPC.SetEventFlagCleared(ref _downedDoG, -1); + } + } + public static bool downedBumble + { + get => _downedBumble; + set + { + if (!value) + _downedBumble = false; + else + NPC.SetEventFlagCleared(ref _downedBumble, -1); + } + } + public static bool downedYharon + { + get => _downedYharon; + set + { + if (!value) + _downedYharon = false; + else + NPC.SetEventFlagCleared(ref _downedYharon, -1); + } + } + public static bool downedExoMechs + { + get => _downedExoMechs; + set + { + if (!value) + _downedExoMechs = false; + else + NPC.SetEventFlagCleared(ref _downedExoMechs, -1); + } + } + public static bool downedSCal + { + get => _downedSCal; + set + { + if (!value) + _downedSCal = false; + else + NPC.SetEventFlagCleared(ref _downedSCal, -1); + } + } + public static bool downedAdultEidolonWyrm + { + get => _downedAdultEidolonWyrm; + set + { + if (!value) + _downedAdultEidolonWyrm = false; + else + NPC.SetEventFlagCleared(ref _downedAdultEidolonWyrm, -1); + } + } + public static bool downedGSS + { + get => _downedGSS; + set + { + if (!value) + _downedGSS = false; + else + NPC.SetEventFlagCleared(ref _downedGSS, -1); + } + } + public static bool downedCLAM + { + get => _downedCLAM; + set + { + if (!value) + _downedCLAM = false; + else + NPC.SetEventFlagCleared(ref _downedCLAM, -1); + } + } + public static bool downedCLAMHardMode + { + get => _downedCLAMHardMode; + set + { + if (!value) + _downedCLAMHardMode = false; + else + NPC.SetEventFlagCleared(ref _downedCLAMHardMode, -1); + } + } + public static bool downedBetsy + { + get => _downedBetsy; + set + { + if (!value) + _downedBetsy = false; + else + NPC.SetEventFlagCleared(ref _downedBetsy, -1); + } + } + + // These are purely used for loot drops, nothing else + public static bool downedAres + { + get => _downedAres; + set => _downedAres = value; + } + public static bool downedThanatos + { + get => _downedThanatos; + set => _downedThanatos = value; + } + public static bool downedArtemisAndApollo + { + get => _downedArtemisAndApollo; + set => _downedArtemisAndApollo = value; + } + + public static bool downedEoCAcidRain + { + get => _downedEoCAcidRain; + set + { + if (!value) + _downedEoCAcidRain = false; + else + NPC.SetEventFlagCleared(ref _downedEoCAcidRain, -1); + } + } + public static bool downedAquaticScourgeAcidRain + { + get => _downedAquaticScourgeAcidRain; + set + { + if (!value) + _downedAquaticScourgeAcidRain = false; + else + NPC.SetEventFlagCleared(ref _downedAquaticScourgeAcidRain, -1); + } + } + + internal static void ResetAllFlags() + { + downedDesertScourge = false; + downedAquaticScourge = false; + downedHiveMind = false; + downedPerforator = false; + downedSlimeGod = false; + downedCryogen = false; + downedBrimstoneElemental = false; + downedCalamitas = false; + downedLeviathan = false; + downedDoG = false; + downedPlaguebringer = false; + downedScavenger = false; + downedGuardians = false; + downedProvidence = false; + downedSentinel1 = false; + downedSentinel2 = false; + downedSentinel3 = false; + downedYharon = false; + downedExoMechs = false; + downedAres = false; + downedThanatos = false; + downedArtemisAndApollo = false; + downedSCal = false; + downedAdultEidolonWyrm = false; + downedCLAM = false; + downedCLAMHardMode = false; + downedBumble = false; + downedCrabulon = false; + downedBetsy = false; + downedStarGod = false; + downedAstrageldon = false; + downedPolterghast = false; + downedGSS = false; + downedBoomerDuke = false; + downedSecondSentinels = false; + downedEoCAcidRain = false; + downedAquaticScourgeAcidRain = false; + } + + public override void OnWorldLoad() => ResetAllFlags(); + + public override void OnWorldUnload() => ResetAllFlags(); + + public override void SaveWorldData(TagCompound tag) + { + List downed = new List(); + + if (downedDesertScourge) + downed.Add("desertScourge"); + if (downedAquaticScourge) + downed.Add("aquaticScourge"); + if (downedHiveMind) + downed.Add("hiveMind"); + if (downedPerforator) + downed.Add("perforator"); + if (downedSlimeGod) + downed.Add("slimeGod"); + if (downedCryogen) + downed.Add("cryogen"); + if (downedBrimstoneElemental) + downed.Add("brimstoneElemental"); + if (downedCalamitas) + downed.Add("calamitas"); + if (downedLeviathan) + downed.Add("leviathan"); + if (downedDoG) + downed.Add("devourerOfGods"); + if (downedPlaguebringer) + downed.Add("plaguebringerGoliath"); + if (downedGuardians) + downed.Add("guardians"); + if (downedProvidence) + downed.Add("providence"); + if (downedSentinel1) + downed.Add("ceaselessVoid"); + if (downedSentinel2) + downed.Add("stormWeaver"); + if (downedSentinel3) + downed.Add("signus"); + if (downedSecondSentinels) + downed.Add("secondSentinels"); + if (downedYharon) + downed.Add("yharon"); + if (downedExoMechs) + downed.Add("exoMechs"); + if (downedAres) + downed.Add("ares"); + if (downedThanatos) + downed.Add("thanatos"); + if (downedArtemisAndApollo) + downed.Add("artemisAndApollo"); + if (downedSCal) + downed.Add("supremeCalamitas"); + if (downedAdultEidolonWyrm) + downed.Add("adultEidolonWyrm"); + if (downedBumble) + downed.Add("bumblebirb"); + if (downedCrabulon) + downed.Add("crabulon"); + if (downedBetsy) + downed.Add("betsy"); + if (downedScavenger) + downed.Add("scavenger"); + if (downedStarGod) + downed.Add("starGod"); + if (downedAstrageldon) + downed.Add("astrageldon"); + if (downedPolterghast) + downed.Add("polterghast"); + if (downedGSS) + downed.Add("greatSandShark"); + if (downedBoomerDuke) + downed.Add("oldDuke"); + if (downedCLAM) + downed.Add("clam"); + if (downedCLAMHardMode) + downed.Add("clamHardmode"); + if (downedEoCAcidRain) + downed.Add("eocRain"); + if (downedAquaticScourgeAcidRain) + downed.Add("hmRain"); + + tag["downedFlags"] = downed; + } + + public override void LoadWorldData(TagCompound tag) + { + IList downed = tag.GetList("downedFlags"); + downedDesertScourge = downed.Contains("desertScourge"); + downedAquaticScourge = downed.Contains("aquaticScourge"); + downedHiveMind = downed.Contains("hiveMind"); + downedPerforator = downed.Contains("perforator"); + downedSlimeGod = downed.Contains("slimeGod"); + downedCryogen = downed.Contains("cryogen"); + downedBrimstoneElemental = downed.Contains("brimstoneElemental"); + downedCalamitas = downed.Contains("calamitas"); + downedLeviathan = downed.Contains("leviathan"); + downedDoG = downed.Contains("devourerOfGods"); + downedPlaguebringer = downed.Contains("plaguebringerGoliath"); + downedGuardians = downed.Contains("guardians"); + downedProvidence = downed.Contains("providence"); + downedSentinel1 = downed.Contains("ceaselessVoid"); + downedSentinel2 = downed.Contains("stormWeaver"); + downedSentinel3 = downed.Contains("signus"); + downedSecondSentinels = downed.Contains("secondSentinels"); + downedYharon = downed.Contains("yharon"); + downedExoMechs = downed.Contains("exoMechs"); + downedAres = downed.Contains("ares"); + downedThanatos = downed.Contains("thanatos"); + downedArtemisAndApollo = downed.Contains("artemisAndApollo"); + downedSCal = downed.Contains("supremeCalamitas"); + downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); + downedBumble = downed.Contains("bumblebirb"); + downedCrabulon = downed.Contains("crabulon"); + downedBetsy = downed.Contains("betsy"); + downedScavenger = downed.Contains("scavenger"); + downedStarGod = downed.Contains("starGod"); + downedAstrageldon = downed.Contains("astrageldon"); + downedPolterghast = downed.Contains("polterghast"); + downedGSS = downed.Contains("greatSandShark"); + downedBoomerDuke = downed.Contains("oldDuke"); + downedCLAM = downed.Contains("clam"); + downedCLAMHardMode = downed.Contains("clamHardmode"); + downedEoCAcidRain = downed.Contains("eocRain"); + downedAquaticScourgeAcidRain = downed.Contains("hmRain"); + } + } +} diff --git a/Systems/EntityUpdateInterceptionSystem.cs b/Systems/EntityUpdateInterceptionSystem.cs new file mode 100644 index 0000000000..9011003356 --- /dev/null +++ b/Systems/EntityUpdateInterceptionSystem.cs @@ -0,0 +1,43 @@ +using CalamityMod.Particles; +using CalamityMod.TileEntities; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class EntityUpdateInterceptionSystem : ModSystem + { + #region Fusable Particle Updating + public override void PostUpdateProjectiles() + { + // Update all fusable particles. + // These are really only visual and as such don't really need any complex netcode. + foreach (BaseFusableParticleSet.FusableParticleRenderCollection particleSet in FusableParticleManager.ParticleSets) + { + foreach (BaseFusableParticleSet.FusableParticle particle in particleSet.ParticleSet.Particles) + particleSet.ParticleSet.UpdateBehavior(particle); + } + } + #endregion + + #region Ash Drawing + public override void PostUpdateDusts() => DeathAshParticle.UpdateAll(); + #endregion Ash Drawing + + #region Post NPC Updating + // TODO - Apply caching to this process. For now most of the looping issues should be eradicated but it can be reduced further. + public override void PostUpdateNPCs() => CalamityGlobalNPC.ResetTownNPCNameBools(); + #endregion + + #region Tile Entity Time Handler + public override void PostUpdateTime() => TileEntityTimeHandler.Update(); + #endregion + + #region Particles updating + public override void PostUpdateEverything() + { + if (!Main.dedServ) + GeneralParticleHandler.Update(); + } + #endregion + } +} diff --git a/Systems/LightingEffectsSystem.cs b/Systems/LightingEffectsSystem.cs new file mode 100644 index 0000000000..f218566b25 --- /dev/null +++ b/Systems/LightingEffectsSystem.cs @@ -0,0 +1,96 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class LightingEffectsSystem : ModSystem + { + public const float MaxSignusDarkness = -0.4f; + public const float MaxAbyssDarkness = -0.7f; + public override void ModifyLightingBrightness(ref float scale) + { + // Apply the calculated darkness value for the local player. + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f); + + if (modPlayer.ZoneAbyss) + scale += MaxAbyssDarkness * darkRatio; + + if (CalamityWorld.revenge) + { + if (CalamityGlobalNPC.signus != -1) + { + if (Main.npc[CalamityGlobalNPC.signus].active) + { + if (Vector2.Distance(Main.LocalPlayer.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) + { + float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); + + // Reduce the power of Signus darkness based on your light level. + float multiplier = 1f; + switch (modPlayer.GetTotalLightStrength()) + { + case 0: + break; + case 1: + case 2: + multiplier = 0.75f; + break; + case 3: + case 4: + multiplier = 0.5f; + break; + case 5: + case 6: + multiplier = 0.25f; + break; + default: + multiplier = 0f; + break; + } + + // Increased darkness in Death Mode + if (CalamityWorld.death) + multiplier += (1f - multiplier) * 0.1f; + + // Total darkness + float signusDarkness = signusLifeRatio * multiplier; + darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); + scale += MaxSignusDarkness * darkRatio; + } + } + } + } + } + + public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor) + { + if (Main.gameMenu) + BossRushEvent.StartTimer = 0; + + float bossRushWhiteFade = BossRushEvent.StartTimer / (float)BossRushEvent.StartEffectTotalTime; + if (BossRushSky.ShouldDrawRegularly) + bossRushWhiteFade = 1f; + + if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0 || BossRushSky.ShouldDrawRegularly) + { + backgroundColor = Color.Lerp(backgroundColor, Color.LightGray, bossRushWhiteFade); + tileColor = Color.Lerp(tileColor, Color.LightGray, bossRushWhiteFade); + } + else if (SkyManager.Instance["CalamityMod:ExoMechs"].IsActive()) + { + float intensity = SkyManager.Instance["CalamityMod:ExoMechs"].Opacity; + backgroundColor = Color.Lerp(backgroundColor, Color.DarkGray, intensity * 0.9f); + backgroundColor = Color.Lerp(backgroundColor, Color.Black, intensity * 0.67f); + tileColor = Color.Lerp(tileColor, Color.DarkGray, intensity * 0.8f); + tileColor = Color.Lerp(tileColor, Color.Black, intensity * 0.3f); + } + } + } +} diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs new file mode 100644 index 0000000000..fa5474d2b8 --- /dev/null +++ b/Systems/MiscWorldStateSystem.cs @@ -0,0 +1,283 @@ +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Events; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.World.CalamityWorld; + +namespace CalamityMod +{ + public class MiscWorldStateSystem : ModSystem + { + #region Resetting + public static void ResetWorldData() + { + NPC.LunarShieldPowerExpert = 100; + + CalamityGlobalNPC.holyBoss = -1; + CalamityGlobalNPC.doughnutBoss = -1; + CalamityGlobalNPC.doughnutBossDefender = -1; + CalamityGlobalNPC.doughnutBossHealer = -1; + CalamityGlobalNPC.voidBoss = -1; + CalamityGlobalNPC.energyFlame = -1; + CalamityGlobalNPC.hiveMind = -1; + CalamityGlobalNPC.scavenger = -1; + + for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) + CalamityGlobalNPC.bobbitWormBottom[i] = -1; + + CalamityGlobalNPC.DoGHead = -1; + CalamityGlobalNPC.SCal = -1; + CalamityGlobalNPC.ghostBoss = -1; + CalamityGlobalNPC.laserEye = -1; + CalamityGlobalNPC.fireEye = -1; + CalamityGlobalNPC.brimstoneElemental = -1; + CalamityGlobalNPC.signus = -1; + CalamityGlobalNPC.draedonExoMechPrimePlasmaCannon = -1; + CalamityGlobalNPC.draedonExoMechPrime = -1; + CalamityGlobalNPC.draedonExoMechTwinGreen = -1; + CalamityGlobalNPC.draedonExoMechTwinRed = -1; + CalamityGlobalNPC.draedonExoMechWorm = -1; + CalamityGlobalNPC.adultEidolonWyrmHead = -1; + BossRushEvent.BossRushStage = 0; + DoGSecondStageCountdown = 0; + ArmoredDiggerSpawnCooldown = 0; + BossRushEvent.BossRushActive = false; + BossRushEvent.BossRushSpawnCountdown = 180; + bossRushHostileProjKillCounter = 0; + newAltarX = 0; + newAltarY = 0; + abyssChasmBottom = 0; + abyssSide = false; + + spawnedBandit = false; + spawnedCirrus = false; + foundHomePermafrost = false; + + anglerName = false; + armsDealerName = false; + clothierName = false; + cyborgName = false; + demolitionistName = false; + dryadName = false; + dyeTraderName = false; + goblinTinkererName = false; + guideName = false; + mechanicName = false; + merchantName = false; + nurseName = false; + painterName = false; + partyGirlName = false; + pirateName = false; + skeletonMerchantName = false; + steampunkerName = false; + stylistName = false; + tavernkeepName = false; + taxCollectorName = false; + travelingMerchantName = false; + truffleName = false; + witchDoctorName = false; + wizardName = false; + onionMode = false; + revenge = false; + TalkedToDraedon = false; + death = false; + armageddon = false; + malice = false; + rainingAcid = false; + forceRainTimer = 0; + } + + public override void OnWorldLoad() => ResetWorldData(); + + public override void OnWorldUnload() => ResetWorldData(); + #endregion + + #region Saving/Loading + public override void SaveWorldData(TagCompound tag) + { + var downed = new List(); + if (onionMode) + downed.Add("onionMode"); + if (TalkedToDraedon) + downed.Add("TalkedToDraedon"); + if (revenge) + downed.Add("revenge"); + if (death) + downed.Add("death"); + if (malice) + downed.Add("malice"); + if (abyssSide) + downed.Add("abyssSide"); + if (BossRushEvent.BossRushActive) + downed.Add("bossRushActive"); + if (rainingAcid) + downed.Add("acidRain"); + if (spawnedBandit) + downed.Add("bandit"); + if (spawnedCirrus) + downed.Add("drunkPrincess"); + if (foundHomePermafrost) + downed.Add("archmageHome"); + + #region Save NPC Names + if (anglerName) + downed.Add("anglerName"); + if (armsDealerName) + downed.Add("armsDealerName"); + if (clothierName) + downed.Add("clothierName"); + if (cyborgName) + downed.Add("cyborgName"); + if (demolitionistName) + downed.Add("demolitionistName"); + if (dryadName) + downed.Add("dryadName"); + if (dyeTraderName) + downed.Add("dyeTraderName"); + if (goblinTinkererName) + downed.Add("goblinTinkererName"); + if (guideName) + downed.Add("guideName"); + if (mechanicName) + downed.Add("mechanicName"); + if (merchantName) + downed.Add("merchantName"); + if (nurseName) + downed.Add("nurseName"); + if (painterName) + downed.Add("painterName"); + if (partyGirlName) + downed.Add("partyGirlName"); + if (pirateName) + downed.Add("pirateName"); + if (skeletonMerchantName) + downed.Add("skeletonMerchantName"); + if (steampunkerName) + downed.Add("steampunkerName"); + if (stylistName) + downed.Add("stylistName"); + if (tavernkeepName) + downed.Add("tavernkeepName"); + if (taxCollectorName) + downed.Add("taxCollectorName"); + if (travelingMerchantName) + downed.Add("travelingMerchantName"); + if (truffleName) + downed.Add("truffleName"); + if (witchDoctorName) + downed.Add("witchDoctorName"); + if (wizardName) + downed.Add("wizardName"); + #endregion + + if (triedToSummonOldDuke) + downed.Add("spawnedBoomer"); + if (startAcidicDownpour) + downed.Add("startDownpour"); + if (forcedRainAlready) + downed.Add("forcedRain"); + if (forcedDownpourWithTear) + downed.Add("forcedTear"); + if (encounteredOldDuke) + downed.Add("encounteredOldDuke"); + if (HasGeneratedLuminitePlanetoids) + downed.Add("HasGeneratedLuminitePlanetoids"); + downed.AddWithCondition("IsWorldAfterDraedonUpdate", IsWorldAfterDraedonUpdate); + + downed.AddWithCondition("TinOreWorld", OreTypes[0] == TileID.Tin); + downed.AddWithCondition("LeadOreWorld", OreTypes[1] == TileID.Lead); + downed.AddWithCondition("TungstenOreWorld", OreTypes[2] == TileID.Tungsten); + downed.AddWithCondition("PlatinumOreWorld", OreTypes[3] == TileID.Platinum); + + RecipeUnlockHandler.Save(downed); + + tag["downed"] = downed; + tag["abyssChasmBottom"] = abyssChasmBottom; + tag["acidRainPoints"] = acidRainPoints; + tag["Reforges"] = Reforges; + tag["MoneyStolenByBandit"] = MoneyStolenByBandit; + + tag["SunkenSeaLabCenter"] = SunkenSeaLabCenter; + tag["PlanetoidLabCenter"] = PlanetoidLabCenter; + tag["JungleLabCenter"] = JungleLabCenter; + tag["HellLabCenter"] = HellLabCenter; + tag["IceLabCenter"] = IceLabCenter; + } + + public override void LoadWorldData(TagCompound tag) + { + var downed = tag.GetList("downed"); + TalkedToDraedon = downed.Contains("TalkedToDraedon"); + onionMode = downed.Contains("onionMode"); + revenge = downed.Contains("revenge"); + death = downed.Contains("death"); + malice = downed.Contains("malice"); + abyssSide = downed.Contains("abyssSide"); + BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); + rainingAcid = downed.Contains("acidRain"); + + spawnedBandit = downed.Contains("bandit"); + spawnedCirrus = downed.Contains("drunkPrincess"); + foundHomePermafrost = downed.Contains("archmageHome"); + + #region Load NPC Names + anglerName = downed.Contains("anglerName"); + armsDealerName = downed.Contains("armsDealerName"); + clothierName = downed.Contains("clothierName"); + cyborgName = downed.Contains("cyborgName"); + demolitionistName = downed.Contains("demolitionistName"); + dryadName = downed.Contains("dryadName"); + dyeTraderName = downed.Contains("dyeTraderName"); + goblinTinkererName = downed.Contains("goblinTinkererName"); + guideName = downed.Contains("guideName"); + mechanicName = downed.Contains("mechanicName"); + merchantName = downed.Contains("merchantName"); + nurseName = downed.Contains("nurseName"); + painterName = downed.Contains("painterName"); + partyGirlName = downed.Contains("partyGirlName"); + pirateName = downed.Contains("pirateName"); + skeletonMerchantName = downed.Contains("skeletonMerchantName"); + steampunkerName = downed.Contains("steampunkerName"); + stylistName = downed.Contains("stylistName"); + tavernkeepName = downed.Contains("tavernkeepName"); + taxCollectorName = downed.Contains("taxCollectorName"); + travelingMerchantName = downed.Contains("travelingMerchantName"); + truffleName = downed.Contains("truffleName"); + witchDoctorName = downed.Contains("witchDoctorName"); + wizardName = downed.Contains("wizardName"); + #endregion + + triedToSummonOldDuke = downed.Contains("spawnedBoomer"); + startAcidicDownpour = downed.Contains("startDownpour"); + forcedRainAlready = downed.Contains("forcedRain"); + forcedDownpourWithTear = downed.Contains("forcedTear"); + encounteredOldDuke = downed.Contains("encounteredOldDuke"); + HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids"); + IsWorldAfterDraedonUpdate = downed.Contains("IsWorldAfterDraedonUpdate"); + + OreTypes[0] = downed.Contains("TinOreWorld") ? TileID.Tin : TileID.Copper; + OreTypes[1] = downed.Contains("LeadOreWorld") ? TileID.Lead : TileID.Iron; + OreTypes[2] = downed.Contains("TungstenOreWorld") ? TileID.Tungsten : TileID.Silver; + OreTypes[3] = downed.Contains("PlatinumOreWorld") ? TileID.Platinum : TileID.Gold; + + RecipeUnlockHandler.Load(downed); + + abyssChasmBottom = tag.GetInt("abyssChasmBottom"); + acidRainPoints = tag.GetInt("acidRainPoints"); + Reforges = tag.GetInt("Reforges"); + MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); + + SunkenSeaLabCenter = tag.Get("SunkenSeaLabCenter"); + PlanetoidLabCenter = tag.Get("PlanetoidLabCenter"); + JungleLabCenter = tag.Get("JungleLabCenter"); + HellLabCenter = tag.Get("HellLabCenter"); + IceLabCenter = tag.Get("IceLabCenter"); + } + #endregion Saving/Loading + } +} diff --git a/Systems/SpeedrunTimerStoppingSystem.cs b/Systems/SpeedrunTimerStoppingSystem.cs new file mode 100644 index 0000000000..c67b0b3911 --- /dev/null +++ b/Systems/SpeedrunTimerStoppingSystem.cs @@ -0,0 +1,9 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class SpeedrunTimerStoppingSystem : ModSystem + { + public override void PreSaveAndQuit() => CalamityMod.SpeedrunTimer?.Stop(); + } +} diff --git a/Systems/UIManagementSystem.cs b/Systems/UIManagementSystem.cs new file mode 100644 index 0000000000..78fe851054 --- /dev/null +++ b/Systems/UIManagementSystem.cs @@ -0,0 +1,160 @@ +using System.Collections.Generic; +using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; +using Terraria; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.Systems +{ + public class UIManagementSystem : ModSystem + { + public override void ModifyInterfaceLayers(List layers) + { + int buffDisplayIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Resource Bars"); + if (buffDisplayIndex != -1) + { + layers.Insert(buffDisplayIndex, new LegacyGameInterfaceLayer("Cooldown Rack UI", delegate () + { + CooldownRackUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.UI)); + } + + int mouseIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Mouse Text"); + if (mouseIndex != -1) + { + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () + { + if (Main.LocalPlayer.Calamity().drawBossHPBar) + { + BossHealthBarManager.Update(); + BossHealthBarManager.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Hologram", () => + { + LabHologramProjectorUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // For these layers, InterfaceScaleType.Game tells the game that this UI should take zoom into account. + // These must be separate layers or they will malfunction when hovering one at non-100% zoom. + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charging Station UI", () => + { + ChargingStationUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.Game)); + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Power Cell Factory UI", () => + { + PowerCellFactoryUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.Game)); + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () + { + if (Main.LocalPlayer.Calamity().drawBossHPBar) + { + BossHealthBarManager.Update(); + BossHealthBarManager.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + + // Mode Indicator UI. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Mode Indicator UI", delegate () + { + ModeIndicatorUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.UI)); + + // Astral Arcanum overlay (if open) + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () + { + AstralArcanumUI.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // Rage and Adrenaline bars + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Rage and Adrenaline UI", delegate () + { + RipperUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + + // Stealth bar + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Stealth UI", () => + { + StealthUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + + // Charge meter + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charge UI", () => + { + ChargeMeterUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + + // Enchantment meters + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Enchantment Meters", () => + { + EnchantmentMetersUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + + // Calamitas Enchantment UI + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Calamitas Enchantment", () => + { + CalamitasEnchantUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // Codebreaker UI. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Codebreaker Decryption GUI", () => + { + CodebreakerUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // Popup GUIs. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => + { + PopupGUIManager.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // Exo Mech selection. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Exo Mech Selection", () => + { + if (Main.LocalPlayer.Calamity().AbleToSelectExoMech) + ExoMechSelectionUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + // Defense damage indicator. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Defense Damage Indicator", () => + { + if (Main.EquipPage != 1 && Main.EquipPage != 2) + DefenseDamageDisplayUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + } + + // Invasion UIs. + int invasionIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Diagnose Net"); + if (invasionIndex != -1) + { + layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Calamity Invasion UIs", () => + { + InvasionProgressUIManager.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + } + } + } +} diff --git a/World/WorldUpdateMiscEffects.cs b/Systems/WorldMiscUpdateSystem.cs similarity index 90% rename from World/WorldUpdateMiscEffects.cs rename to Systems/WorldMiscUpdateSystem.cs index 99a5ef7af0..6deac3066e 100644 --- a/World/WorldUpdateMiscEffects.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.Items.SummonItems; @@ -16,15 +16,17 @@ using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.World.CalamityWorld; -namespace CalamityMod.World +namespace CalamityMod.Systems { - public partial class CalamityWorld : ModWorld + public class WorldMiscUpdateSystem : ModSystem { - public override void PostUpdate() + public override void PostUpdateWorld() { // Reset this int because it causes bugs with other mods if you delete Dr. Draedon through abnormal means if (!NPC.AnyNPCs(ModContent.NPCType())) @@ -92,7 +94,7 @@ namespace CalamityMod.World } // Disable sandstorms if the Desert Scourge is still alive and Hardmode hasn't begun. - if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) + if (!DownedBossSystem.downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) CalamityUtils.StopSandstorm(); // Attempt to summon lab critters manually since they refuse to exist when using vanilla's spawn methods. @@ -123,10 +125,16 @@ namespace CalamityMod.World { // Fire a giant laser into the sky. if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) - Projectile.NewProjectile(DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + { + IEntitySource source = new EntitySource_WorldEvent(); + Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + } if (DraedonSummonCountdown == 0) - NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + { + IEntitySource source = new EntitySource_WorldEvent(); + NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + } } #endregion Handle Draedon Summoning @@ -135,7 +143,7 @@ namespace CalamityMod.World public static void HandleTileGrowth() { int l = 0; - float mult2 = 1.5E-05f * Main.worldRate; + float mult2 = (float)(1.5E-05f * WorldGen.GetWorldUpdateRate()); while (l < Main.maxTilesX * Main.maxTilesY * mult2) { int x = WorldGen.genRand.Next(10, Main.maxTilesX - 10); @@ -147,7 +155,7 @@ namespace CalamityMod.World if (Main.tile[x, y] != null) { - if (Main.tile[x, y].nactive()) + if (Main.tile[x, y].HasUnactuatedTile) { if (Main.tile[x, y].LiquidAmount <= 32) { @@ -166,7 +174,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherBulbs; j < y + minDistanceFromOtherBulbs; j += 2) { - if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].TileType == TileID.PlanteraBulb) + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.PlanteraBulb) { placeBulb = false; break; @@ -200,7 +208,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherFruit; j < y + minDistanceFromOtherFruit; j += 2) { - if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].active() && Main.tile[i, j].TileType == TileID.LifeFruit) + if (i > 1 && i < Main.maxTilesX - 2 && j > 1 && j < Main.maxTilesY - 2 && Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LifeFruit) { placeFruit = false; break; @@ -225,7 +233,7 @@ namespace CalamityMod.World } int tileType = Main.tile[x, y].TileType; - bool tenebris = tileType == ModContent.TileType() && downedCalamitas; + bool tenebris = tileType == ModContent.TileType() && DownedBossSystem.downedCalamitas; if (CalamityGlobalTile.GrowthTiles.Contains(tileType) || tenebris) { @@ -256,9 +264,9 @@ namespace CalamityMod.World if (Main.tile[x, y] != null) { Tile tile = Main.tile[x, y]; - bool growTile = tenebris ? (tile.active() && tile.TileType == ModContent.TileType()) : (!tile.active() && tile.liquid >= 128); + bool growTile = tenebris ? (tile.HasTile && tile.TileType == ModContent.TileType()) : (!tile.HasTile && tile.LiquidAmount >= 128); bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); - bool meetsAdditionalGrowConditions = tile.slope() == 0 && !tile.IsHalfBlock && !tile.lava(); + bool meetsAdditionalGrowConditions = tile.Slope == 0 && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) { @@ -277,20 +285,20 @@ namespace CalamityMod.World if (!tenebris) { - tile.active(true); - if (Main.tile[x, y + 1].active() && Main.tileSolid[Main.tile[x, y + 1].TileType] && Main.tile[x, y + 1].slope() == 0 && !Main.tile[x, y + 1].IsHalfBlock) + tile.HasTile = true; + if (Main.tile[x, y + 1].HasTile && Main.tileSolid[Main.tile[x, y + 1].TileType] && Main.tile[x, y + 1].Slope == 0 && !Main.tile[x, y + 1].IsHalfBlock) { tile.TileFrameY = 0; } - else if (Main.tile[x, y - 1].active() && Main.tileSolid[Main.tile[x, y - 1].TileType] && Main.tile[x, y - 1].slope() == 0 && !Main.tile[x, y - 1].IsHalfBlock) + else if (Main.tile[x, y - 1].HasTile && Main.tileSolid[Main.tile[x, y - 1].TileType] && Main.tile[x, y - 1].Slope == 0 && !Main.tile[x, y - 1].IsHalfBlock) { tile.TileFrameY = 18; } - else if (Main.tile[x + 1, y].active() && Main.tileSolid[Main.tile[x + 1, y].TileType] && Main.tile[x + 1, y].slope() == 0 && !Main.tile[x + 1, y].IsHalfBlock) + else if (Main.tile[x + 1, y].HasTile && Main.tileSolid[Main.tile[x + 1, y].TileType] && Main.tile[x + 1, y].Slope == 0 && !Main.tile[x + 1, y].IsHalfBlock) { tile.TileFrameY = 36; } - else if (Main.tile[x - 1, y].active() && Main.tileSolid[Main.tile[x - 1, y].TileType] && Main.tile[x - 1, y].slope() == 0 && !Main.tile[x - 1, y].IsHalfBlock) + else if (Main.tile[x - 1, y].HasTile && Main.tileSolid[Main.tile[x - 1, y].TileType] && Main.tile[x - 1, y].Slope == 0 && !Main.tile[x - 1, y].IsHalfBlock) { tile.TileFrameY = 54; } @@ -315,7 +323,7 @@ namespace CalamityMod.World public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !downedCalamitas) + if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitas) return false; int minDistanceFromOtherTiles = 6; @@ -324,7 +332,7 @@ namespace CalamityMod.World { for (int j = y - minDistanceFromOtherTiles; j < y + minDistanceFromOtherTiles; j++) { - if (Main.tile[i, j].active() && Main.tile[i, j].TileType == tileType) + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == tileType) { sameTilesNearby++; if (sameTilesNearby > 1) @@ -387,7 +395,7 @@ namespace CalamityMod.World spawnRate *= 0.6D; if (player.enemySpawns) spawnRate *= 0.7D; - if (Main.waterCandles > 0) + if (Main.SceneMetrics.WaterCandleCount > 0) spawnRate *= 0.8D; if (modPlayer.bossZen || DoGSecondStageCountdown > 0) @@ -398,7 +406,7 @@ namespace CalamityMod.World spawnRate *= 1.67D; if (player.calmed) spawnRate *= 1.43D; - if (Main.peaceCandles > 0) + if (Main.SceneMetrics.PeaceCandleCount > 0) spawnRate *= 1.25D; if (player.HasItem(ModContent.ItemType())) spawnRate *= 5D; diff --git a/Systems/WorldSyncingSystem.cs b/Systems/WorldSyncingSystem.cs new file mode 100644 index 0000000000..9df1b773ad --- /dev/null +++ b/Systems/WorldSyncingSystem.cs @@ -0,0 +1,287 @@ +using System.IO; +using CalamityMod.CustomRecipes; +using CalamityMod.Events; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.DownedBossSystem; +using static CalamityMod.World.CalamityWorld; + +namespace CalamityMod.Systems +{ + public class WorldSyncingSystem : ModSystem + { + #region NetSend + public override void NetSend(BinaryWriter writer) + { + BitsByte flags = new BitsByte(); + flags[0] = downedDesertScourge; + flags[1] = downedHiveMind; + flags[2] = downedPerforator; + flags[3] = downedSlimeGod; + flags[4] = downedCryogen; + flags[5] = downedBrimstoneElemental; + flags[6] = downedCalamitas; + flags[7] = downedLeviathan; + + BitsByte flags2 = new BitsByte(); + flags2[0] = downedDoG; + flags2[1] = downedPlaguebringer; + flags2[2] = downedGuardians; + flags2[3] = downedProvidence; + flags2[4] = downedSentinel1; + flags2[5] = downedSentinel2; + flags2[6] = downedSentinel3; + flags2[7] = downedYharon; + + // Don't write meaningful values for the now-unused vanilla boss booleans + BitsByte flags3 = new BitsByte(); + flags3[0] = downedSCal; + flags3[1] = downedBumble; + flags3[2] = downedCrabulon; + flags3[3] = downedBetsy; + flags3[4] = downedScavenger; + flags3[5] = false; + flags3[6] = false; + flags3[7] = false; + + BitsByte flags4 = new BitsByte(); + flags4[0] = false; + flags4[1] = false; + flags4[2] = false; + flags4[3] = false; + flags4[4] = false; + flags4[5] = false; + flags4[6] = onionMode; + flags4[7] = revenge; + + BitsByte flags5 = new BitsByte(); + flags5[0] = downedStarGod; + flags5[1] = spawnedBandit; + flags5[2] = spawnedCirrus; + flags5[3] = startAcidicDownpour; + flags5[4] = false; + flags5[5] = downedPolterghast; + flags5[6] = death; + flags5[7] = downedGSS; + + BitsByte flags6 = new BitsByte(); + flags6[0] = abyssSide; + flags6[1] = downedAquaticScourge; + flags6[2] = downedAstrageldon; + flags6[3] = false; + flags6[4] = armageddon; + flags6[5] = false; + flags6[6] = false; + flags6[7] = false; + + BitsByte flags7 = new BitsByte(); + flags7[0] = BossRushEvent.BossRushActive; + flags7[1] = downedBoomerDuke; + flags7[2] = downedCLAM; + flags7[3] = false; + flags7[4] = rainingAcid; + flags7[5] = downedEoCAcidRain; + flags7[6] = downedAquaticScourgeAcidRain; + flags7[7] = triedToSummonOldDuke; + + BitsByte flags8 = new BitsByte(); + flags8[0] = forcedRainAlready; + flags8[1] = forcedDownpourWithTear; + flags8[2] = downedSecondSentinels; + flags8[3] = foundHomePermafrost; + flags8[4] = downedCLAMHardMode; + flags8[5] = guideName; + flags8[6] = wizardName; + flags8[7] = steampunkerName; + + BitsByte flags9 = new BitsByte(); + flags9[0] = stylistName; + flags9[1] = witchDoctorName; + flags9[2] = taxCollectorName; + flags9[3] = pirateName; + flags9[4] = mechanicName; + flags9[5] = armsDealerName; + flags9[6] = dryadName; + flags9[7] = nurseName; + + BitsByte flags10 = new BitsByte(); + flags10[0] = anglerName; + flags10[1] = clothierName; + flags10[2] = encounteredOldDuke; + flags10[3] = travelingMerchantName; + flags10[4] = false; + flags10[5] = false; + flags10[6] = false; + flags10[7] = false; + + BitsByte flags11 = new BitsByte(); + flags11[0] = malice; + flags11[1] = HasGeneratedLuminitePlanetoids; + flags11[2] = downedAdultEidolonWyrm; + flags11[3] = downedExoMechs; + flags11[4] = downedAres; + flags11[5] = downedThanatos; + flags11[6] = downedArtemisAndApollo; + flags11[7] = TalkedToDraedon; + + writer.Write(flags); + writer.Write(flags2); + writer.Write(flags3); + writer.Write(flags4); + writer.Write(flags5); + writer.Write(flags6); + writer.Write(flags7); + writer.Write(flags8); + writer.Write(flags9); + writer.Write(flags10); + writer.Write(flags11); + + RecipeUnlockHandler.SendData(writer); + + writer.Write(abyssChasmBottom); + writer.Write(acidRainPoints); + writer.Write(Reforges); + writer.Write(MoneyStolenByBandit); + writer.Write(DraedonSummonCountdown); + writer.Write((int)DraedonMechToSummon); + writer.WriteVector2(DraedonSummonPosition); + writer.WriteVector2(SunkenSeaLabCenter); + writer.WriteVector2(PlanetoidLabCenter); + writer.WriteVector2(JungleLabCenter); + writer.WriteVector2(HellLabCenter); + writer.WriteVector2(IceLabCenter); + } + #endregion + + #region NetReceive + public override void NetReceive(BinaryReader reader) + { + BitsByte flags = reader.ReadByte(); + downedDesertScourge = flags[0]; + downedHiveMind = flags[1]; + downedPerforator = flags[2]; + downedSlimeGod = flags[3]; + downedCryogen = flags[4]; + downedBrimstoneElemental = flags[5]; + downedCalamitas = flags[6]; + downedLeviathan = flags[7]; + + BitsByte flags2 = reader.ReadByte(); + downedDoG = flags2[0]; + downedPlaguebringer = flags2[1]; + downedGuardians = flags2[2]; + downedProvidence = flags2[3]; + downedSentinel1 = flags2[4]; + downedSentinel2 = flags2[5]; + downedSentinel3 = flags2[6]; + downedYharon = flags2[7]; + + // Explicitly discard the now-unused vanilla boss booleans + BitsByte flags3 = reader.ReadByte(); + downedSCal = flags3[0]; + downedBumble = flags3[1]; + downedCrabulon = flags3[2]; + downedBetsy = flags3[3]; + downedScavenger = flags3[4]; + _ = flags3[5]; + _ = flags3[6]; + _ = flags3[7]; + + BitsByte flags4 = reader.ReadByte(); + _ = flags4[0]; + _ = flags4[1]; + _ = flags4[2]; + _ = flags4[3]; + _ = flags4[4]; + _ = flags4[5]; + onionMode = flags4[6]; + revenge = flags4[7]; + + BitsByte flags5 = reader.ReadByte(); + downedStarGod = flags5[0]; + spawnedBandit = flags5[1]; + spawnedCirrus = flags5[2]; + startAcidicDownpour = flags5[3]; + _ = flags5[4]; + downedPolterghast = flags5[5]; + death = flags5[6]; + downedGSS = flags5[7]; + + BitsByte flags6 = reader.ReadByte(); + abyssSide = flags6[0]; + downedAquaticScourge = flags6[1]; + downedAstrageldon = flags6[2]; + _ = flags6[3]; + armageddon = flags6[4]; + _ = flags6[5]; + _ = flags6[6]; + _ = flags6[7]; + + BitsByte flags7 = reader.ReadByte(); + BossRushEvent.BossRushActive = flags7[0]; + downedBoomerDuke = flags7[1]; + downedCLAM = flags7[2]; + _ = flags7[3]; + rainingAcid = flags7[4]; + downedEoCAcidRain = flags7[5]; + downedAquaticScourgeAcidRain = flags7[6]; + triedToSummonOldDuke = flags7[7]; + + BitsByte flags8 = reader.ReadByte(); + forcedRainAlready = flags8[0]; + forcedDownpourWithTear = flags8[1]; + downedSecondSentinels = flags8[2]; + foundHomePermafrost = flags8[3]; + downedCLAMHardMode = flags8[4]; + guideName = flags8[5]; + wizardName = flags8[6]; + steampunkerName = flags8[7]; + + BitsByte flags9 = reader.ReadByte(); + stylistName = flags9[0]; + witchDoctorName = flags9[1]; + taxCollectorName = flags9[2]; + pirateName = flags9[3]; + mechanicName = flags9[4]; + armsDealerName = flags9[5]; + dryadName = flags9[6]; + nurseName = flags9[7]; + + BitsByte flags10 = reader.ReadByte(); + anglerName = flags10[0]; + clothierName = flags10[1]; + encounteredOldDuke = flags10[2]; + travelingMerchantName = flags10[3]; + _ = flags10[4]; + _ = flags10[5]; + _ = flags10[6]; + _ = flags10[7]; + + BitsByte flags11 = reader.ReadByte(); + malice = flags11[0]; + HasGeneratedLuminitePlanetoids = flags11[1]; + downedAdultEidolonWyrm = flags11[2]; + downedExoMechs = flags11[3]; + downedAres = flags11[4]; + downedThanatos = flags11[5]; + downedArtemisAndApollo = flags11[6]; + TalkedToDraedon = flags11[7]; + + RecipeUnlockHandler.ReceiveData(reader); + + abyssChasmBottom = reader.ReadInt32(); + acidRainPoints = reader.ReadInt32(); + Reforges = reader.ReadInt32(); + MoneyStolenByBandit = reader.ReadInt32(); + DraedonSummonCountdown = reader.ReadInt32(); + DraedonMechToSummon = (ExoMech)reader.ReadInt32(); + DraedonSummonPosition = reader.ReadVector2(); + SunkenSeaLabCenter = reader.ReadVector2(); + PlanetoidLabCenter = reader.ReadVector2(); + JungleLabCenter = reader.ReadVector2(); + HellLabCenter = reader.ReadVector2(); + IceLabCenter = reader.ReadVector2(); + } + #endregion + } +} diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs new file mode 100644 index 0000000000..a7a17f773d --- /dev/null +++ b/Systems/WorldgenManagementSystem.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.World; +using CalamityMod.World.Planets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.World.CalamityWorld; + +namespace CalamityMod.Systems +{ + public class WorldgenManagementSystem : ModSystem + { + #region PreWorldGen + public override void PreWorldGen() + { + numAbyssIslands = 0; + roxShrinePlaced = false; + + // This will only be applied at world-gen time to new worlds. + // Old worlds will never receive this marker naturally. + IsWorldAfterDraedonUpdate = true; + } + #endregion + + #region ModifyWorldGenTasks + public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) + { + int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); + if (islandIndex != -1) + { + tasks.Insert(islandIndex + 2, new PassLegacy("EvilIsland", (progress, config) => + { + progress.Message = "Corrupting a floating island"; + WorldEvilIsland.PlaceEvilIsland(); + })); + } + + int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); + if (DungeonChestIndex != -1) + { + tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", MiscWorldgenRoutines.GenerateBiomeChests)); + } + + int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); + if (WaterFromSandIndex != -1) + { + tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", (progress, config) => + { + progress.Message = "Making the world more wet"; + SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); + })); + } + + int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); + tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => + { + progress.Message = "Building a bigger jungle temple"; + CustomTemple.NewJungleTemple(); + }); + + int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); + tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => + { + progress.Message = "Building a bigger jungle temple"; + Main.tileSolid[162] = false; + Main.tileSolid[226] = true; + CustomTemple.NewJungleTemplePart2(); + Main.tileSolid[232] = false; + }); + + int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); + tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => + { + progress.Message = "Placing the Lihzahrd altar"; + CustomTemple.NewJungleTempleLihzahrdAltar(); + }); + + int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); + if (FinalIndex != -1) + { + //Not touching this yet because the Crags will be reworked in the future + #region BrimstoneCrag + tasks.Insert(FinalIndex + 1, new PassLegacy("BrimstoneCrag", (progress, config) => + { + progress.Message = "Uncovering the ruins of a fallen empire"; + + int x = Main.maxTilesX; + + int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); + int yUnderworldGen = Main.maxTilesY - 100; + + fuhX = xUnderworldGen; + fuhY = yUnderworldGen; + + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); + + MiscWorldgenRoutines.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + MiscWorldgenRoutines.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); + + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); + })); + #endregion + + int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (SulphurIndex != -1) + { + tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", (progress, config) => + { + progress.Message = "Polluting the ocean"; + SulphurousSea.PlaceSulphurSea(); + })); + } + + tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", (progress, config) => + { + progress.Message = "Placing Special Shrines"; + UndergroundShrines.PlaceShrines(); + })); + + + tasks.Insert(FinalIndex + 3, new PassLegacy("Rust and Dust", (progress, config) => + { + List workshopPositions = new List(); + int workshopCount = Main.maxTilesX / 900; + int labCount = Main.maxTilesX / 1500; + + DraedonStructures.PlaceHellLab(out Point hellPlacementPosition, workshopPositions); + workshopPositions.Add(hellPlacementPosition); + + DraedonStructures.PlaceSunkenSeaLab(out Point sunkenSeaPlacementPosition, workshopPositions); + workshopPositions.Add(sunkenSeaPlacementPosition); + + DraedonStructures.PlaceIceLab(out Point icePlacementPosition, workshopPositions); + workshopPositions.Add(icePlacementPosition); + + DraedonStructures.PlacePlagueLab(out Point plaguePlacementPosition, workshopPositions); + workshopPositions.Add(plaguePlacementPosition); + + for (int i = 0; i < workshopCount; i++) + { + DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions); + workshopPositions.Add(placementPosition); + } + for (int i = 0; i < labCount; i++) + { + DraedonStructures.PlaceResearchFacility(out Point placementPosition, workshopPositions); + workshopPositions.Add(placementPosition); + } + })); + + tasks.Insert(FinalIndex + 4, new PassLegacy("Abyss", (progress, config) => + { + progress.Message = "Discovering the new Challenger Deep"; //Putting the Mariana Trench to shame + Abyss.PlaceAbyss(); + })); + + tasks.Insert(FinalIndex + 5, new PassLegacy("Sulphur2", (progress, config) => + { + progress.Message = "Polluting the ocean more"; + SulphurousSea.FinishGeneratingSulphurSea(); + })); + + tasks.Insert(FinalIndex + 6, new PassLegacy("IWannaRock", (progress, config) => + { + progress.Message = "I Wanna Rock"; + MiscWorldgenRoutines.PlaceRoxShrine(); + })); + + tasks.Insert(FinalIndex + 7, new PassLegacy("GoodGameDesignGemGen", (progress, config) => + { + progress.Message = "Good Game Design Gem Gen"; + MiscWorldgenRoutines.SmartGemGen(); + })); + } + + tasks.Add(new PassLegacy("Planetoid Test", Planetoid.GenerateAllBasePlanetoids)); + } + + // An Astral Meteor always falls at the beginning of Hardmode. + public override void ModifyHardmodeTasks(List tasks) + { + // Yes, this internal identifier is misspelled in vanilla. + int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcment"); + + // Insert the Astral biome generation right before the final hardmode announcement. + tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", (progress, config) => + { + AstralBiome.PlaceAstralMeteor(); + })); + } + #endregion + + #region PostWorldGen + public override void PostWorldGen() + { + // 60% chance of 3-5 Mining Potions + // 20% chance of 2-3 Builder's Potions + // 20% chance of 5-9 Shine Potions + WeightedItemStack[] replacementPotions = new WeightedItemStack[] + { + DropHelper.WeightStack(ItemID.MiningPotion, 0.6f, 3, 5), + DropHelper.WeightStack(ItemID.BuilderPotion, 0.2f, 2, 3), + DropHelper.WeightStack(ItemID.ShinePotion, 0.2f, 5, 9), + }; + + // Replace Suspicious Looking Eyes in Chests with random useful early game potions. + for (int chestIndex = 0; chestIndex < Main.maxChests; chestIndex++) + { + Chest chest = Main.chest[chestIndex]; + if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers) + { + bool isGoldChest = Main.tile[chest.x, chest.y].TileFrameX == 36; + bool isMahoganyChest = Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; + bool isIvyChest = Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; + bool isIceChest = Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; + if (isGoldChest || isMahoganyChest || isIvyChest || isIceChest) + { + for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) + { + if (chest.item[inventoryIndex].type == ItemID.SuspiciousLookingEye) + { + WeightedItemStack replacement = DropHelper.RollWeightedRandom(replacementPotions); + chest.item[inventoryIndex].SetDefaults(replacement.itemID); + chest.item[inventoryIndex].stack = replacement.ChooseQuantity(); + break; + } + } + } + } + } + + // Save the set of ores that got generated + OreTypes[0] = (ushort)WorldGen.copperBar; + OreTypes[1] = (ushort)WorldGen.ironBar; + OreTypes[2] = (ushort)WorldGen.silverBar; + OreTypes[3] = (ushort)WorldGen.goldBar; + } + #endregion + } +} diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index 27593a74e0..9f42f17de6 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Astral public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) { - if (!CalamityWorld.downedAstrageldon) + if (!DownedBossSystem.downedAstrageldon) return false; DustType = this.dustType; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 23baca5587..4b14d3e0c0 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Tiles if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY) return; Tile t = Main.tile[xPos, yPos]; - if (t != null && t.HasTile && (t.TileType == ModContent.TileType() || (t.TileType == ModContent.TileType() && CalamityWorld.downedDesertScourge))) + if (t != null && t.HasTile && (t.TileType == ModContent.TileType() || (t.TileType == ModContent.TileType() && DownedBossSystem.downedDesertScourge))) { WorldGen.KillTile(xPos, yPos, false, false, false); if (!Main.tile[xPos, yPos].HasTile && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 480bae624d..2b71db26f1 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - return CalamityWorld.downedStarGod; + return DownedBossSystem.downedStarGod; } public override bool CanExplode(int i, int j) diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 3ae39c46f2..b7c7d2ba34 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Tiles.SunkenSea public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override bool CanExplode(int i, int j) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 2b056761de..d334a15974 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Tiles.SunkenSea public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override bool CanExplode(int i, int j) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index a751312822..26490258c8 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Tiles.SunkenSea public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override bool CanExplode(int i, int j) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index c23a4129e5..c626d0343b 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Tiles.SunkenSea public override bool CanKillTile(int i, int j, ref bool blockDamaged) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override bool CanExplode(int i, int j) { - return CalamityWorld.downedDesertScourge; + return DownedBossSystem.downedDesertScourge; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 35d6b4bd97..47f857e1ae 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -83,20 +83,20 @@ namespace CalamityMod return 0; case PrefixID.Hard: - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) return 4; - else if (CalamityWorld.downedPolterghast || CalamityWorld.downedDoG) + else if (DownedBossSystem.downedPolterghast || DownedBossSystem.downedDoG) return 3; - else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || CalamityWorld.downedProvidence) + else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || DownedBossSystem.downedProvidence) return 2; return 1; case PrefixID.Guarding: - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) return 8; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) return 6; - else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedProvidence || DownedBossSystem.downedPolterghast) return 5; else if (NPC.downedGolemBoss || NPC.downedMoonlord) return 4; @@ -105,13 +105,13 @@ namespace CalamityMod return 2; case PrefixID.Armored: - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) return 11; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) return 9; - else if (CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedPolterghast) return 8; - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) return 7; else if (NPC.downedMoonlord) return 6; @@ -120,13 +120,13 @@ namespace CalamityMod return 3; case PrefixID.Warding: - if (CalamityWorld.downedYharon) + if (DownedBossSystem.downedYharon) return 15; - else if (CalamityWorld.downedDoG) + else if (DownedBossSystem.downedDoG) return 12; - else if (CalamityWorld.downedPolterghast) + else if (DownedBossSystem.downedPolterghast) return 10; - else if (CalamityWorld.downedProvidence) + else if (DownedBossSystem.downedProvidence) return 9; else if (NPC.downedMoonlord) return 8; diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index 6846c1727c..8529f66c66 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -1,21 +1,13 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Waters { public class AbyssWater : ModWaterStyle { - public override bool ChooseWaterStyle() - { - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return modPlayer.ZoneAbyss; - } - public override int ChooseWaterfallStyle() { - return Mod.GetWaterfallStyleSlot("AbyssWaterflow"); + return ModContent.Find("CalamityMod/Waters/AbyssWaterflow").Slot; } public override int GetSplashDust() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 78e7320dd7..be30c14135 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,21 +1,13 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Waters { public class AstralWater : ModWaterStyle { - public override bool ChooseWaterStyle() - { - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return modPlayer.ZoneAstral; - } - public override int ChooseWaterfallStyle() { - return Mod.GetWaterfallStyleSlot("AstralWaterflow"); + return ModContent.Find("CalamityMod/Waters/AstralWaterflow").Slot; } public override int GetSplashDust() @@ -25,7 +17,7 @@ namespace CalamityMod.Waters public override int GetDropletGore() { - return Mod.GetGoreSlot("Gores/AstralWaterDroplet"); + return ModContent.Find("CalamityMod/Gores/AstralWaterDroplet").Type; } public override Color BiomeHairColor() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index f9205f7e4f..bb8d15fdda 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,46 +1,13 @@ -using CalamityMod.CalPlayer; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Waters { public class SulphuricWater : ModWaterStyle { - public override bool ChooseWaterStyle() - { - int biomeWidth; - // Small world - if (Main.maxTilesX == 4200) - { - biomeWidth = 270; - } - // Medium world - else if (Main.maxTilesX == 6400) - { - biomeWidth = 365; - } - // Large world - else - { - biomeWidth = 430; - } - biomeWidth += 25; - bool inXZone = Main.LocalPlayer.Center.X < biomeWidth * 16f; - if (!CalamityWorld.abyssSide) - inXZone = Main.LocalPlayer.Center.X > Main.maxTilesX * 16f - biomeWidth * 16f; - - bool inYZone = Main.LocalPlayer.Center.Y < Main.rockLayer * 16f - 320 && Main.LocalPlayer.Center.Y >= 5800f; - - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - bool greenWater = (inXZone && inYZone) || modPlayer.ZoneSulphur; - return greenWater; - } - public override int ChooseWaterfallStyle() { - return Mod.GetWaterfallStyleSlot("SulphuricWaterflow"); + return ModContent.Find("CalamityMod/Waters/SulphuricWaterflow").Slot; } public override int GetSplashDust() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 7b3560e74f..ca2057d6c2 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -1,21 +1,13 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Waters { public class SunkenSeaWater : ModWaterStyle { - public override bool ChooseWaterStyle() - { - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return modPlayer.ZoneSunkenSea; - } - public override int ChooseWaterfallStyle() { - return Mod.GetWaterfallStyleSlot("SunkenSeaWaterflow"); + return ModContent.Find("CalamityMod/Waters/SunkenSeaWaterflow").Slot; } public override int GetSplashDust() diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ba23f40152..574420585e 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,32 +1,18 @@ -using CalamityMod.CustomRecipes; -using CalamityMod.Events; -using CalamityMod.NPCs; +using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Tiles.Abyss; -using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; -using CalamityMod.Tiles.AstralSnow; -using CalamityMod.Tiles.Crags; -using CalamityMod.Tiles.Ores; -using CalamityMod.Tiles.SunkenSea; -using CalamityMod.World.Planets; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.IO; using Terraria; -using Terraria.GameContent.Generation; -using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using Terraria.WorldBuilding; namespace CalamityMod.World { - public partial class CalamityWorld : ModWorld + // For the sake of ease of access of variables this class remains in its current form (there are likely thousands of references by now). + // However, all functionalities in the form of hooks have been cleared away in favor of split systems. + public static class CalamityWorld { #region Vars public static int DoGSecondStageCountdown = 0; @@ -58,15 +44,12 @@ namespace CalamityMod.World // Brimstone Crag public static int fuhX = 0; public static int fuhY = 0; - public static int calamityTiles = 0; // Abyss & Sulphur public static int numAbyssIslands = 0; public static int[] AbyssIslandX = new int[20]; public static int[] AbyssIslandY = new int[20]; public static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - public static int sulphurTiles = 0; - public static int abyssTiles = 0; public static bool abyssSide = false; public static int abyssChasmBottom = 0; public static bool rainingAcid; @@ -87,11 +70,7 @@ namespace CalamityMod.World } } - // Astral - public static int astralTiles = 0; - // Sunken Sea - public static int sunkenSeaTiles = 0; public static Rectangle SunkenSeaLocation = Rectangle.Empty; // Shrines @@ -169,1140 +148,6 @@ namespace CalamityMod.World public static Vector2 HellLabCenter; public static Vector2 IceLabCenter; - #region Downed Bools - public static bool downedDesertScourge = false; - public static bool downedCrabulon = false; - public static bool downedHiveMind = false; - public static bool downedPerforator = false; - public static bool downedSlimeGod = false; - public static bool downedCryogen = false; - public static bool downedAquaticScourge = false; - public static bool downedBrimstoneElemental = false; - public static bool downedCalamitas = false; - public static bool downedLeviathan = false; - public static bool downedAstrageldon = false; - public static bool downedStarGod = false; - public static bool downedPlaguebringer = false; - public static bool downedScavenger = false; - public static bool downedBoomerDuke = false; - public static bool downedGuardians = false; - public static bool downedProvidence = false; - public static bool downedSentinel1 = false; // Ceaseless Void - public static bool downedSentinel2 = false; // Storm Weaver - public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedSecondSentinels = false; - public static bool downedPolterghast = false; - public static bool downedDoG = false; - public static bool downedBumble = false; - public static bool downedYharon = false; - public static bool downedExoMechs = false; - public static bool downedSCal = false; - public static bool downedAdultEidolonWyrm = false; - public static bool downedGSS = false; - public static bool downedCLAM = false; - public static bool downedCLAMHardMode = false; - public static bool downedBetsy = false; // Betsy - - // These are purely used for loot drops, nothing else - public static bool downedAres = false; - public static bool downedThanatos = false; - public static bool downedArtemisAndApollo = false; - - public static bool downedEoCAcidRain = false; - public static bool downedAquaticScourgeAcidRain = false; - #endregion - - #endregion - - #region Initialize - public override void Initialize() - { - NPC.LunarShieldPowerExpert = 100; - - CalamityGlobalNPC.holyBoss = -1; - CalamityGlobalNPC.doughnutBoss = -1; - CalamityGlobalNPC.doughnutBossDefender = -1; - CalamityGlobalNPC.doughnutBossHealer = -1; - CalamityGlobalNPC.voidBoss = -1; - CalamityGlobalNPC.energyFlame = -1; - CalamityGlobalNPC.hiveMind = -1; - CalamityGlobalNPC.scavenger = -1; - - for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) - CalamityGlobalNPC.bobbitWormBottom[i] = -1; - - CalamityGlobalNPC.DoGHead = -1; - CalamityGlobalNPC.SCal = -1; - CalamityGlobalNPC.ghostBoss = -1; - CalamityGlobalNPC.laserEye = -1; - CalamityGlobalNPC.fireEye = -1; - CalamityGlobalNPC.brimstoneElemental = -1; - CalamityGlobalNPC.signus = -1; - CalamityGlobalNPC.draedonExoMechPrimePlasmaCannon = -1; - CalamityGlobalNPC.draedonExoMechPrime = -1; - CalamityGlobalNPC.draedonExoMechTwinGreen = -1; - CalamityGlobalNPC.draedonExoMechTwinRed = -1; - CalamityGlobalNPC.draedonExoMechWorm = -1; - CalamityGlobalNPC.adultEidolonWyrmHead = -1; - BossRushEvent.BossRushStage = 0; - DoGSecondStageCountdown = 0; - ArmoredDiggerSpawnCooldown = 0; - BossRushEvent.BossRushActive = false; - BossRushEvent.BossRushSpawnCountdown = 180; - bossRushHostileProjKillCounter = 0; - newAltarX = 0; - newAltarY = 0; - abyssChasmBottom = 0; - abyssSide = false; - - spawnedBandit = false; - spawnedCirrus = false; - foundHomePermafrost = false; - - anglerName = false; - armsDealerName = false; - clothierName = false; - cyborgName = false; - demolitionistName = false; - dryadName = false; - dyeTraderName = false; - goblinTinkererName = false; - guideName = false; - mechanicName = false; - merchantName = false; - nurseName = false; - painterName = false; - partyGirlName = false; - pirateName = false; - skeletonMerchantName = false; - steampunkerName = false; - stylistName = false; - tavernkeepName = false; - taxCollectorName = false; - travelingMerchantName = false; - truffleName = false; - witchDoctorName = false; - wizardName = false; - - downedDesertScourge = false; - downedAquaticScourge = false; - downedHiveMind = false; - downedPerforator = false; - downedSlimeGod = false; - downedCryogen = false; - downedBrimstoneElemental = false; - downedCalamitas = false; - downedLeviathan = false; - downedDoG = false; - downedPlaguebringer = false; - downedScavenger = false; - downedGuardians = false; - downedProvidence = false; - downedSentinel1 = false; - downedSentinel2 = false; - downedSentinel3 = false; - downedYharon = false; - downedExoMechs = false; - downedAres = false; - downedThanatos = false; - downedArtemisAndApollo = false; - TalkedToDraedon = false; - downedSCal = false; - downedAdultEidolonWyrm = false; - downedCLAM = false; - downedCLAMHardMode = false; - downedBumble = false; - downedCrabulon = false; - downedBetsy = false; - onionMode = false; - revenge = false; - downedStarGod = false; - downedAstrageldon = false; - downedPolterghast = false; - downedGSS = false; - downedBoomerDuke = false; - downedSecondSentinels = false; - death = false; - armageddon = false; - malice = false; - rainingAcid = false; - downedEoCAcidRain = false; - downedAquaticScourgeAcidRain = false; - forceRainTimer = 0; - } - #endregion - - #region Save - public override TagCompound Save() - { - var downed = new List(); - if (downedDesertScourge) - downed.Add("desertScourge"); - if (downedAquaticScourge) - downed.Add("aquaticScourge"); - if (downedHiveMind) - downed.Add("hiveMind"); - if (downedPerforator) - downed.Add("perforator"); - if (downedSlimeGod) - downed.Add("slimeGod"); - if (downedCryogen) - downed.Add("cryogen"); - if (downedBrimstoneElemental) - downed.Add("brimstoneElemental"); - if (downedCalamitas) - downed.Add("calamitas"); - if (downedLeviathan) - downed.Add("leviathan"); - if (downedDoG) - downed.Add("devourerOfGods"); - if (downedPlaguebringer) - downed.Add("plaguebringerGoliath"); - if (downedGuardians) - downed.Add("guardians"); - if (downedProvidence) - downed.Add("providence"); - if (downedSentinel1) - downed.Add("ceaselessVoid"); - if (downedSentinel2) - downed.Add("stormWeaver"); - if (downedSentinel3) - downed.Add("signus"); - if (downedSecondSentinels) - downed.Add("secondSentinels"); - if (downedYharon) - downed.Add("yharon"); - if (downedExoMechs) - downed.Add("exoMechs"); - if (downedAres) - downed.Add("ares"); - if (downedThanatos) - downed.Add("thanatos"); - if (downedArtemisAndApollo) - downed.Add("artemisAndApollo"); - if (TalkedToDraedon) - downed.Add("TalkedToDraedon"); - if (downedSCal) - downed.Add("supremeCalamitas"); - if (downedAdultEidolonWyrm) - downed.Add("adultEidolonWyrm"); - if (downedBumble) - downed.Add("bumblebirb"); - if (downedCrabulon) - downed.Add("crabulon"); - if (downedBetsy) - downed.Add("betsy"); - if (downedScavenger) - downed.Add("scavenger"); - if (onionMode) - downed.Add("onionMode"); - if (revenge) - downed.Add("revenge"); - if (downedStarGod) - downed.Add("starGod"); - if (downedAstrageldon) - downed.Add("astrageldon"); - if (downedPolterghast) - downed.Add("polterghast"); - if (downedGSS) - downed.Add("greatSandShark"); - if (downedBoomerDuke) - downed.Add("oldDuke"); - if (death) - downed.Add("death"); - if (malice) - downed.Add("malice"); - if (abyssSide) - downed.Add("abyssSide"); - if (BossRushEvent.BossRushActive) - downed.Add("bossRushActive"); - if (downedCLAM) - downed.Add("clam"); - if (downedCLAMHardMode) - downed.Add("clamHardmode"); - if (rainingAcid) - downed.Add("acidRain"); - if (spawnedBandit) - downed.Add("bandit"); - if (spawnedCirrus) - downed.Add("drunkPrincess"); - if (foundHomePermafrost) - downed.Add("archmageHome"); - - #region Save NPC Names - if (anglerName) - downed.Add("anglerName"); - if (armsDealerName) - downed.Add("armsDealerName"); - if (clothierName) - downed.Add("clothierName"); - if (cyborgName) - downed.Add("cyborgName"); - if (demolitionistName) - downed.Add("demolitionistName"); - if (dryadName) - downed.Add("dryadName"); - if (dyeTraderName) - downed.Add("dyeTraderName"); - if (goblinTinkererName) - downed.Add("goblinTinkererName"); - if (guideName) - downed.Add("guideName"); - if (mechanicName) - downed.Add("mechanicName"); - if (merchantName) - downed.Add("merchantName"); - if (nurseName) - downed.Add("nurseName"); - if (painterName) - downed.Add("painterName"); - if (partyGirlName) - downed.Add("partyGirlName"); - if (pirateName) - downed.Add("pirateName"); - if (skeletonMerchantName) - downed.Add("skeletonMerchantName"); - if (steampunkerName) - downed.Add("steampunkerName"); - if (stylistName) - downed.Add("stylistName"); - if (tavernkeepName) - downed.Add("tavernkeepName"); - if (taxCollectorName) - downed.Add("taxCollectorName"); - if (travelingMerchantName) - downed.Add("travelingMerchantName"); - if (truffleName) - downed.Add("truffleName"); - if (witchDoctorName) - downed.Add("witchDoctorName"); - if (wizardName) - downed.Add("wizardName"); - #endregion - - if (downedEoCAcidRain) - downed.Add("eocRain"); - if (downedAquaticScourgeAcidRain) - downed.Add("hmRain"); - if (triedToSummonOldDuke) - downed.Add("spawnedBoomer"); - if (startAcidicDownpour) - downed.Add("startDownpour"); - if (forcedRainAlready) - downed.Add("forcedRain"); - if (forcedDownpourWithTear) - downed.Add("forcedTear"); - if (encounteredOldDuke) - downed.Add("encounteredOldDuke"); - if (HasGeneratedLuminitePlanetoids) - downed.Add("HasGeneratedLuminitePlanetoids"); - downed.AddWithCondition("IsWorldAfterDraedonUpdate", IsWorldAfterDraedonUpdate); - - downed.AddWithCondition("TinOreWorld", OreTypes[0] == TileID.Tin); - downed.AddWithCondition("LeadOreWorld", OreTypes[1] == TileID.Lead); - downed.AddWithCondition("TungstenOreWorld", OreTypes[2] == TileID.Tungsten); - downed.AddWithCondition("PlatinumOreWorld", OreTypes[3] == TileID.Platinum); - - RecipeUnlockHandler.Save(downed); - - return new TagCompound - { - ["downed"] = downed, - ["abyssChasmBottom"] = abyssChasmBottom, - ["acidRainPoints"] = acidRainPoints, - ["Reforges"] = Reforges, - ["MoneyStolenByBandit"] = MoneyStolenByBandit, - - ["SunkenSeaLabCenter"] = SunkenSeaLabCenter, - ["PlanetoidLabCenter"] = PlanetoidLabCenter, - ["JungleLabCenter"] = JungleLabCenter, - ["HellLabCenter"] = HellLabCenter, - ["IceLabCenter"] = IceLabCenter - }; - } - #endregion - - #region Load - public override void Load(TagCompound tag) - { - var downed = tag.GetList("downed"); - downedDesertScourge = downed.Contains("desertScourge"); - downedAquaticScourge = downed.Contains("aquaticScourge"); - downedHiveMind = downed.Contains("hiveMind"); - downedPerforator = downed.Contains("perforator"); - downedSlimeGod = downed.Contains("slimeGod"); - downedCryogen = downed.Contains("cryogen"); - downedBrimstoneElemental = downed.Contains("brimstoneElemental"); - downedCalamitas = downed.Contains("calamitas"); - downedLeviathan = downed.Contains("leviathan"); - downedDoG = downed.Contains("devourerOfGods"); - downedPlaguebringer = downed.Contains("plaguebringerGoliath"); - downedGuardians = downed.Contains("guardians"); - downedProvidence = downed.Contains("providence"); - downedSentinel1 = downed.Contains("ceaselessVoid"); - downedSentinel2 = downed.Contains("stormWeaver"); - downedSentinel3 = downed.Contains("signus"); - downedSecondSentinels = downed.Contains("secondSentinels"); - downedYharon = downed.Contains("yharon"); - downedExoMechs = downed.Contains("exoMechs"); - downedAres = downed.Contains("ares"); - downedThanatos = downed.Contains("thanatos"); - downedArtemisAndApollo = downed.Contains("artemisAndApollo"); - TalkedToDraedon = downed.Contains("TalkedToDraedon"); - downedSCal = downed.Contains("supremeCalamitas"); - downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); - downedBumble = downed.Contains("bumblebirb"); - downedCrabulon = downed.Contains("crabulon"); - downedBetsy = downed.Contains("betsy"); - downedScavenger = downed.Contains("scavenger"); - onionMode = downed.Contains("onionMode"); - revenge = downed.Contains("revenge"); - downedStarGod = downed.Contains("starGod"); - downedAstrageldon = downed.Contains("astrageldon"); - downedPolterghast = downed.Contains("polterghast"); - downedGSS = downed.Contains("greatSandShark"); - downedBoomerDuke = downed.Contains("oldDuke"); - death = downed.Contains("death"); - malice = downed.Contains("malice"); - abyssSide = downed.Contains("abyssSide"); - BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); - downedCLAM = downed.Contains("clam"); - downedCLAMHardMode = downed.Contains("clamHardmode"); - rainingAcid = downed.Contains("acidRain"); - - spawnedBandit = downed.Contains("bandit"); - spawnedCirrus = downed.Contains("drunkPrincess"); - foundHomePermafrost = downed.Contains("archmageHome"); - - #region Load NPC Names - anglerName = downed.Contains("anglerName"); - armsDealerName = downed.Contains("armsDealerName"); - clothierName = downed.Contains("clothierName"); - cyborgName = downed.Contains("cyborgName"); - demolitionistName = downed.Contains("demolitionistName"); - dryadName = downed.Contains("dryadName"); - dyeTraderName = downed.Contains("dyeTraderName"); - goblinTinkererName = downed.Contains("goblinTinkererName"); - guideName = downed.Contains("guideName"); - mechanicName = downed.Contains("mechanicName"); - merchantName = downed.Contains("merchantName"); - nurseName = downed.Contains("nurseName"); - painterName = downed.Contains("painterName"); - partyGirlName = downed.Contains("partyGirlName"); - pirateName = downed.Contains("pirateName"); - skeletonMerchantName = downed.Contains("skeletonMerchantName"); - steampunkerName = downed.Contains("steampunkerName"); - stylistName = downed.Contains("stylistName"); - tavernkeepName = downed.Contains("tavernkeepName"); - taxCollectorName = downed.Contains("taxCollectorName"); - travelingMerchantName = downed.Contains("travelingMerchantName"); - truffleName = downed.Contains("truffleName"); - witchDoctorName = downed.Contains("witchDoctorName"); - wizardName = downed.Contains("wizardName"); - #endregion - - downedEoCAcidRain = downed.Contains("eocRain"); - downedAquaticScourgeAcidRain = downed.Contains("hmRain"); - triedToSummonOldDuke = downed.Contains("spawnedBoomer"); - startAcidicDownpour = downed.Contains("startDownpour"); - forcedRainAlready = downed.Contains("forcedRain"); - forcedDownpourWithTear = downed.Contains("forcedTear"); - encounteredOldDuke = downed.Contains("encounteredOldDuke"); - HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids"); - IsWorldAfterDraedonUpdate = downed.Contains("IsWorldAfterDraedonUpdate"); - - OreTypes[0] = downed.Contains("TinOreWorld") ? TileID.Tin : TileID.Copper; - OreTypes[1] = downed.Contains("LeadOreWorld") ? TileID.Lead : TileID.Iron; - OreTypes[2] = downed.Contains("TungstenOreWorld") ? TileID.Tungsten : TileID.Silver; - OreTypes[3] = downed.Contains("PlatinumOreWorld") ? TileID.Platinum : TileID.Gold; - - RecipeUnlockHandler.Load(downed); - - abyssChasmBottom = tag.GetInt("abyssChasmBottom"); - acidRainPoints = tag.GetInt("acidRainPoints"); - Reforges = tag.GetInt("Reforges"); - MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); - - SunkenSeaLabCenter = tag.Get("SunkenSeaLabCenter"); - PlanetoidLabCenter = tag.Get("PlanetoidLabCenter"); - JungleLabCenter = tag.Get("JungleLabCenter"); - HellLabCenter = tag.Get("HellLabCenter"); - IceLabCenter = tag.Get("IceLabCenter"); - } - #endregion - - #region LoadLegacy - public override void LoadLegacy(BinaryReader reader) - { - int loadVersion = reader.ReadInt32(); - abyssChasmBottom = reader.ReadInt32(); - acidRainPoints = reader.ReadInt32(); - Reforges = reader.ReadInt32(); - MoneyStolenByBandit = reader.ReadInt32(); - - if (loadVersion == 0) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; - - // Explicitly discard the now-unused vanilla boss booleans - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - _ = flags3[5]; - _ = flags3[6]; - _ = flags3[7]; - - BitsByte flags4 = reader.ReadByte(); - _ = flags4[0]; - _ = flags4[1]; - _ = flags4[2]; - _ = flags4[3]; - _ = flags4[4]; - _ = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; - - BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - spawnedBandit = flags5[1]; - spawnedCirrus = flags5[2]; - startAcidicDownpour = flags5[3]; - _ = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedGSS = flags5[7]; - - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - _ = flags6[3]; - armageddon = flags6[4]; - _ = flags6[5]; - _ = flags6[6]; - _ = flags6[7]; - - BitsByte flags7 = reader.ReadByte(); - BossRushEvent.BossRushActive = flags7[0]; - downedBoomerDuke = flags7[1]; - downedCLAM = flags7[2]; - _ = flags7[3]; - rainingAcid = flags7[4]; - downedEoCAcidRain = flags7[5]; - downedAquaticScourgeAcidRain = flags7[6]; - triedToSummonOldDuke = flags7[7]; - - BitsByte flags8 = reader.ReadByte(); - forcedRainAlready = flags8[0]; - forcedDownpourWithTear = flags8[1]; - downedSecondSentinels = flags8[2]; - foundHomePermafrost = flags8[3]; - downedCLAMHardMode = flags8[4]; - guideName = flags8[5]; - wizardName = flags8[6]; - steampunkerName = flags8[7]; - - BitsByte flags9 = reader.ReadByte(); - stylistName = flags9[0]; - witchDoctorName = flags9[1]; - taxCollectorName = flags9[2]; - pirateName = flags9[3]; - mechanicName = flags9[4]; - armsDealerName = flags9[5]; - dryadName = flags9[6]; - nurseName = flags9[7]; - - BitsByte flags10 = reader.ReadByte(); - anglerName = flags10[0]; - clothierName = flags10[1]; - encounteredOldDuke = flags10[2]; - travelingMerchantName = flags10[3]; - _ = flags10[4]; - _ = flags10[5]; - _ = flags10[6]; - _ = flags10[7]; - - BitsByte flags11 = reader.ReadByte(); - malice = flags11[0]; - HasGeneratedLuminitePlanetoids = flags11[1]; - downedAdultEidolonWyrm = flags11[2]; - downedExoMechs = flags11[3]; - downedAres = flags11[4]; - downedThanatos = flags11[5]; - downedArtemisAndApollo = flags11[6]; - TalkedToDraedon = flags11[7]; - } - else - { - ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); - } - } - #endregion - - #region NetSend - public override void NetSend(BinaryWriter writer) - { - BitsByte flags = new BitsByte(); - flags[0] = downedDesertScourge; - flags[1] = downedHiveMind; - flags[2] = downedPerforator; - flags[3] = downedSlimeGod; - flags[4] = downedCryogen; - flags[5] = downedBrimstoneElemental; - flags[6] = downedCalamitas; - flags[7] = downedLeviathan; - - BitsByte flags2 = new BitsByte(); - flags2[0] = downedDoG; - flags2[1] = downedPlaguebringer; - flags2[2] = downedGuardians; - flags2[3] = downedProvidence; - flags2[4] = downedSentinel1; - flags2[5] = downedSentinel2; - flags2[6] = downedSentinel3; - flags2[7] = downedYharon; - - // Don't write meaningful values for the now-unused vanilla boss booleans - BitsByte flags3 = new BitsByte(); - flags3[0] = downedSCal; - flags3[1] = downedBumble; - flags3[2] = downedCrabulon; - flags3[3] = downedBetsy; - flags3[4] = downedScavenger; - flags3[5] = false; - flags3[6] = false; - flags3[7] = false; - - BitsByte flags4 = new BitsByte(); - flags4[0] = false; - flags4[1] = false; - flags4[2] = false; - flags4[3] = false; - flags4[4] = false; - flags4[5] = false; - flags4[6] = onionMode; - flags4[7] = revenge; - - BitsByte flags5 = new BitsByte(); - flags5[0] = downedStarGod; - flags5[1] = spawnedBandit; - flags5[2] = spawnedCirrus; - flags5[3] = startAcidicDownpour; - flags5[4] = false; - flags5[5] = downedPolterghast; - flags5[6] = death; - flags5[7] = downedGSS; - - BitsByte flags6 = new BitsByte(); - flags6[0] = abyssSide; - flags6[1] = downedAquaticScourge; - flags6[2] = downedAstrageldon; - flags6[3] = false; - flags6[4] = armageddon; - flags6[5] = false; - flags6[6] = false; - flags6[7] = false; - - BitsByte flags7 = new BitsByte(); - flags7[0] = BossRushEvent.BossRushActive; - flags7[1] = downedBoomerDuke; - flags7[2] = downedCLAM; - flags7[3] = false; - flags7[4] = rainingAcid; - flags7[5] = downedEoCAcidRain; - flags7[6] = downedAquaticScourgeAcidRain; - flags7[7] = triedToSummonOldDuke; - - BitsByte flags8 = new BitsByte(); - flags8[0] = forcedRainAlready; - flags8[1] = forcedDownpourWithTear; - flags8[2] = downedSecondSentinels; - flags8[3] = foundHomePermafrost; - flags8[4] = downedCLAMHardMode; - flags8[5] = guideName; - flags8[6] = wizardName; - flags8[7] = steampunkerName; - - BitsByte flags9 = new BitsByte(); - flags9[0] = stylistName; - flags9[1] = witchDoctorName; - flags9[2] = taxCollectorName; - flags9[3] = pirateName; - flags9[4] = mechanicName; - flags9[5] = armsDealerName; - flags9[6] = dryadName; - flags9[7] = nurseName; - - BitsByte flags10 = new BitsByte(); - flags10[0] = anglerName; - flags10[1] = clothierName; - flags10[2] = encounteredOldDuke; - flags10[3] = travelingMerchantName; - flags10[4] = false; - flags10[5] = false; - flags10[6] = false; - flags10[7] = false; - - BitsByte flags11 = new BitsByte(); - flags11[0] = malice; - flags11[1] = HasGeneratedLuminitePlanetoids; - flags11[2] = downedAdultEidolonWyrm; - flags11[3] = downedExoMechs; - flags11[4] = downedAres; - flags11[5] = downedThanatos; - flags11[6] = downedArtemisAndApollo; - flags11[7] = TalkedToDraedon; - - writer.Write(flags); - writer.Write(flags2); - writer.Write(flags3); - writer.Write(flags4); - writer.Write(flags5); - writer.Write(flags6); - writer.Write(flags7); - writer.Write(flags8); - writer.Write(flags9); - writer.Write(flags10); - writer.Write(flags11); - - RecipeUnlockHandler.SendData(writer); - - writer.Write(abyssChasmBottom); - writer.Write(acidRainPoints); - writer.Write(Reforges); - writer.Write(MoneyStolenByBandit); - writer.Write(DraedonSummonCountdown); - writer.Write((int)DraedonMechToSummon); - writer.WriteVector2(DraedonSummonPosition); - writer.WriteVector2(SunkenSeaLabCenter); - writer.WriteVector2(PlanetoidLabCenter); - writer.WriteVector2(JungleLabCenter); - writer.WriteVector2(HellLabCenter); - writer.WriteVector2(IceLabCenter); - } - #endregion - - #region NetReceive - public override void NetReceive(BinaryReader reader) - { - BitsByte flags = reader.ReadByte(); - downedDesertScourge = flags[0]; - downedHiveMind = flags[1]; - downedPerforator = flags[2]; - downedSlimeGod = flags[3]; - downedCryogen = flags[4]; - downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; - downedLeviathan = flags[7]; - - BitsByte flags2 = reader.ReadByte(); - downedDoG = flags2[0]; - downedPlaguebringer = flags2[1]; - downedGuardians = flags2[2]; - downedProvidence = flags2[3]; - downedSentinel1 = flags2[4]; - downedSentinel2 = flags2[5]; - downedSentinel3 = flags2[6]; - downedYharon = flags2[7]; - - // Explicitly discard the now-unused vanilla boss booleans - BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; - downedBumble = flags3[1]; - downedCrabulon = flags3[2]; - downedBetsy = flags3[3]; - downedScavenger = flags3[4]; - _ = flags3[5]; - _ = flags3[6]; - _ = flags3[7]; - - BitsByte flags4 = reader.ReadByte(); - _ = flags4[0]; - _ = flags4[1]; - _ = flags4[2]; - _ = flags4[3]; - _ = flags4[4]; - _ = flags4[5]; - onionMode = flags4[6]; - revenge = flags4[7]; - - BitsByte flags5 = reader.ReadByte(); - downedStarGod = flags5[0]; - spawnedBandit = flags5[1]; - spawnedCirrus = flags5[2]; - startAcidicDownpour = flags5[3]; - _ = flags5[4]; - downedPolterghast = flags5[5]; - death = flags5[6]; - downedGSS = flags5[7]; - - BitsByte flags6 = reader.ReadByte(); - abyssSide = flags6[0]; - downedAquaticScourge = flags6[1]; - downedAstrageldon = flags6[2]; - _ = flags6[3]; - armageddon = flags6[4]; - _ = flags6[5]; - _ = flags6[6]; - _ = flags6[7]; - - BitsByte flags7 = reader.ReadByte(); - BossRushEvent.BossRushActive = flags7[0]; - downedBoomerDuke = flags7[1]; - downedCLAM = flags7[2]; - _ = flags7[3]; - rainingAcid = flags7[4]; - downedEoCAcidRain = flags7[5]; - downedAquaticScourgeAcidRain = flags7[6]; - triedToSummonOldDuke = flags7[7]; - - BitsByte flags8 = reader.ReadByte(); - forcedRainAlready = flags8[0]; - forcedDownpourWithTear = flags8[1]; - downedSecondSentinels = flags8[2]; - foundHomePermafrost = flags8[3]; - downedCLAMHardMode = flags8[4]; - guideName = flags8[5]; - wizardName = flags8[6]; - steampunkerName = flags8[7]; - - BitsByte flags9 = reader.ReadByte(); - stylistName = flags9[0]; - witchDoctorName = flags9[1]; - taxCollectorName = flags9[2]; - pirateName = flags9[3]; - mechanicName = flags9[4]; - armsDealerName = flags9[5]; - dryadName = flags9[6]; - nurseName = flags9[7]; - - BitsByte flags10 = reader.ReadByte(); - anglerName = flags10[0]; - clothierName = flags10[1]; - encounteredOldDuke = flags10[2]; - travelingMerchantName = flags10[3]; - _ = flags10[4]; - _ = flags10[5]; - _ = flags10[6]; - _ = flags10[7]; - - BitsByte flags11 = reader.ReadByte(); - malice = flags11[0]; - HasGeneratedLuminitePlanetoids = flags11[1]; - downedAdultEidolonWyrm = flags11[2]; - downedExoMechs = flags11[3]; - downedAres = flags11[4]; - downedThanatos = flags11[5]; - downedArtemisAndApollo = flags11[6]; - TalkedToDraedon = flags11[7]; - - RecipeUnlockHandler.ReceiveData(reader); - - abyssChasmBottom = reader.ReadInt32(); - acidRainPoints = reader.ReadInt32(); - Reforges = reader.ReadInt32(); - MoneyStolenByBandit = reader.ReadInt32(); - DraedonSummonCountdown = reader.ReadInt32(); - DraedonMechToSummon = (ExoMech)reader.ReadInt32(); - DraedonSummonPosition = reader.ReadVector2(); - SunkenSeaLabCenter = reader.ReadVector2(); - PlanetoidLabCenter = reader.ReadVector2(); - JungleLabCenter = reader.ReadVector2(); - HellLabCenter = reader.ReadVector2(); - IceLabCenter = reader.ReadVector2(); - } - #endregion - - #region Tiles - public override void ResetNearbyTileEffects() - { - calamityTiles = 0; - astralTiles = 0; - sunkenSeaTiles = 0; - sulphurTiles = 0; - abyssTiles = 0; - } - - public override void TileCountsAvailable(int[] tileCounts) - { - calamityTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - sunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - abyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - sulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - - #region Astral Stuff - int astralDesertTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - int astralSnowTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - - Main.sandTiles += astralDesertTiles; - Main.snowTiles += astralSnowTiles; - - astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - #endregion - } - #endregion - - #region PreWorldGen - public override void PreWorldGen() - { - numAbyssIslands = 0; - roxShrinePlaced = false; - - // This will only be applied at world-gen time to new worlds. - // Old worlds will never receive this marker naturally. - IsWorldAfterDraedonUpdate = true; - } - #endregion - - #region ModifyWorldGenTasks - public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) - { - int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); - if (islandIndex != -1) - { - tasks.Insert(islandIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) - { - progress.Message = "Corrupting a floating island"; - WorldEvilIsland.PlaceEvilIsland(); - })); - } - - int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); - if (DungeonChestIndex != -1) - { - tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", MiscWorldgenRoutines.GenerateBiomeChests)); - } - - int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); - if (WaterFromSandIndex != -1) - { - tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", delegate (GenerationProgress progress) - { - progress.Message = "Making the world more wet"; - SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); - })); - } - - int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); - tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", delegate (GenerationProgress progress) - { - progress.Message = "Building a bigger jungle temple"; - CustomTemple.NewJungleTemple(); - }); - - int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); - tasks[JungleTempleIndex2] = new PassLegacy("Temple", delegate (GenerationProgress progress) - { - progress.Message = "Building a bigger jungle temple"; - Main.tileSolid[162] = false; - Main.tileSolid[226] = true; - CustomTemple.NewJungleTemplePart2(); - Main.tileSolid[232] = false; - }); - - int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); - tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", delegate (GenerationProgress progress) - { - progress.Message = "Placing the Lihzahrd altar"; - CustomTemple.NewJungleTempleLihzahrdAltar(); - }); - - int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); - if (FinalIndex != -1) - { - //Not touching this yet because the Crags will be reworked in the future - #region BrimstoneCrag - tasks.Insert(FinalIndex + 1, new PassLegacy("BrimstoneCrag", delegate (GenerationProgress progress) - { - progress.Message = "Uncovering the ruins of a fallen empire"; - - int x = Main.maxTilesX; - - int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); - int yUnderworldGen = Main.maxTilesY - 100; - - fuhX = xUnderworldGen; - fuhY = yUnderworldGen; - - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - - MiscWorldgenRoutines.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - MiscWorldgenRoutines.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); - MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); - })); - #endregion - - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) - { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) - { - progress.Message = "Polluting the ocean"; - SulphurousSea.PlaceSulphurSea(); - })); - } - - tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) - { - progress.Message = "Placing Special Shrines"; - UndergroundShrines.PlaceShrines(); - })); - - - tasks.Insert(FinalIndex + 3, new PassLegacy("Rust and Dust", (GenerationProgress progress) => - { - List workshopPositions = new List(); - int workshopCount = Main.maxTilesX / 900; - int labCount = Main.maxTilesX / 1500; - - DraedonStructures.PlaceHellLab(out Point hellPlacementPosition, workshopPositions); - workshopPositions.Add(hellPlacementPosition); - - DraedonStructures.PlaceSunkenSeaLab(out Point sunkenSeaPlacementPosition, workshopPositions); - workshopPositions.Add(sunkenSeaPlacementPosition); - - DraedonStructures.PlaceIceLab(out Point icePlacementPosition, workshopPositions); - workshopPositions.Add(icePlacementPosition); - - DraedonStructures.PlacePlagueLab(out Point plaguePlacementPosition, workshopPositions); - workshopPositions.Add(plaguePlacementPosition); - - for (int i = 0; i < workshopCount; i++) - { - DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions); - workshopPositions.Add(placementPosition); - } - for (int i = 0; i < labCount; i++) - { - DraedonStructures.PlaceResearchFacility(out Point placementPosition, workshopPositions); - workshopPositions.Add(placementPosition); - } - })); - - tasks.Insert(FinalIndex + 4, new PassLegacy("Abyss", delegate (GenerationProgress progress) - { - progress.Message = "Discovering the new Challenger Deep"; //Putting the Mariana Trench to shame - Abyss.PlaceAbyss(); - })); - - tasks.Insert(FinalIndex + 5, new PassLegacy("Sulphur2", delegate (GenerationProgress progress) - { - progress.Message = "Polluting the ocean more"; - SulphurousSea.FinishGeneratingSulphurSea(); - })); - - tasks.Insert(FinalIndex + 6, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) - { - progress.Message = "I Wanna Rock"; - MiscWorldgenRoutines.PlaceRoxShrine(); - })); - - tasks.Insert(FinalIndex + 7, new PassLegacy("GoodGameDesignGemGen", delegate (GenerationProgress progress) - { - progress.Message = "Good Game Design Gem Gen"; - MiscWorldgenRoutines.SmartGemGen(); - })); - } - - tasks.Add(new PassLegacy("Planetoid Test", Planetoid.GenerateAllBasePlanetoids)); - } - - // An Astral Meteor always falls at the beginning of Hardmode. - public override void ModifyHardmodeTasks(List tasks) - { - // Yes, this internal identifier is misspelled in vanilla. - int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcment"); - - // Insert the Astral biome generation right before the final hardmode announcement. - tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", delegate (GenerationProgress progress) - { - AstralBiome.PlaceAstralMeteor(); - })); - } - #endregion - - #region PostWorldGen - public override void PostWorldGen() - { - // 60% chance of 3-5 Mining Potions - // 20% chance of 2-3 Builder's Potions - // 20% chance of 5-9 Shine Potions - WeightedItemStack[] replacementPotions = new WeightedItemStack[] - { - DropHelper.WeightStack(ItemID.MiningPotion, 0.6f, 3, 5), - DropHelper.WeightStack(ItemID.BuilderPotion, 0.2f, 2, 3), - DropHelper.WeightStack(ItemID.ShinePotion, 0.2f, 5, 9), - }; - - // Replace Suspicious Looking Eyes in Chests with random useful early game potions. - for (int chestIndex = 0; chestIndex < Main.maxChests; chestIndex++) - { - Chest chest = Main.chest[chestIndex]; - if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers) - { - bool isGoldChest = Main.tile[chest.x, chest.y].TileFrameX == 36; - bool isMahoganyChest = Main.tile[chest.x, chest.y].TileFrameX == 8 * 36; - bool isIvyChest = Main.tile[chest.x, chest.y].TileFrameX == 10 * 36; - bool isIceChest = Main.tile[chest.x, chest.y].TileFrameX == 11 * 36; - if (isGoldChest || isMahoganyChest || isIvyChest || isIceChest) - { - for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) - { - if (chest.item[inventoryIndex].type == ItemID.SuspiciousLookingEye) - { - WeightedItemStack replacement = DropHelper.RollWeightedRandom(replacementPotions); - chest.item[inventoryIndex].SetDefaults(replacement.itemID); - chest.item[inventoryIndex].stack = replacement.ChooseQuantity(); - break; - } - } - } - } - } - - // Save the set of ores that got generated - OreTypes[0] = WorldGen.CopperTierOre; - OreTypes[1] = WorldGen.IronTierOre; - OreTypes[2] = WorldGen.SilverTierOre; - OreTypes[3] = WorldGen.GoldTierOre; - } #endregion } } diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index c9fb0fea1f..bccb4201e1 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Tiles; @@ -13,6 +13,7 @@ using System; using System.Reflection; using Terraria; using Terraria.ID; +using Terraria.IO; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -21,7 +22,7 @@ namespace CalamityMod.World public class MiscWorldgenRoutines { #region Dungeon Biome Chests - public static void GenerateBiomeChests(GenerationProgress progress) + public static void GenerateBiomeChests(GenerationProgress progress, GameConfiguration config) { progress.Message = "Adding a new Biome Chest"; diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 5c0ba02e13..b9f41ca28e 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -1,4 +1,4 @@ -using CalamityMod.DataStructures; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -18,10 +18,10 @@ namespace CalamityMod.World.Planets { private ushort[] oreTypes = new ushort[] { - WorldGen.CopperTierOre == TileID.Copper ? TileID.Tin : TileID.Copper, - WorldGen.IronTierOre == TileID.Iron ? TileID.Lead : TileID.Iron, - WorldGen.SilverTierOre== TileID.Silver ? TileID.Tungsten : TileID.Silver, - WorldGen.GoldTierOre == TileID.Gold ? TileID.Platinum : TileID.Gold + WorldGen.copperBar == TileID.Copper ? TileID.Tin : TileID.Copper, + WorldGen.ironBar == TileID.Iron ? TileID.Lead : TileID.Iron, + WorldGen.silverBar == TileID.Silver ? TileID.Tungsten : TileID.Silver, + WorldGen.goldBar == TileID.Gold ? TileID.Platinum : TileID.Gold }; public override bool Place(Point origin, StructureMap structures) @@ -139,7 +139,7 @@ namespace CalamityMod.World.Planets { for (int x = origin.X - radius; x < origin.X + radius; x++) { - if (_tiles[x, topLayer].active() && Main.tileSolid[_tiles[x, topLayer].type]) + if (_tiles[x, topLayer].HasTile && Main.tileSolid[_tiles[x, topLayer].TileType]) { //We've found the highest tile goto TopLayerFound; @@ -156,11 +156,11 @@ namespace CalamityMod.World.Planets { for (int x = startX; x <= endX; x++) { - _tiles[x, y].active(true); - _tiles[x, y].type = brickType; + _tiles[x, y].HasTile = true; + _tiles[x, y].TileType = brickType; if (y == topLayer) { - _tiles[x, y].wall = WallID.None; + _tiles[x, y].WallType = WallID.None; } } if ((y - topLayer + 1) % 2 == 0) @@ -202,21 +202,21 @@ namespace CalamityMod.World.Planets { int campX = origin.X; int campY = origin.Y - radius - 3; - while (!Main.tile[campX, campY].active() || !Main.tileSolid[_tiles[campX, campY].type]) + while (!Main.tile[campX, campY].HasTile || !Main.tileSolid[_tiles[campX, campY].TileType]) { campY++; } campY--; int startCampX = campX; - while ((!_tiles[startCampX, campY].active() || !Main.tileSolid[_tiles[startCampX, campY].type]) && - _tiles[startCampX, campY + 1].active()) + while ((!_tiles[startCampX, campY].HasTile || !Main.tileSolid[_tiles[startCampX, campY].TileType]) && + _tiles[startCampX, campY + 1].HasTile) { startCampX--; } int endCampX = campX; - while ((!_tiles[endCampX, campY].active() || !Main.tileSolid[_tiles[endCampX, campY].type]) && - _tiles[endCampX, campY + 1].active()) + while ((!_tiles[endCampX, campY].HasTile || !Main.tileSolid[_tiles[endCampX, campY].TileType]) && + _tiles[endCampX, campY + 1].HasTile) { endCampX++; } diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index fb1fdf77f3..a38be6d9c0 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -1,7 +1,8 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.ID; +using Terraria.IO; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -11,7 +12,7 @@ namespace CalamityMod.World.Planets { private Rectangle _area; - public static void GenerateAllBasePlanetoids(GenerationProgress progress) + public static void GenerateAllBasePlanetoids(GenerationProgress progress, GameConfiguration config) { progress.Message = "Creating a new solar system";