Fixed Issue 270.

114.4. A spell or ability on the stack is an illegal target for itself.
This commit is contained in:
magenoxx 2011-10-12 12:04:45 +04:00
parent 7a610a27a6
commit e949d046df

View file

@ -28,9 +28,6 @@
package mage.target;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.filter.FilterSpell;
@ -38,6 +35,10 @@ import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -76,14 +77,18 @@ public class TargetSpell extends TargetObject<TargetSpell> {
return filter;
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Spell spell = game.getStack().getSpell(id);
if (spell != null) {
return filter.match(spell);
}
return false;
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
// rule 114.4. A spell or ability on the stack is an illegal target for itself.
if (source != null && source.getId().equals(id)) {
return false;
}
Spell spell = game.getStack().getSpell(id);
if (spell != null) {
return filter.match(spell);
}
return false;
}
@Override
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {