From de9d629a7fad898bbfd58e52f353469a0bb75302 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 16 Sep 2020 15:26:02 -0400 Subject: [PATCH] v0.9.0: prevented reclaim trap from being dropped when a trap is stored --- .../items/spells/ReclaimTrap.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java index f2e35a250..c2eaec9b3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/ReclaimTrap.java @@ -37,6 +37,8 @@ import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.Reflection; +import java.util.ArrayList; + public class ReclaimTrap extends TargetedSpell { { @@ -45,6 +47,17 @@ public class ReclaimTrap extends TargetedSpell { private Class storedTrap = null; + @Override + public ArrayList actions(Hero hero) { + ArrayList actions = super.actions(hero); + //prevents exploits + if (storedTrap != null){ + actions.remove(AC_DROP); + actions.remove(AC_THROW); + } + return actions; + } + @Override protected void affectTarget(Ballistica bolt, Hero hero) { if (storedTrap == null) { @@ -80,18 +93,6 @@ public class ReclaimTrap extends TargetedSpell { return desc; } - @Override - protected void onThrow(int cell) { - storedTrap = null; - super.onThrow(cell); - } - - @Override - public void doDrop(Hero hero) { - storedTrap = null; - super.doDrop(hero); - } - private static final ItemSprite.Glowing[] COLORS = new ItemSprite.Glowing[]{ new ItemSprite.Glowing( 0xFF0000 ), new ItemSprite.Glowing( 0xFF8000 ),