From edc00a227eb5a37328436140c0bfdb135cb607c3 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Feb 2024 11:38:31 -0500 Subject: [PATCH] Don't worry, we'll stop counting at 50! Actually counts to 100 like a boss. --- Items/VanillaArmorChanges/GoldArmorSetChange.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index d77ca4fd66..eb18aab587 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -1,4 +1,5 @@ -using System.Text; +using System; +using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float GoldDropChanceFromEnemies = 0.04f; public const int GoldFromBosses = 3; public const float SetBonusCritPerGoldCoin = 0.2f; // 5 gold coins = +1% crit chance + public const float MaximumCritBonus = 10f; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -43,11 +45,13 @@ namespace CalamityMod.Items.VanillaArmorChanges // Give the crit chance from gold in inventory. // If you have any platinum, this guarantees the max boost. if (player.InventoryHas(ItemID.PlatinumCoin)) - critFromGold = 10f; + critFromGold = MaximumCritBonus; else { + // 13FEB2024: Ozzatron: this function doesn't cap at its second argument, it just stops counting if it exceeds that number + // so this can give up to 100 gold coins int goldCoins = player.CountItem(ItemID.GoldCoin, 50); - critFromGold = goldCoins * SetBonusCritPerGoldCoin; + critFromGold = Math.Max(goldCoins * SetBonusCritPerGoldCoin, MaximumCritBonus); } player.GetCritChance() += critFromGold;