diff --git a/Mage/src/mage/target/TargetImpl.java b/Mage/src/mage/target/TargetImpl.java index 7967c1bc9f..17a5c0a7e1 100644 --- a/Mage/src/mage/target/TargetImpl.java +++ b/Mage/src/mage/target/TargetImpl.java @@ -298,24 +298,35 @@ public abstract class TargetImpl> implements Target { @Override public boolean isLegal(Ability source, Game game) { //20101001 - 608.2b + Set illegalTargets = new HashSet(); + int replacedTargets = 0; for (UUID targetId: targets.keySet()) { Card card = game.getCard(targetId); if (card != null) { if (zoneChangeCounters.containsKey(targetId) && zoneChangeCounters.get(targetId) != card.getZoneChangeCounter()) { - continue; // it's not legal so continue to have a look at other targeted cards + illegalTargets.add(targetId); + continue; // it's not legal so continue to have a look at other targeted objects } } if (game.replaceEvent(GameEvent.getEvent(EventType.TARGET, targetId, source.getId(), source.getControllerId()))) { + replacedTargets++; continue; } - if (canTarget(targetId, source, game)) { - return true; + if (!canTarget(targetId, source, game)) { + illegalTargets.add(targetId); } } + // remove illegal targets, needed to handle if only a subset of targets was illegal + for (UUID targetId: illegalTargets) { + targets.remove(targetId); + } + if (replacedTargets > 0 && replacedTargets == targets.size()) { + return false; + } if (minNumberOfTargets == 0 && targets.isEmpty()) { return true; } - return false; + return targets.size() > 0; } @Override diff --git a/Mage/src/mage/target/targetpointer/FirstTargetPointer.java b/Mage/src/mage/target/targetpointer/FirstTargetPointer.java index 040526ff1c..1303e2b633 100644 --- a/Mage/src/mage/target/targetpointer/FirstTargetPointer.java +++ b/Mage/src/mage/target/targetpointer/FirstTargetPointer.java @@ -44,16 +44,12 @@ public class FirstTargetPointer implements TargetPointer { public List getTargets(Game game, Ability source) { ArrayList target = new ArrayList(); if (source.getTargets().size() > 0) { - Target currentTarget = source.getTargets().get(0); for (UUID targetId : source.getTargets().get(0).getTargets()) { Card card = game.getCard(targetId); if (card != null && zoneChangeCounter.containsKey(targetId) && card.getZoneChangeCounter() != zoneChangeCounter.get(targetId)) { continue; } - if (!currentTarget.canTarget(targetId, source, game)) { - continue; - } target.add(targetId); } }