From 10649d9fb00a281aa735ba6baf31d7dc4654af41 Mon Sep 17 00:00:00 2001 From: Sloth Date: Thu, 9 May 2013 06:33:37 +0000 Subject: [PATCH] - Cleanup of hasCandidates. --- .../java/forge/card/spellability/Target.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/forge/card/spellability/Target.java b/src/main/java/forge/card/spellability/Target.java index 4c5eed5ba38..2959aed8df1 100644 --- a/src/main/java/forge/card/spellability/Target.java +++ b/src/main/java/forge/card/spellability/Target.java @@ -660,7 +660,7 @@ public class Target { * @return a boolean. */ public final boolean hasCandidates(final SpellAbility sa, final boolean isTargeted) { - final GameState game = sa.getActivatingPlayer().getGame(); + final GameState game = sa.getSourceCard().getGame(); for (Player player : game.getPlayers()) { if (sa.canTarget(player)) { return true; @@ -672,13 +672,16 @@ public class Target { return true; } else { for (final Card c : game.getCardsIn(this.tgtZone)) { - boolean isValidTarget = c.isValid(this.validTgts, this.srcCard.getController(), this.srcCard); - boolean canTarget = (!isTargeted || c.canBeTargetedBy(sa)); - boolean isAlreadyTargeted = this.getTargetCards().contains(c); - //System.out.print(c); - if (isValidTarget && canTarget && !isAlreadyTargeted) { - return true; + if (!c.isValid(this.validTgts, this.srcCard.getController(), this.srcCard)) { + continue; } + if (isTargeted && !c.canBeTargetedBy(sa)) { + continue; + } + if (this.getTargetCards().contains(c)) { + continue; + } + return true; } }