Exhuming now supports stackable items

This commit is contained in:
Ozzatron committed 2024-09-29 14:11:42 -04:00
1 parent 94e369e56c
commit a2633e81ff
1 file changed
+8
@@ -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
{