From d9032f750f05181488231d33ca8612bf1714472b Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 16 Mar 2024 06:44:02 -0400 Subject: [PATCH] More itembase refactor work --- src/engine/powers/poweractions/StealPowerAction.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine/powers/poweractions/StealPowerAction.java b/src/engine/powers/poweractions/StealPowerAction.java index 62426407..77133125 100644 --- a/src/engine/powers/poweractions/StealPowerAction.java +++ b/src/engine/powers/poweractions/StealPowerAction.java @@ -62,11 +62,14 @@ public class StealPowerAction extends AbstractPowerAction { } //called to get amount of gold to steal between 0 and max gold - protected static int getAmountToSteal(Item i) { - if (i.getItemBase() != null && i.getItemBase().getUUID() == 7) { - int amount = i.getNumOfItems(); + protected static int getAmountToSteal(Item item) { + if (item.template.item_type.equals(ItemType.GOLD)) { + + int amount = item.getNumOfItems(); + if (amount < 1) return -1; + int a = ThreadLocalRandom.current().nextInt(amount + 1); int b = ThreadLocalRandom.current().nextInt(amount + 1); int c = ThreadLocalRandom.current().nextInt(amount + 1); @@ -99,8 +102,8 @@ public class StealPowerAction extends AbstractPowerAction { if (owner == null) return; - AbstractCharacter ownerAC = null; + if (AbstractWorldObject.IsAbstractCharacter(owner)) ownerAC = (AbstractCharacter) owner;