From e949d046dfedc1e8b938b5ed522beb0102295e19 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 12 Oct 2011 12:04:45 +0400 Subject: [PATCH] Fixed Issue 270. 114.4. A spell or ability on the stack is an illegal target for itself. --- Mage/src/mage/target/TargetSpell.java | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Mage/src/mage/target/TargetSpell.java b/Mage/src/mage/target/TargetSpell.java index 889da3ceae8..6111dc0d37e 100644 --- a/Mage/src/mage/target/TargetSpell.java +++ b/Mage/src/mage/target/TargetSpell.java @@ -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 { 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) {