From 5aee5d096129b32606c7af9838e698a2817804ce Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Thu, 26 Mar 2020 19:47:03 +0000 Subject: [PATCH] Changed Caustic Tear's method of obtainment Added Fargo's support for caustic tear and acid rain --- Items/Fishing/SulphurCatches/AbyssalCrate.cs | 6 -- Items/SummonItems/Invasion/CausticTear.cs | 24 ++++---- .../Invasion/CausticTearNonConsumable.cs | 58 +++++++++++++++++++ ModSupport/ModCalls.cs | 12 +++- ModSupport/WeakReferenceSupport.cs | 10 ++++ Projectiles/Environment/AcidDrop.cs | 8 +++ 6 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 Items/SummonItems/Invasion/CausticTearNonConsumable.cs diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index 678dacafdc..5c90e29d98 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -66,12 +66,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); } - // Acid Rain summoner - if (NPC.downedBoss1) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f); - } - // Equipment DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.25f, ModContent.ItemType(), diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 46476b5ef8..633257da91 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -11,33 +11,29 @@ namespace CalamityMod.Items.SummonItems.Invasion public override void SetStaticDefaults() { DisplayName.SetDefault("Caustic Tear"); - Tooltip.SetDefault("Toggles the acid rain in the Sulphurous Sea"); + Tooltip.SetDefault("Causes an acidic downpour in the Sulphurous Sea"); } public override void SetDefaults() { item.width = 28; item.height = 18; - item.maxStack = 1; - item.rare = 6; + item.maxStack = 99; + item.rare = 1; item.useAnimation = 45; item.useTime = 45; item.useStyle = 4; - item.consumable = false; + item.consumable = true; + } + + public override bool CanUseItem(Player player) + { + return !CalamityWorld.rainingAcid; } public override bool UseItem(Player player) { - if (!CalamityWorld.rainingAcid) - { - AcidRainEvent.TryStartEvent(); - } - else - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } + AcidRainEvent.TryStartEvent(); return true; } } diff --git a/Items/SummonItems/Invasion/CausticTearNonConsumable.cs b/Items/SummonItems/Invasion/CausticTearNonConsumable.cs new file mode 100644 index 0000000000..3671db6856 --- /dev/null +++ b/Items/SummonItems/Invasion/CausticTearNonConsumable.cs @@ -0,0 +1,58 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + public class CausticTearNonConsumable : ModItem + { + + public override string Texture => "CalamityMod/Items/SummonItems/Invasion/CausticTear"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Tear"); + Tooltip.SetDefault("Toggles the acid rain in the Sulphurous Sea"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.maxStack = 1; + item.rare = 6; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = 4; + item.consumable = false; + } + + public override bool UseItem(Player player) + { + if (!CalamityWorld.rainingAcid) + { + AcidRainEvent.TryStartEvent(); + } + else + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index bed650ad6d..c826a46914 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles; using CalamityMod.World; @@ -1651,7 +1652,16 @@ namespace CalamityMod Item item = (Item)args[1]; int rarity = (int)args[2]; return SetCalamityRarity(item, rarity); - + case "AbominationnClearEvents": + bool eventActive = CalamityWorld.rainingAcid; + bool canClear = Convert.ToBoolean(args[1]); //This is to indicate whether abomm is able to clear the event due to a cooldown + if (eventActive && canClear) //adjust based on other events when added. + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + return eventActive; default: return new ArgumentException("ERROR: Invalid method name."); } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index bfbf59ac94..995d11c730 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -55,6 +55,7 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Summon; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -766,6 +767,13 @@ namespace CalamityMod fargos.Call("AddSummon", order, "CalamityMod", summonItemName, downed, price); } + void AddToAbomShop(float order, string summonItemName, Func downed, int price) + { + fargos.Call("AddEventSummon", order, "CalamityMod", summonItemName, downed, price); //Not currently in the live version of fargo's, it will however be in the next version. + } + + fargos.Call("AbominationnClearEvents", "CalamityMod", CalamityWorld.rainingAcid, true); + AddToMutantShop("DesertScourge", "DriedSeafood", DownedDesertScourge, Item.buyPrice(gold: 2)); AddToMutantShop("Crabulon", "DecapoditaSprout", DownedCrabulon, Item.buyPrice(gold: 4)); AddToMutantShop("HiveMind", "Teratoma", DownedHiveMind, Item.buyPrice(gold: 10)); @@ -780,6 +788,8 @@ namespace CalamityMod AddToMutantShop("ProfanedGuardians", "ProfanedShard", DownedGuardians, Item.buyPrice(platinum: 5)); AddToMutantShop("Bumblebirb", "BirbPheromones", DownedBirb, Item.buyPrice(platinum: 5)); AddToMutantShop("OldDuke", "BloodwormItem", DownedBoomerDuke, Item.buyPrice(platinum: 8)); + + AddToAbomShop(InvasionDifficulty["Acid Rain Initial"], "CausticTear", DownedAcidRainInitial, Item.buyPrice(gold: 3)); } private static void CensusSupport() diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index 4585df6ced..df19acbf7a 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -5,6 +5,8 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.SummonItems.Invasion; +using CalamityMod.World; namespace CalamityMod.Projectiles.Environment { @@ -43,6 +45,12 @@ namespace CalamityMod.Projectiles.Environment Main.dust[idx].velocity -= projectile.velocity * 0.025f; Main.dust[idx].scale = 0.75f; } + int frequency = CalamityWorld.downedAquaticScourgeAcidRain ? 1000 : CalamityWorld.downedEoCAcidRain ? 500 : 250; + if (Main.rand.NextBool(frequency)) //not too often, but not too rare either considering how often they spawn + { + Item.NewItem(projectile.getRect(), ModContent.ItemType(), 1); + } + return true; }