From bd850464d15a84cf6ee4dad407befe07f113e9df Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Thu, 14 Nov 2024 03:10:57 +0700 Subject: [PATCH] Fishing changes (#955) See PR for details. Squashed due to illegal rebase. --- CalPlayer/CalamityPlayerFishing.cs | 750 ++++++------------ Enums/HardmodeCrateType.cs | 9 + Items/Accessories/AlluringBait.cs | 2 +- Items/Accessories/RustyMedallion.cs | 10 - .../SupremeBaitTackleBoxFishingStation.cs | 2 +- Items/BrokenWaterFilter.cs | 12 +- Items/CalamityGlobalItemLoot.cs | 149 ++-- Items/Fishing/AstralCatches/AstralCrate.cs | 72 +- Items/Fishing/AstralCatches/MonolithCrate.cs | 40 +- .../BrimstoneCragCatches/BrimstoneCrate.cs | 26 +- .../Fishing/BrimstoneCragCatches/SlagCrate.cs | 37 +- Items/Fishing/GrandMarquisBait.cs | 2 +- Items/Fishing/StuffedFish.cs | 9 +- .../SulphurCatches/HydrothermalCrate.cs | 86 +- .../Fishing/SulphurCatches/SulphurousCrate.cs | 78 +- .../SunkenSeaCatches/EutrophicCrate.cs | 50 +- Items/Fishing/SunkenSeaCatches/PrismCrate.cs | 61 +- Items/Placeables/Furniture/EffigyOfDecay.cs | 10 - Items/Weapons/Summon/RustyBeaconPrototype.cs | 12 +- .../Mods.CalamityMod.Items.Accessories.hjson | 18 +- Systems/Mechanic/RecipeSystem.cs | 16 - Utilities/DropHelper.cs | 366 ++++++++- 22 files changed, 757 insertions(+), 1060 deletions(-) create mode 100644 Enums/HardmodeCrateType.cs diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 79e31c99bd..b88f777f11 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -27,20 +28,52 @@ namespace CalamityMod.CalPlayer { public partial class CalamityPlayer : ModPlayer { + #region Modify Fishing Attempt + public override void ModifyFishingAttempt(ref FishingAttempt attempt) + { + if (enchantedPearl) + { + // If the player fails to roll a crate naturally and has Enchanted Pearl, reroll + // Stacking with existing probability, it should increase chances by 15% (12.5% with Crate Potion) + if (!attempt.crate) + attempt.crate = Main.rand.NextBool(6); + + // If the player does get a crate (can be from the reroll above), give it increased chances of being rarer + if (attempt.crate) + { + int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300) + attempt.uncommon = Main.rand.NextBool(uncommonRate); + int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050) + attempt.uncommon = Main.rand.NextBool(rareRate); + int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250) + attempt.uncommon = Main.rand.NextBool(veryRareRate); + } + } + } + #endregion + #region Catch Fish public override void CatchFish(FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition) { + // If vanilla catches an enemy, just immediately cancel + if (npcSpawn > 0) + return; + int bait = attempt.playerFishingConditions.BaitItemType; - int power = attempt.playerFishingConditions.BaitPower + attempt.playerFishingConditions.PolePower; + int power = attempt.fishingLevel; int questFish = attempt.questFish; int poolSize = attempt.waterTilesCount; - bool water = !attempt.inHoney && !attempt.inLava; bool lava = attempt.inLava; bool honey = attempt.inHoney; - // If vanilla catches an enemy, just cancel - if (npcSpawn > 0) - return; + bool sky = attempt.heightLevel == 0; + bool surface = attempt.heightLevel == 1; + bool underground = attempt.heightLevel == 2; + bool cavern = attempt.heightLevel == 3; + bool underworld = attempt.heightLevel == 4; + + // Custom rate; increased by Enchanted Pearl + bool grabBagFish = attempt.uncommon && Main.rand.Next(100) < (enchantedPearl ? 30 : 15); // Set up for allowing fishing in the Sulphurous Sea Point point = Player.Center.ToTileCoordinates(); @@ -58,538 +91,210 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; - // Old Duke spawn - if (canSulphurFish && bait == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) - { - CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); - } - - // Don't do anything if you can't fish in lava - if (!attempt.CanFishInLava && lava) - return; - - // If you caught junk, then ignore all Calamity catches - if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan) - return; - - // Handle our modded Quest Fish, You can catch these in any liquid... because I don't care if you can - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - - // Handle Alluring Bait's increased chance for Potion Material fish - if (alluringBait) - { - int chanceForPotionFish = 1000 / power; - - if (chanceForPotionFish < 3) - chanceForPotionFish = 3; - - if (Main.rand.NextBool(chanceForPotionFish)) - { - List fishList = new List(); - - if (lava) - { - fishList.AddWithCondition(ItemID.FlarefinKoi, !ZoneCalamity); - fishList.AddWithCondition(ItemID.Obsidifish, !ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - } - else if (water) - { - if (Player.ZoneDirtLayerHeight || Player.ZoneRockLayerHeight) - { - fishList.Add(ItemID.ArmoredCavefish); - fishList.Add(ItemID.Stinkfish); - fishList.Add(ItemID.SpecularFish); - fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.VariegatedLardfish, Player.ZoneJungle); - } - if (Player.ZoneOverworldHeight || Player.ZoneSkyHeight) - { - fishList.AddWithCondition(ItemID.DoubleCod, Player.ZoneJungle); - } - fishList.AddWithCondition(ItemID.FrostMinnow, Player.ZoneSnow); - fishList.AddWithCondition(ItemID.Ebonkoi, Player.ZoneCorrupt); - fishList.AddWithCondition(ItemID.CrimsonTigerfish, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.Hemopiranha, Player.ZoneCrimson); - 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); - fishList.AddWithCondition(ModContent.ItemType(), !Main.dayTime && !Player.ZoneSkyHeight); - } - - if (fishList.Any()) - { - int fishAmt = fishList.Count; - int caughtFish = fishList[Main.rand.Next(fishAmt)]; - itemDrop = caughtFish; - return; - } - } - } - - // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station - if (enchantedPearl || fishingStation) - { - int chanceForCrates = (enchantedPearl ? 10 : 0) + - (fishingStation ? 10 : 0); - - int poolSizeAmt = poolSize / 10; - if (poolSizeAmt > 100) - poolSizeAmt = 100; - - int fishingPowerDivisor = power + poolSizeAmt; - - int chanceForIronCrate = 1000 / fishingPowerDivisor; - int chanceForBiomeCrate = 2000 / fishingPowerDivisor; - int chanceForGoldCrate = 3000 / fishingPowerDivisor; - int chanceForRareItems = 4000 / fishingPowerDivisor; - - if (chanceForIronCrate < 3) - chanceForIronCrate = 3; - - if (chanceForBiomeCrate < 4) - chanceForBiomeCrate = 4; - - if (chanceForGoldCrate < 5) - chanceForGoldCrate = 5; - - if (chanceForRareItems < 6) - chanceForRareItems = 6; - - if (lava) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForBiomeCrate)) - { - if (ZoneCalamity) - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - else - itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; - } - if ((Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) && ZoneCalamity) - { - itemDrop = ModContent.ItemType(); - } - } - } - - if (water) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) - { - List rareItemList = new List(); - - if (canSulphurFish) - { - switch (Main.rand.Next(2)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneAstral) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - case 2: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneSunkenSea) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - case 2: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - 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.ZoneHallow); - - if (rareItemList.Any()) - { - int rareItemAmt = rareItemList.Count; - int caughtRareItem = rareItemList[Main.rand.Next(rareItemAmt)]; - itemDrop = caughtRareItem; - } - } - else if (Main.rand.NextBool(chanceForGoldCrate)) - { - itemDrop = Main.hardMode ? ItemID.GoldenCrateHard : ItemID.GoldenCrate; - } - else if (Main.rand.NextBool(chanceForBiomeCrate)) - { - List biomeCrateList = new List(); - - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneAstral); - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneSunkenSea); - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), canSulphurFish); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CorruptFishingCrateHard : ItemID.CorruptFishingCrate, Player.ZoneCorrupt); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CrimsonFishingCrateHard : ItemID.CrimsonFishingCrate, Player.ZoneCrimson); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.HallowedFishingCrateHard : ItemID.HallowedFishingCrate, Player.ZoneHallow); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.DungeonFishingCrateHard : ItemID.DungeonFishingCrate, Player.ZoneDungeon); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.JungleFishingCrateHard : ItemID.JungleFishingCrate, Player.ZoneJungle); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FloatingIslandFishingCrateHard : ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FrozenCrateHard : ItemID.FrozenCrate, Player.ZoneSnow); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OasisCrateHard : ItemID.OasisCrate, Player.ZoneDesert && !Player.ZoneBeach); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OceanCrateHard : ItemID.OceanCrate, Player.ZoneBeach); - - if (biomeCrateList.Any()) - { - int biomeCrateAmt = biomeCrateList.Count; - int caughtBiomeCrate = biomeCrateList[Main.rand.Next(biomeCrateAmt)]; - itemDrop = caughtBiomeCrate; - } - } - else if (Main.rand.NextBool(chanceForIronCrate)) - { - itemDrop = Main.hardMode ? ItemID.IronCrateHard : ItemID.IronCrate; - } - else - { - itemDrop = Main.hardMode ? ItemID.WoodenCrateHard : ItemID.WoodenCrate; - } - return; - } - } - } - - if (water) - { - // Handle Calamity's crates, veryrare and legendary means it's a Golden Crate - if (attempt.crate) - { - if (attempt.rare && !attempt.veryrare && !attempt.legendary) - { - if (ZoneAstral) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - if (ZoneSunkenSea) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - if (canSulphurFish) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - } - return; - } - - // Don't override the vanilla crates or any special vanilla fishing loot - List keepCatchList = new List() - { - ItemID.WoodenCrate, - ItemID.WoodenCrateHard, - ItemID.IronCrate, - ItemID.IronCrateHard, - ItemID.GoldenCrate, - ItemID.GoldenCrateHard, - ItemID.FrogLeg, - ItemID.BalloonPufferfish, - ItemID.ZephyrFish, - ItemID.CombatBook, - ItemID.CorruptFishingCrate, - ItemID.CorruptFishingCrateHard, - ItemID.CrimsonFishingCrate, - ItemID.CrimsonFishingCrateHard, - ItemID.HallowedFishingCrate, - ItemID.HallowedFishingCrateHard, - ItemID.DungeonFishingCrate, - ItemID.DungeonFishingCrateHard, - ItemID.JungleFishingCrate, - ItemID.JungleFishingCrateHard, - ItemID.FloatingIslandFishingCrate, - ItemID.FloatingIslandFishingCrateHard, - ItemID.FrozenCrate, - ItemID.FrozenCrateHard, - ItemID.OasisCrate, - ItemID.OasisCrateHard, - ItemID.OceanCrate, - ItemID.OceanCrateHard - }; - if (keepCatchList.Contains(itemDrop)) - { - return; - } - - if ((Player.ZoneCrimson || Player.ZoneCorrupt) && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneHallow && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSkyHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); - } - } - - // Increased chance of Enchanted Starfish if you don't have maximum mana - if (Player.ZoneOverworldHeight && !Main.dayTime) - { - int chance = Player.statManaMax < 200 ? 5 : 20; - if (attempt.uncommon && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (!Player.ZoneSkyHeight && !Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(10)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneOverworldHeight && Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneRockLayerHeight) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSnow && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - // Lower chance of Spadefish in Hardmode - if (Player.ZoneDirtLayerHeight) - { - int chance = Main.hardMode ? 10 : 2; - if (attempt.veryrare && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedLeviathan && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) - { - itemDrop = ModContent.ItemType(); - } - - if (Player.ZoneOverworldHeight && Main.bloodMoon) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (ZoneAstral) // Astral Infection, fishing in water - { - if (attempt.legendary) - { - int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = legendaryCatch; - } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) - { - int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = uncommonCatch; - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - if (ZoneSunkenSea) // Sunken Sea, fishing in water - { - if (attempt.legendary) - { - List legendaryCatches = new List() - { - ModContent.ItemType() - }; - legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); - legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); - itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; - } - else if (attempt.veryrare) - { - itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) - { - itemDrop = ModContent.ItemType(); - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - // There is no complete fishing pool here, so most of it is vanilla default - if (canSulphurFish) // Sulphurous Sea, fishing in water - { - if (attempt.legendary || (attempt.veryrare && Main.rand.NextBool())) - { - itemDrop = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType() - }); - } - else if (attempt.common) - { - itemDrop = ModContent.ItemType(); - } - } - - /*if (canSulphurFish && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, ModContent.NPCType()); - } - else - { - NetMessage.SendData(61, -1, -1, null, player.whoAmI, (float)ModContent.NPCType(), 0f, 0f, 0, 0, 0); - } - switch (Main.rand.Next(4)) - { - 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; - }*/ - } - + // Fishing in lava overrides the rest of logic if (lava) { - if (ZoneCalamity) // Brimstone Crags, fishing in lava + // Don't do anything if you can't fish in lava + if (!attempt.CanFishInLava) + return; + + if (ZoneCalamity) { - if (attempt.crate) - { + // Crates have highest priority + if (attempt.crate && attempt.rare) itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } else if (attempt.legendary) - { itemDrop = ModContent.ItemType(); - } - // Increased chance of Dragoon Drizzlefish in Prehardmode - else if (attempt.veryrare && !Main.hardMode) - { - itemDrop = ModContent.ItemType(); - } else if (attempt.veryrare) - { itemDrop = ModContent.ItemType(); - } - else if ((attempt.rare || attempt.veryrare) && DownedBossSystem.downedProvidence && Main.rand.Next(3) >= 2) - { + else if (DownedBossSystem.downedProvidence && ((attempt.rare && Main.rand.NextBool(2)) || (attempt.uncommon && Main.rand.NextBool(4)))) itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (grabBagFish && Main.hardMode) + itemDrop = ModContent.ItemType(); + else if (attempt.rare) { List uncommonCatches = new List() { ModContent.ItemType(), ModContent.ItemType() }; - uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } + // Lava fish usually don't have plentiful catches but we can be more lenient else - { itemDrop = ModContent.ItemType(); - } } + return; + } + + // Honey also overrides logic but we have nothing to catch from honey... for now + if (honey) + return; + + // Old Duke spawn + if (canSulphurFish && bait == ModContent.ItemType() && !BossRushEvent.BossRushActive) + { + CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); + } + + // Ignore catches if it's junk + if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan || itemDrop == ItemID.JojaCola) + return; + + if (attempt.crate) + { + // This can override Golden/Titanium Crates, but so do vanilla biome crates + // Those are still obtainable if the catch is very rare/legendary but not rare (fishing oddities) + if (attempt.rare) + { + if (ZoneAstral) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + if (ZoneSunkenSea) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + if (canSulphurFish) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + } + return; + } + + // Ignore all top priority legendary vanilla catches + List keepCatchList = new List() + { + ItemID.CombatBook, + ItemID.DreadoftheRedSea, + ItemID.FrogLeg, + ItemID.BalloonPufferfish, + ItemID.ZephyrFish + }; + if (keepCatchList.Contains(itemDrop)) + return; + + // Add top priorities of our own + if (DownedBossSystem.downedLeviathan && attempt.legendary && poolSize > 1000) + { + itemDrop = ModContent.ItemType(); + return; + } + + if (grabBagFish) + { + if (surface && Main.bloodMoon) + itemDrop = ModContent.ItemType(); + else if (surface && Main.dayTime) + itemDrop = ModContent.ItemType(); + else if (cavern) + itemDrop = ModContent.ItemType(); + if (Main.hardMode) + { + // Fish of Light/Night are evenly split with Gemfish + if ((Player.ZoneCrimson || Player.ZoneCorrupt) && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneHallow && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneSnow) + itemDrop = ModContent.ItemType(); + else if (sky) + itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + } + } + + // Increased chance of Enchanted Starfish if you don't have maximum mana + if (surface && !Main.dayTime) // Surface + { + int chance = (Player.ConsumedManaCrystals >= Player.ManaCrystalMax) ? 20 : 5; + if (attempt.uncommon && Main.rand.NextBool(chance)) + itemDrop = ModContent.ItemType(); + + if (attempt.uncommon && Main.rand.NextBool(10)) + itemDrop = ModContent.ItemType(); + } + + // Lower chance of Spadefish in Hardmode + if (underground) // Underground + { + int chance = Main.hardMode ? 10 : 2; + if (attempt.veryrare && Main.rand.NextBool(chance)) + { + itemDrop = ModContent.ItemType(); + } + } + + if (ZoneAstral) + { + if (attempt.legendary) + { + int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = legendaryCatch; + } + else if (attempt.veryrare) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + { + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = uncommonCatch; + } + else + itemDrop = ModContent.ItemType(); + return; + } + if (ZoneSunkenSea) + { + // If the player is overlapping with the desert, split the catches + if (Player.ZoneDesert && Main.rand.NextBool()) + return; + + if (attempt.legendary) + { + List legendaryCatches = new List() + { + ModContent.ItemType() + }; + legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; + } + else if (attempt.veryrare) + itemDrop = ModContent.ItemType(); + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + itemDrop = ModContent.ItemType(); + else + itemDrop = ModContent.ItemType(); + return; + } + // There is no complete fishing pool here, so most of it is vanilla default + if (canSulphurFish) + { + if (attempt.legendary) + { + itemDrop = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + } + else if (attempt.common && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); } } #endregion @@ -597,6 +302,7 @@ namespace CalamityMod.CalPlayer #region Get Fishing Level public override void GetFishingLevel(Item fishingRod, Item bait, ref float fishingLevel) { + // Note: This is calculated after equipments (Rod, Bait, Potions, etc) and before modifications (Chum Buckets, Luck) if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == ModContent.ItemType()) fishingLevel = fishingLevel * ArcturusAstroidean.FishingPowerBiomeMult; if (Player.ZoneSnow && fishingRod.type == ModContent.ItemType()) @@ -634,9 +340,10 @@ namespace CalamityMod.CalPlayer } #endregion - #region Get Fishing Level + #region Modify Caught Fish public override void ModifyCaughtFish(Item fish) { + // Increases the yield of potion ingredient fish with Alluring Bait if (alluringBait) { List fishList = new List() @@ -663,10 +370,7 @@ namespace CalamityMod.CalPlayer }; if (fishList.Contains(fish.type)) - { - // Increase the yield by 1 or 2 - fish.stack += Main.rand.NextBool() ? 1 : 2; - } + fish.stack += Main.rand.Next(1, 3 + 1); } } #endregion diff --git a/Enums/HardmodeCrateType.cs b/Enums/HardmodeCrateType.cs new file mode 100644 index 0000000000..6febfd2600 --- /dev/null +++ b/Enums/HardmodeCrateType.cs @@ -0,0 +1,9 @@ +namespace CalamityMod.Enums +{ + public enum HardmodeCrateType + { + Biome, + Mythril, + Titanium + } +} diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index 1a5383e4b1..786435906e 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().alluringBait = true; - player.fishingSkill += 30; + player.fishingSkill += 10; } } } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 52d7328429..b7d0e8f3a1 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,14 +29,5 @@ namespace CalamityMod.Items.Accessories modPlayer.RustyMedallionDroplets = true; player.buffImmune[ModContent.BuffType()] = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnySilverBar", 10). - AddIngredient(3). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index bf385bc526..5c1034b6db 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.fishingSkill += 80; + player.fishingSkill += 50; player.accFishingLine = true; player.accTackleBox = true; player.accLavaFishing = true; diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index d1988055a3..ffb03203aa 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; @@ -87,14 +86,5 @@ namespace CalamityMod.Items text = GetTextValue("Items.Misc.SpawnBlockersOff"); tooltips.FindAndReplace("[STATE]", text); } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("IronBar", 10). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 7b41779c8a..2df054f082 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; @@ -25,12 +26,6 @@ namespace CalamityMod.Items public override void ModifyItemLoot(Item item, ItemLoot loot) { Fraction fifteenPercent = new Fraction(15, 100); - static bool CryonicAvailable() - { - if (!DownedBossSystem.downedCryogen) - return false; - return (NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt()) >= 2; - } switch (item.type) { @@ -275,91 +270,49 @@ namespace CalamityMod.Items #endregion #region Fishing Crates - // TODO -- What is all this shit? + // Kylie @ 1% (yes this is the consistent rate, dw it's not hard to get one of these) case ItemID.WoodenCrate: case ItemID.WoodenCrateHard: - loot.Add(ModContent.ItemType(), 4, 3, 5); // 25% 3-5 Wulfrum Scrap - loot.Add(ModContent.ItemType(), 20); + loot.Add(ModContent.ItemType(), 100); + // We do not need to pop Hardmode ores out of Pearlwood Crates. They do not drop higher tier ores. break; - case ItemID.IronCrate: case ItemID.IronCrateHard: - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Wulfrum Scrap - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Ancient Bone Dust + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Mythril); break; - // these drops are not available in hardmode because this crate will stop dropping + // Non-crafted underground Gold Chest loot @ 20%; Individually 5% case ItemID.GoldenCrate: - loot.Add(ItemID.FlareGun, 10); // 10% Flare Gun - loot.Add(ItemID.ShoeSpikes, 10); // 10% Shoe Spikes (BUT NOT CLIMBING CLAWS?) - loot.Add(ItemID.BandofRegeneration, 10); // 10% Band of Regeneration + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); // Climbing Claws is in Wooden/Pearlwood (vanilla) in case you're curious break; case ItemID.GoldenCrateHard: - // Post-Yharon: 15% 30-40 Auric Ore - loot.AddIf(() => DownedBossSystem.downedYharon, ModContent.ItemType(), fifteenPercent, 30, 40); + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Titanium); + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); break; - case ItemID.CorruptFishingCrate: - case ItemID.CrimsonFishingCrate: case ItemID.CorruptFishingCrateHard: case ItemID.CrimsonFishingCrateHard: - loot.Add(ModContent.ItemType(), fifteenPercent, 5, 8); // 15% 5-8 Blighted Gel - break; - - case ItemID.HallowedFishingCrate: // WHY case ItemID.HallowedFishingCrateHard: - var postProv = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - postProv.Add(ModContent.ItemType(), fifteenPercent, 5, 10); // 15% 5-10 Unholy Essence - break; - - case ItemID.DungeonFishingCrate: case ItemID.DungeonFishingCrateHard: - loot.AddIf(() => NPC.downedPlantBoss, ItemID.Ectoplasm, 10, 1, 5); // 10% 1-5 Ectoplasm - loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Necroplasm - break; - - case ItemID.JungleFishingCrate: case ItemID.JungleFishingCrateHard: - var postPlant = loot.DefineConditionalDropSet(() => NPC.downedPlantBoss); - postPlant.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Perennial Ore - postPlant.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Perennial Bar - loot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 5, 3, 6); // 20% 3-6 Plague Cell Canister - var uelibloom = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - uelibloom.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Uelibloom Ore - uelibloom.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Uelibloom Bar - break; - - case ItemID.FloatingIslandFishingCrate: case ItemID.FloatingIslandFishingCrateHard: - var evilBossTwo = loot.DefineConditionalDropSet(() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); - evilBossTwo.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Aerialite Ore - evilBossTwo.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Aerialite Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Sunlight - loot.AddIf(() => NPC.downedMoonlord, ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Exodium Clusters - break; - - case ItemID.FrozenCrate: case ItemID.FrozenCrateHard: - var cryonic = loot.DefineConditionalDropSet(CryonicAvailable); - cryonic.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Cryonic Ore - cryonic.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Cryonic Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Eleum - break; - - case ItemID.LavaCrate: case ItemID.LavaCrateHard: - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Havoc - break; - - // Calamity does not touch Oasis Crates yet - case ItemID.OasisCrate: case ItemID.OasisCrateHard: - break; - - // Calamity does not touch Ocean Crates yet - case ItemID.OceanCrate: case ItemID.OceanCrateHard: + RemoveHardmodeOresFromBiomeCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); break; #endregion @@ -530,6 +483,66 @@ namespace CalamityMod.Items } #endregion + #region Fishing Crate Loot Rule Manipulation + private static void RemoveHardmodeOresFromStandardCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + // Find ones that are supposed to be for the ore and not the other loot + foreach (IItemDropRule rule in mainRule.rules) + { + // Hardmode ores/bars are both nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is SequentialRulesNotScalingWithLuckRule s) + { + oreRule.chanceNumerator = 0; + return; + } + } + } + } + } + + private static void RemoveHardmodeOresFromBiomeCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + foreach (IItemDropRule rule in mainRule.rules) + { + // 2 rules, one for ore and another for bar, nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is OneFromRulesRule o) + oreRule.chanceNumerator = 0; + } + } + } + } + #endregion + #region Goodie Bag Bat Hook private static void RemoveBatHookFromGoodieBag(ItemLoot loot) { diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 690c4c8e8b..75ca58ba4b 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -1,16 +1,6 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Potions; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Astral; using Terraria; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -29,18 +19,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,48 +33,14 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postAstrumAureus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumAureus); - var postAstrumDeus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); + // 4-10 Starblight Soot @ 50% + // This is our equivalent to Crystal Shards/Ichor + itemLoot.Add(ModContent.ItemType(), 2, 4, 10); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ItemID.FallenStar, 1, 5, 10); - itemLoot.Add(ItemID.Meteorite, 5, 10, 20); - itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - postAstrumAureus.Add(ModContent.ItemType(), 5, 2, 5); - postAstrumDeus.Add(ModContent.ItemType(), 5, 10, 20); - postAstrumDeus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumDeus.Add(ModContent.ItemType(), 4, 5, 10); - - // Weapons (and Starburster Core) - postAstrumAureus.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Pet - itemLoot.Add(ModContent.ItemType(), 10); - - // Bait - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.Firefly, 3, 1, 3); - - // Potions - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/AstralCatches/MonolithCrate.cs b/Items/Fishing/AstralCatches/MonolithCrate.cs index 060d03675b..736bd5ba2e 100644 --- a/Items/Fishing/AstralCatches/MonolithCrate.cs +++ b/Items/Fishing/AstralCatches/MonolithCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,27 +30,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.FallenStar, 1, 5, 10); - itemLoot.Add(ItemID.Meteorite, 5, 10, 20); - itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - // Pet - itemLoot.Add(ModContent.ItemType(), 10); - - // Bait - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - - itemLoot.Add(ItemID.Firefly, 3, 1, 3); - - // Potions - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 9346ddecb4..fb5785cf59 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,27 +40,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.Obsidian, 1, 2, 5); - itemLoot.Add(ItemID.Hellstone, 4, 2, 5); - itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); - itemLoot.AddIf(() => DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), 10, 1, 3); - itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2, 1, 3); - - // Weapons (none) - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs index 0afec68579..ea62747e86 100644 --- a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,25 +30,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.Obsidian, 1, 2, 5); - itemLoot.Add(ItemID.Hellstone, 4, 2, 5); - itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); - - // Weapons (none) - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/GrandMarquisBait.cs b/Items/Fishing/GrandMarquisBait.cs index be370af1e8..21b68505b6 100644 --- a/Items/Fishing/GrandMarquisBait.cs +++ b/Items/Fishing/GrandMarquisBait.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Fishing Item.maxStack = Item.CommonMaxStack; Item.rare = ItemRarityID.LightRed; Item.value = Item.sellPrice(silver: 30); - Item.bait = 65; + Item.bait = 75; Item.consumable = true; } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 8ee4b5c0f9..b3f6398ade 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.Crags; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,6 +32,8 @@ namespace CalamityMod.Items.Fishing ItemID.GrassSeeds, ItemID.JungleGrassSeeds, ItemID.MushroomGrassSeeds, + ItemID.AshGrassSeeds, + ModContent.ItemType(), ItemID.PumpkinSeed }; @@ -84,12 +88,15 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.GrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.JungleGrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.MushroomGrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.AshGrassSeeds, 20, seedMin, seedMax); + itemLoot.Add(ModContent.ItemType(), 20, seedMin, seedMax); itemLoot.Add(ItemID.PumpkinSeed, 20, seedMin, seedMax); // Biome grass seeds itemLoot.AddIf(() => !WorldGen.crimson, ItemID.CorruptSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => WorldGen.crimson, ItemID.CrimsonSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => Main.hardMode, ItemID.HallowedSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 20, seedMin, seedMax); // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = ExternalMods.thorium; diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index fca10d69a5..d14e2f292c 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -1,9 +1,6 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Potions; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -31,18 +28,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -53,51 +42,29 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. - var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); - var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); - var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); - var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); - var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - - tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); - scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); - tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); // Pre-HM Abyss Weapons - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, + itemLoot.Add(new OneFromOptionsDropRule(10, 1, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() - )); - - // Post-AS Acid Rain Weapons (and Nuclear Rod) - tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Pre-HM Abyss Equipment (and Torrential Tear) - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -105,18 +72,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType() )); - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 4b7f174bf8..692e01abdb 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -1,19 +1,11 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools.ClimateChange; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.Abyss; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CrateTile = CalamityMod.Tiles.Abyss.SulphurousCrateTile; namespace CalamityMod.Items.Fishing.SulphurCatches { @@ -29,18 +21,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,47 +35,23 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - - tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - - // Pre-HM Abyss Weapons - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() )); - // Pre-HM Abyss Equipment (and Torrential Tear) - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index 6a5f8b7677..308fe9e4d2 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -1,10 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -24,18 +18,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -46,27 +32,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index b5e9eb4101..57b33bb787 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,11 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -26,18 +19,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -48,37 +33,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); - var postHardmodeClam = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCLAMHardMode); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - postHardmodeClam.Add(ModContent.ItemType(), new Fraction(12, 100), 2, 5); - - // Weapons - postHardmodeClam.Add(new OneFromOptionsNotScaledWithLuckDropRule(7, 100, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index a67f4d7bdd..500771f63b 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -1,5 +1,3 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Tiles.Furniture; using Terraria; using Terraria.ID; @@ -16,13 +14,5 @@ namespace CalamityMod.Items.Placeables.Furniture Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Blue; } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddIngredient(2). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 7568c46903..1002d5134e 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -44,14 +43,5 @@ namespace CalamityMod.Items.Weapons.Summon player.UpdateMaxTurrets(); return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnySilverBar", 10). - AddIngredient(3). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 95fbb505ef..398aee940e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -93,9 +93,8 @@ AlluringBait: { DisplayName: Alluring Bait Tooltip: ''' - Increases fishing power by 30 - Greatly increases chance of catching potion ingredient fish - Potion ingredient fish yield is increased + Increases fishing power by 10 + Increases the yield of potion ingredient fish ''' } @@ -706,7 +705,12 @@ ElysianAegis: { EnchantedPearl: { DisplayName: Enchanted Pearl - Tooltip: Increases fishing power by 10 and crate catch chance by 10% + Tooltip: + ''' + Increases fishing power by 10 + Increases chance to catch crates and loot-containing fish by 15% + Crates are 25% more likely to be higher quality + ''' } EtherealExtorter: { @@ -1746,11 +1750,9 @@ SupremeBaitTackleBoxFishingStation: { DisplayName: Supreme Bait Tackle Box Fishing Station Tooltip: ''' - Increases fishing skill by 80, and crate catch chance by 10% + Increases fishing power by 50 Fishing line will never break and decreases chance of bait consumption - Allows fishing in lava - Sonar potion effect - The ultimate fishing accessory + Allows fishing in lava and detects hooked fish ''' } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 9a67e12607..85c64dcb67 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -1716,22 +1716,6 @@ namespace CalamityMod.Systems r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); - - // Band of Regeneration - r = Recipe.Create(ItemID.BandofRegeneration); - r.AddIngredient(ItemID.Shackle); - r.AddIngredient(ItemID.LifeCrystal, 1); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Flare Gun - r = Recipe.Create(ItemID.FlareGun); - r.AddRecipeGroup(AnyCopperBar, 5); - r.AddIngredient(ItemID.Torch, 10); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); } #endregion diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index ab5c4d06d8..1cb2255b9f 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; using CalamityMod.NPCs.SulphurousSea; @@ -282,51 +283,323 @@ namespace CalamityMod } /// - /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions + /// Adds all the common drops for Biome Crates. /// /// The ILoot interface for the loot table. /// Whether or not the crate is considered a hardmode crate. - public static void AddCratePotionRules(this ILoot loot, bool hardMode = true) + public static void AddBiomeCrateLootRules(this ILoot loot, bool hardMode = true) { - loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); - loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); - loot.Add(ItemID.IronskinPotion, 10, 1, 3); - loot.Add(ItemID.NightOwlPotion, 10, 1, 3); - loot.Add(ItemID.ShinePotion, 10, 1, 3); - loot.Add(ItemID.MiningPotion, 10, 1, 3); - loot.Add(ItemID.HeartreachPotion, 10, 1, 3); - loot.Add(ItemID.TrapsightPotion, 10, 1, 3); // Dangersense Potion - - // Define all the loot rules for the potion types - var supremePots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ModContent.ItemType(), ModContent.ItemType()); - var superPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.SuperHealingPotion, ItemID.SuperManaPotion); - var greaterPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.GreaterHealingPotion, ItemID.GreaterManaPotion); - var regularPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.HealingPotion, ItemID.ManaPotion); - var lesserPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.LesserHealingPotion, ItemID.LesserManaPotion); - - // Chained LeadingConditionRules achieve the equivalent of "if killed X, else if killed Y, else if killed Z, else..." - var lcrSupremePotion = loot.DefineConditionalDropSet(() => DownedBossSystem.downedDoG); - var lcrSuperPotion = new LeadingConditionRule(If(() => DownedBossSystem.downedProvidence)); - var lcrGreaterPotion = new LeadingConditionRule(If(() => NPC.downedMechBossAny)); - var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); - - // Actually chain all the LCRs together - // Greater potions upwards are only chained if the crate is marked as Hardmode if (hardMode) + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); + else { - lcrSupremePotion.Add(supremePots); - lcrSupremePotion.OnFailedConditions(lcrSuperPotion); - lcrSuperPotion.Add(superPots); - lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); - lcrGreaterPotion.Add(greaterPots); - lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + // Pre-Hardmode Ore/Bar loot pools + // 20-35 Ores @ 14.29%; Individually 1.79% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + loot.Add(new OneFromRulesRule(7, phmOres)); + + // 6-16 Bars @ 25%; Individually 4.17% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + loot.Add(new OneFromRulesRule(4, phmBars)); } - lcrRegularPotion.Add(regularPots); - lcrRegularPotion.OnFailedConditions(lesserPots); - // Add the chain starting from regular potions if marked as a Pre-Hardmode crate - if (!hardMode) + + // 2-4 Buff Potions @ 25%; Individually 4.17% + loot.Add(new OneFromRulesRule(4, new IItemDropRule[6] { - loot.Add(lcrRegularPotion); + ItemDropRule.NotScalingWithLuck(ItemID.ObsidianSkinPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.SpelunkerPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HunterPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.GravitationPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.MiningPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HeartreachPotion, 1, 2, 4) + })); + + // 5-17 (Regular) Recovery Potions @ 50%; 25% Healing 25% Mana + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 1, 5, 17), + ItemDropRule.NotScalingWithLuck(ItemID.ManaPotion, 1, 5, 17) + })); + + // 2-6 Bait @ 50%; 25% Master 25% Apprentice + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MasterBait, 1, 2, 6), + ItemDropRule.NotScalingWithLuck(ItemID.ApprenticeBait, 1, 2, 6) + })); + + // 5-12 Gold Coin @ 25% + loot.Add(ItemID.GoldCoin, 4, 5, 12); + } + + /// + /// Adds (or re-adds) Hardmode Ores to crates with respect to Hardmode Progression rework
+ /// Drop rules replicate vanilla's rules. + ///
+ /// The ILoot interface for the loot table. + /// Type of crate: Mythril, Titanium, Biome + public static void AddHardmodeOresToCrates(this ILoot loot, HardmodeCrateType type) + { + var adamantiteLCR = loot.DefineConditionalDropSet(AdamantiteCondition); + var mythrilLCR = new LeadingConditionRule(MythrilCondition); + if (type == HardmodeCrateType.Biome) + { + // Pre-Hardmode loot pools + // 20-35 Ores @ 7.14%; Individually 0.89% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + // 6-16 Bars @ 8.33%; Individually 1.39% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + + // Tier 3 loot pools + // 20-35 Ores @ 7.14%; Individually 1.19% + IItemDropRule[] hmOresThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 2.78% + IItemDropRule[] hmBarsThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 5, 16) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + + // Tier 2 loot pools + // 20-35 Ores @ 7.14%; Individually 1.79% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 4.17% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + + // Tier 1 loot pools + // 20-35 Ores @ 7.14%; Individually 3.57% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 8.33% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + + adamantiteLCR.Add(adamantiteDropsOres); + adamantiteLCR.Add(adamantiteDropsBars); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDropsOres); + mythrilLCR.Add(mythrilDropsBars); + mythrilLCR.OnFailedConditions(cobaltDropsOres); + mythrilLCR.OnFailedConditions(cobaltDropsBars); + } + else if (type == HardmodeCrateType.Mythril) + { + // Pre-Hardmode loot pools + // 12-21 Ores @ 8.33%; Individually 1.39% + IItemDropRule[] phmOres = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 12, 21), + }; + // 4-7 Bars @ 6.94%; Individually 1.16% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TinBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 4, 7), + }; + + // Tier 2 loot pools + // 12-21 Ores @ 8.33%; Individually 2.08% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 3.47% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 3, 7) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // 12-21 Ores @ 8.33%; Individually 4.17% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 6.94% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); + loot.Add(mythrilLCR); // No Adamantite LCR here so we need to add this in + } + else if (type == HardmodeCrateType.Titanium) + { + // Pre-Hardmode loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] phmOres = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 25, 34) + }; + // 8-11 Bars @ 8.89%; Individually 2.22% + IItemDropRule[] phmBars = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 8, 11) + }; + + // Tier 3 loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] hmOresThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 4.44% + IItemDropRule[] hmBarsThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 8, 11) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + var adamantiteDrops = new SequentialRulesNotScalingWithLuckRule(1, adamantiteDropsOres, adamantiteDropsBars); + + // Tier 2 loot pools + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // EXCEPTION: Titanium Crates do not drop Cobalt. This is added to make it not entirely useless to get early. + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 8, 11) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + adamantiteLCR.Add(adamantiteDrops); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); } } #endregion @@ -484,6 +757,25 @@ namespace CalamityMod #endregion #region Drop Rule Conditions + public static IItemDropRuleCondition MythrilCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Mythril/Orichalcum can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then any Mechanical Boss must be defeated for Mythril/Orichalcum to drop. + return NPC.downedMechBossAny; + }); + public static IItemDropRuleCondition AdamantiteCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Adamantite/Titanium can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then 2 of the Mechanical Bosses must be defeated for Adamantite/Titanium to drop. + return (NPC.downedMechBoss1 && NPC.downedMechBoss2) || (NPC.downedMechBoss2 && NPC.downedMechBoss3) || (NPC.downedMechBoss1 && NPC.downedMechBoss3); + }); + public static IItemDropRuleCondition HallowedBarsCondition = If((info) => { // If the Early Hardmode Progression Rework is not enabled, then Hallowed Bars can always drop from Mechanical Bosses.