* Fixed a problem with countering abilities on the stack.

This commit is contained in:
LevelX2 2015-11-05 15:39:12 +01:00
parent 3940ff4b2e
commit e82a7b621e
2 changed files with 4 additions and 4 deletions

View file

@ -103,10 +103,7 @@ class TargetStackObjectTargetingControlledPermanent extends TargetObject {
@Override @Override
public boolean canTarget(UUID id, Ability source, Game game) { public boolean canTarget(UUID id, Ability source, Game game) {
StackObject stackObject = game.getStack().getStackObject(id); StackObject stackObject = game.getStack().getStackObject(id);
if ((stackObject instanceof Spell) || (stackObject instanceof StackAbility)) { return (stackObject instanceof Spell) || (stackObject instanceof StackAbility);
return true;
}
return false;
} }
@Override @Override

View file

@ -105,6 +105,9 @@ public class SpellStack extends ArrayDeque<StackObject> {
counteredObjectName = "Ability (" + stackObject.getStackAbility().getRule(targetSourceName) + ") of " + targetSourceName; counteredObjectName = "Ability (" + stackObject.getStackAbility().getRule(targetSourceName) + ") of " + targetSourceName;
} }
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, sourceId, stackObject.getControllerId()))) { if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, sourceId, stackObject.getControllerId()))) {
if (!(stackObject instanceof Spell)) { // spells are removed from stack by the card movement
this.remove(stackObject);
}
stackObject.counter(sourceId, game, zone, owner, onTop); stackObject.counter(sourceId, game, zone, owner, onTop);
if (!game.isSimulation()) { if (!game.isSimulation()) {
game.informPlayers(counteredObjectName + " is countered by " + sourceObject.getLogName()); game.informPlayers(counteredObjectName + " is countered by " + sourceObject.getLogName());