From a2633e81ff15608bc6d88bd000bf368fe3bb59af Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 29 Sep 2024 14:11:42 -0400 Subject: [PATCH] Exhuming now supports stackable items --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index d4aa053294..0af121ab93 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -176,8 +176,13 @@ namespace CalamityMod.UI.CalamitasEnchants // Increase the cost of enchanting significantly if doing so would upgrade the item directly. if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == CalamityUtils.GetText(EnchantmentManager.ExhumedNamePath)) + { cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; + // 29SEP2024: Ozzatron: exhuming stackable items scales the cost with the stack size + cost *= CurrentlyHeldItem.stack; + } + // Make it 20% cheaper if the player has the Discount Card or Greedy Ring if (Main.LocalPlayer.discountAvailable) cost = (int)(cost * 0.8); @@ -374,7 +379,9 @@ namespace CalamityMod.UI.CalamitasEnchants bool IsExhuming = SelectedEnchantment.Value.Name == CalamityUtils.GetText(EnchantmentManager.ExhumedNamePath); + // 29SEP2024: Ozzatron: exhuming stackable items produces a stack of the same size int oldPrefix = CurrentlyHeldItem.prefix; + int oldStack = CurrentlyHeldItem.stack; CurrentlyHeldItem.SetDefaults(CurrentlyHeldItem.type); CurrentlyHeldItem.Prefix(oldPrefix); CurrentlyHeldItem = CurrentlyHeldItem.Clone(); @@ -383,6 +390,7 @@ namespace CalamityMod.UI.CalamitasEnchants { CurrentlyHeldItem.SetDefaults(EnchantmentManager.ItemUpgradeRelationship[CurrentlyHeldItem.type]); CurrentlyHeldItem.Prefix(oldPrefix); + CurrentlyHeldItem.stack = oldStack; } else {