diff --git a/CalamityMod.cs b/CalamityMod.cs index 85b15eaeb6..0b59d3db6c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -3733,6 +3733,7 @@ namespace CalamityMod case CalamityModMessageType.AcidRainSync: CalamityWorld.rainingAcid = reader.ReadBoolean(); CalamityWorld.acidRainPoints = reader.ReadInt32(); + CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32(); break; case CalamityModMessageType.AcidRainUIDrawFadeSync: CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32(); diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index dccee03419..4d72473cef 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Events // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); + public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed. + public const float BloodwormSpawnRate = 0.1f; // Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can. @@ -167,17 +169,16 @@ namespace CalamityMod.Events Main.numClouds = Main.numCloudsTemp; Main.windSpeedTemp = 0.72f; Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; Main.maxRaining = 0.89f; CalamityWorld.forcedDownpourWithTear = true; CalamityMod.UpdateServerBoolean(); } - if (CalamityWorld.startAcidicDownpour) - { - Main.raining = true; - } CalamityWorld.triedToSummonOldDuke = false; + CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case. } + UpdateInvasion(); BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! } @@ -222,6 +223,7 @@ namespace CalamityMod.Events netMessage.Write((byte)CalamityModMessageType.AcidRainSync); netMessage.Write(CalamityWorld.rainingAcid); netMessage.Write(CalamityWorld.acidRainPoints); + netMessage.Write(CalamityWorld.timeSinceAcidRainKill); netMessage.Send(); } if (Main.netMode == NetmodeID.Server) diff --git a/Items/Accessories/BrokenWaterFilter.cs b/Items/Accessories/BrokenWaterFilter.cs index 83401f1c0f..6778deaeec 100644 --- a/Items/Accessories/BrokenWaterFilter.cs +++ b/Items/Accessories/BrokenWaterFilter.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 9a8f099efb..e77b0415f5 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index e748104277..5f3a3c6292 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index ebd21d9305..768833221d 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 500; - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); } public override void AddRecipes() { diff --git a/Items/RustyLockpick.cs b/Items/RustyLockpick.cs deleted file mode 100644 index 3598f8959a..0000000000 --- a/Items/RustyLockpick.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items -{ - public class RustyLockpick : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Opens locked rusty chests"); - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.rare = 1; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/RustyLockpick.png b/Items/RustyLockpick.png deleted file mode 100644 index 4281306709..0000000000 Binary files a/Items/RustyLockpick.png and /dev/null differ diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index c0ff3c1f21..a23a70fef2 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining); + return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining || CalamityWorld.rainingAcid); } public override bool UseItem(Player player) @@ -48,22 +48,10 @@ namespace CalamityMod.Items.Tools.ClimateChange Main.rainTime = 3600; AdjustRainSeverity(true); } - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } else { Main.raining = false; - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } CalamityMod.UpdateServerBoolean(); diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index f5b3a70288..95760c4e02 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -44,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); + ModRecipe recipe = new ModRecipe(mod);; recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 172e08b78e..cb26f7178c 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1614,16 +1614,18 @@ namespace CalamityMod.NPCs private void AcidRainProgression(NPC npc) { Dictionary possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) possibleEnemies = AcidRainEvent.PossibleEnemiesAS; if (CalamityWorld.downedPolterghast) possibleEnemies = AcidRainEvent.PossibleEnemiesPolter; + if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type) && CalamityWorld.rainingAcid) { CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS; @@ -1632,7 +1634,7 @@ namespace CalamityMod.NPCs CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } @@ -1645,6 +1647,7 @@ namespace CalamityMod.NPCs CalamityWorld.triedToSummonOldDuke = false; CalamityWorld.acidRainPoints = 0; } + CalamityWorld.timeSinceAcidRainKill = 0; AcidRainEvent.UpdateInvasion(); } #endregion diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index db44011621..042137dfe4 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public const float NPCHomingInertia = 20f; public const float NPCHomingSpeed = 14f; - public const float AttackRate = 110f; + public const float AttackRate = 140f; - public const float DistanceToCheck = 750f; + public const float DistanceToCheck = 585f; public const int ExplosionShrapnelBaseDamage = 16; // Uses player.MinionDamage @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon Utils.PoofOfSmoke(projectile.Center); for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner); } projectile.Kill(); diff --git a/Tiles/Abyss/RustyChestLocked.cs b/Tiles/Abyss/RustyChestLocked.cs deleted file mode 100644 index 9391ea2eb8..0000000000 --- a/Tiles/Abyss/RustyChestLocked.cs +++ /dev/null @@ -1,124 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items; -using CalamityMod.Items.Placeables.Furniture; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Abyss -{ - public class RustyChestLocked : ModTile - { - public override void SetDefaults() - { - this.SetUpChest(); - ModTranslation name = CreateMapEntryName("chestRusty"); - name.SetDefault("Rusty Chest"); - AddMapEntry(new Color(57, 48, 83), name, MapChestName); - dustType = ModContent.DustType(); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Rusty Chest"; - chestDrop = ModContent.ItemType(); - } - - public override bool HasSmartInteract() => true; - - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; - - public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) - { - Player closest = Main.player[Player.FindClosest(new Vector2(i, j) * 16f, 1, 1)]; - if (!closest.InventoryHas(ModContent.ItemType())) - return false; - - for (int k = 0; k < closest.inventory.Length; k++) - { - if (closest.inventory[k].type == ModContent.ItemType()) - { - if (ItemLoader.ConsumeItem(closest.inventory[k], closest)) - { - closest.inventory[k].stack--; - } - if (closest.inventory[k].stack <= 0) - { - closest.inventory[k] = new Item(); - } - break; - } - } - - dustType = this.dustType; - - return true; - } - - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; - - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = 1; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override bool NewRightClick(int i, int j) - { - Tile tile = Main.tile[i, j]; - - int left = i; - int top = j; - - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); - } - - public override void MouseOver(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - } - - public override void MouseOverFar(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - } - } -} diff --git a/Tiles/Abyss/RustyChestLocked.png b/Tiles/Abyss/RustyChestLocked.png deleted file mode 100644 index e88cc3af08..0000000000 Binary files a/Tiles/Abyss/RustyChestLocked.png and /dev/null differ diff --git a/Tiles/Abyss/RustyChestLocked_Highlight.png b/Tiles/Abyss/RustyChestLocked_Highlight.png deleted file mode 100644 index 94e49a2c3d..0000000000 Binary files a/Tiles/Abyss/RustyChestLocked_Highlight.png and /dev/null differ diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs new file mode 100644 index 0000000000..4111461e82 --- /dev/null +++ b/Tiles/Abyss/RustyChestTile.cs @@ -0,0 +1,81 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class RustyChestTile : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Rusty Chest"); + AddMapEntry(new Color(191, 142, 111), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Rusty Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract() => true; + + public string MapChestName(string name, int i, int j) + { + // Bounds check + if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) + return name; + + // Tile null check + Tile tile = Main.tile[i, j]; + if (tile is null) + return name; + + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + if (chest == -1) + return name; + return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) + { + return CalamityUtils.ChestRightClick(i, j); + } + + public override void MouseOver(int i, int j) + { + CalamityUtils.ChestMouseOver("Rusty Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + CalamityUtils.ChestMouseFar("Rusty Chest", i, j); + } + } +} diff --git a/Tiles/Abyss/RustyChestTile.png b/Tiles/Abyss/RustyChestTile.png new file mode 100644 index 0000000000..56fa385bc1 Binary files /dev/null and b/Tiles/Abyss/RustyChestTile.png differ diff --git a/Tiles/Abyss/RustyChestTile_Highlight.png b/Tiles/Abyss/RustyChestTile_Highlight.png new file mode 100644 index 0000000000..e530745085 Binary files /dev/null and b/Tiles/Abyss/RustyChestTile_Highlight.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index af4dca1ef6..742014926b 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -71,6 +71,7 @@ namespace CalamityMod.World GenerateUpperSea(); CreateWater(); GenerateHardenedSandstone(); + RemoveStupidTilesAboveSea(); SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal. GenerateIslands(); GenerateVentsAndFossils(); @@ -325,13 +326,6 @@ namespace CalamityMod.World } } } - else if (WorldGen.genRand.NextBool(10)) - { - for (int i = 0; i < 20; i++) - { - TileLoader.RandomUpdate(trueX, y, Main.tile[trueX, y].type); - } - } } } } @@ -742,7 +736,7 @@ namespace CalamityMod.World SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) { - chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType(), tileStyle: 1); + chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); } } } @@ -757,9 +751,30 @@ namespace CalamityMod.World } #endregion + #region Removal of stupid Tiles above the Sea + public static void RemoveStupidTilesAboveSea() + { + for (int x = 0; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart - 100; y < YStart + 60; y++) + { + if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type)) + { + if (Main.tile[trueX, y] == null) + Main.tile[trueX, y] = new Tile(); + Main.tile[trueX, y].active(false); + } + } + } + } + #endregion + #region Misc Functions public static List YStartWhitelist = new List() { + TileID.Stone, + TileID.Dirt, TileID.Sand, TileID.Ebonsand, TileID.Crimsand, @@ -776,12 +791,26 @@ namespace CalamityMod.World TileID.Tungsten, TileID.Crimstone, TileID.Ebonstone, + TileID.HardenedSand, + TileID.CorruptHardenedSand, + TileID.CrimsonHardenedSand, + TileID.Coral, + TileID.BeachPiles, + TileID.Plants, + TileID.Plants2, + TileID.SmallPiles, + TileID.LargePiles, + TileID.LargePiles2, + TileID.Trees, + TileID.Vines, + TileID.CrimsonVines, + TileID.Containers, TileID.JungleGrass // Yes, this can happen on rare occasion }; public static void DetermineYStart() { int maxHeight = 0; - for (int i = 0; i < BiomeWidth; i++) + for (int i = 0; i < BiomeWidth - 18; i++) { int xCheck = CalamityWorld.abyssSide ? BiomeWidth - i : diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 53efbf3fab..a98ff26869 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -111,6 +111,8 @@ namespace CalamityMod.World public static bool forcedRainAlready = false; public static bool forcedDownpourWithTear = false; public static int forceRainTimer = 0; + public static int timeSinceAcidRainKill = 0; + public static int timeSinceAcidStarted = 0; public static float AcidRainCompletionRatio { get @@ -967,6 +969,17 @@ namespace CalamityMod.World if (rainingAcid) { + timeSinceAcidRainKill++; + timeSinceAcidStarted++; + + // If enough time has passed, and no enemy has been killed, end the invasion early. + // The player almost certainly does not want to deal with it. + if (timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } if (!startAcidicDownpour) { int sulphSeaWidth = Abyss.BiomeWidth; @@ -984,6 +997,8 @@ namespace CalamityMod.World (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) && player2.Calamity().ZoneSulphur) { + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) + // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! startAcidicDownpour = true; CalamityMod.UpdateServerBoolean(); break; @@ -992,22 +1007,37 @@ namespace CalamityMod.World } } - // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - if ((startAcidicDownpour || forcedDownpourWithTear) && !NPC.AnyNPCs(ModContent.NPCType())) + // Stop the rain if the Old Duke is present for visibility during the fight. + if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) { - Main.raining = true; - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = 0.72f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; - Main.maxRaining = 0.89f; - } + Main.raining = false; + CalamityMod.UpdateServerBoolean(); + } + + // If the rain stops for whatever reason, end the invasion. + // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, + // they can without having to deal with endless rain. + if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType()) && timeSinceAcidStarted > 20) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + else if (timeSinceAcidStarted < 20) + { + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; + Main.maxRaining = 0.89f; + } // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 2) + if (downedPolterghast && acidRainPoints == 1) { if (!NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) @@ -1033,7 +1063,9 @@ namespace CalamityMod.World } else { - startAcidicDownpour = false; + if (timeSinceAcidStarted != 0) + timeSinceAcidStarted = 0; + startAcidicDownpour = false; } // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index d0c7a002f7..d4de0fd404 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -139,7 +139,7 @@ namespace CalamityMod.World } PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); } - else if (type == ModContent.TileType()) + else if (type == ModContent.TileType()) { // 15-29 torches (in accordence with vanilla) PutItemInChest(ref chest, ItemID.Torch, 15, 29);