v0.9.0: prevented reclaim trap from being dropped when a trap is stored

This commit is contained in:
Evan Debenham 2020-09-16 15:26:02 -04:00
parent 0dc3a21436
commit de9d629a7f

View File

@ -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<?extends Trap> storedTrap = null;
@Override
public ArrayList<String> actions(Hero hero) {
ArrayList<String> 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 ),