From 69dc4f10ac1ff9df8b18ae9169762d1c1b0a3eeb Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 11 Sep 2015 23:03:03 +0200 Subject: [PATCH] * Fixed that spells with targets cast without paying mana could simply be canceled by canceling the target selection (e.g. player was able to cancel a spell cast by suspend what's not allowed by the rules). --- .../sets/gatecrash/IllusionistsBracers.java | 77 ++++++++-------- .../mage/sets/lorwyn/RingsOfBrighthearth.java | 22 ++--- .../sets/magic2014/StrionicResonator.java | 21 ++--- .../sets/magic2015/KurkeshOnakkeAncient.java | 2 +- .../counter/RemoveCounterSourceEffect.java | 28 +++--- Mage/src/mage/target/Targets.java | 87 ++++++++++--------- 6 files changed, 118 insertions(+), 119 deletions(-) diff --git a/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java b/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java index 7143298d44..ae59bc58e3 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java +++ b/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java @@ -1,30 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.sets.gatecrash; import java.util.UUID; @@ -48,21 +48,21 @@ import mage.game.stack.StackAbility; import mage.players.Player; /** -* -* @author LevelX2 -*/ + * + * @author LevelX2 + */ public class IllusionistsBracers extends CardImpl { public IllusionistsBracers(UUID ownerId) { - super(ownerId, 231, "Illusionist's Bracers", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); - this.expansionSetCode = "GTC"; - this.subtype.add("Equipment"); + super(ownerId, 231, "Illusionist's Bracers", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "GTC"; + this.subtype.add("Equipment"); - // Whenever an ability of equipped creature is activated, if it isn't a mana ability, copy that ability. You may choose new targets for the copy. - this.addAbility(new AbilityActivatedTriggeredAbility()); + // Whenever an ability of equipped creature is activated, if it isn't a mana ability, copy that ability. You may choose new targets for the copy. + this.addAbility(new AbilityActivatedTriggeredAbility()); - // Equip 3 - this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3))); + // Equip 3 + this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3))); } public IllusionistsBracers(final IllusionistsBracers card) { @@ -76,6 +76,7 @@ public class IllusionistsBracers extends CardImpl { } class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl { + AbilityActivatedTriggeredAbility() { super(Zone.BATTLEFIELD, new CopyActivatedAbilityEffect()); } @@ -110,7 +111,7 @@ class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever an ability of equipped creature is activated, if it isn't a mana ability, copy that ability. You may choose new targets for the copy."; + return "Whenever an ability of equipped creature is activated, if it isn't a mana ability, copy that ability. You may choose new targets for the copy."; } } @@ -142,7 +143,7 @@ class CopyActivatedAbilityEffect extends OneShotEffect { if (newAbility.getTargets().size() > 0) { if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) { newAbility.getTargets().clearChosen(); - if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) { + if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) { return false; } } diff --git a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java index e591c15973..4bf012e1bb 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java +++ b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java @@ -57,7 +57,7 @@ public class RingsOfBrighthearth extends CardImpl { this.expansionSetCode = "LRW"; // Whenever you activate an ability, if it isn't a mana ability, you may pay {2}. If you do, copy that ability. You may choose new targets for the copy. - this.addAbility(new RingsOfBrighthearthTriggeredAbility()); + this.addAbility(new RingsOfBrighthearthTriggeredAbility()); } public RingsOfBrighthearth(final RingsOfBrighthearth card) { @@ -71,15 +71,15 @@ public class RingsOfBrighthearth extends CardImpl { } class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { - + RingsOfBrighthearthTriggeredAbility() { super(Zone.BATTLEFIELD, new RingsOfBrighthearthEffect(), false); } - + RingsOfBrighthearthTriggeredAbility(final RingsOfBrighthearthTriggeredAbility ability) { super(ability); } - + @Override public RingsOfBrighthearthTriggeredAbility copy() { return new RingsOfBrighthearthTriggeredAbility(this); @@ -89,7 +89,7 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { public boolean checkEventType(GameEvent event, Game game) { return event.getType() == EventType.ACTIVATED_ABILITY; } - + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(getControllerId())) { @@ -102,7 +102,7 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { } return false; } - + @Override public String getRule() { return "Whenever you activate an ability, if it isn't a mana ability, you may pay {2}. If you do, copy that ability. You may choose new targets for the copy."; @@ -110,21 +110,21 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { } class RingsOfBrighthearthEffect extends OneShotEffect { - + RingsOfBrighthearthEffect() { super(Outcome.Benefit); this.staticText = ", you may pay {2}. If you do, copy that ability. You may choose new targets for the copy."; } - + RingsOfBrighthearthEffect(final RingsOfBrighthearthEffect effect) { super(effect); } - + @Override public RingsOfBrighthearthEffect copy() { return new RingsOfBrighthearthEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); @@ -142,7 +142,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect { if (newAbility.getTargets().size() > 0) { if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) { newAbility.getTargets().clearChosen(); - if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) { + if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2014/StrionicResonator.java b/Mage.Sets/src/mage/sets/magic2014/StrionicResonator.java index c05126f8ba..154ad1a475 100644 --- a/Mage.Sets/src/mage/sets/magic2014/StrionicResonator.java +++ b/Mage.Sets/src/mage/sets/magic2014/StrionicResonator.java @@ -57,8 +57,6 @@ import mage.target.TargetObject; */ public class StrionicResonator extends CardImpl { - - public StrionicResonator(UUID ownerId) { super(ownerId, 224, "Strionic Resonator", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "M14"; @@ -92,8 +90,8 @@ class StrionicResonatorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - StackAbility stackAbility = (StackAbility)game.getStack().getStackObject(targetPointer.getFirst(game, source)); - if(stackAbility != null){ + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(targetPointer.getFirst(game, source)); + if (stackAbility != null) { Ability ability = (Ability) stackAbility.getStackAbility(); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); @@ -104,7 +102,7 @@ class StrionicResonatorEffect extends OneShotEffect { if (newAbility.getTargets().size() > 0) { if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) { newAbility.getTargets().clearChosen(); - if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) { + if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) { return false; } } @@ -114,7 +112,7 @@ class StrionicResonatorEffect extends OneShotEffect { } } return false; - + } @Override @@ -122,7 +120,7 @@ class StrionicResonatorEffect extends OneShotEffect { return new StrionicResonatorEffect(this); } - @Override + @Override public String getText(Mode mode) { StringBuilder sb = new StringBuilder(); sb.append("Copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy"); @@ -143,7 +141,6 @@ class TargetTriggeredAbility extends TargetObject { super(target); } - @Override public boolean canTarget(UUID id, Ability source, Game game) { if (source != null && source.getSourceId().equals(id)) { @@ -164,11 +161,11 @@ class TargetTriggeredAbility extends TargetObject { @Override public boolean canChoose(UUID sourceControllerId, Game game) { - for (StackObject stackObject : game.getStack()) { + for (StackObject stackObject : game.getStack()) { if (stackObject.getStackAbility() != null && stackObject.getStackAbility() instanceof TriggeredAbility && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) { - return true; - } + return true; } + } return false; } @@ -180,7 +177,7 @@ class TargetTriggeredAbility extends TargetObject { @Override public Set possibleTargets(UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet(); - for (StackObject stackObject : game.getStack()) { + for (StackObject stackObject : game.getStack()) { if (stackObject.getStackAbility() != null && stackObject.getStackAbility() instanceof TriggeredAbility && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) { possibleTargets.add(stackObject.getStackAbility().getId()); } diff --git a/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java b/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java index 961a2c742f..ad94b5cce0 100644 --- a/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java +++ b/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java @@ -152,7 +152,7 @@ class KurkeshOnakkeAncientEffect extends OneShotEffect { if (newAbility.getTargets().size() > 0) { if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", source, game)) { newAbility.getTargets().clearChosen(); - if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) { + if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, false, game) == false) { return false; } } diff --git a/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 6da3bf9cf0..b76c5771bc 100644 --- a/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.effects.common.counter; import mage.abilities.Ability; @@ -40,8 +39,8 @@ import mage.game.permanent.Permanent; * * @author Loki */ - public class RemoveCounterSourceEffect extends OneShotEffect { + private final Counter counter; public RemoveCounterSourceEffect(Counter counter) { @@ -57,25 +56,24 @@ public class RemoveCounterSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent p = game.getPermanent(source.getSourceId()); - if (p != null && p.getCounters().getCount(counter.getName()) >= counter.getCount()) { - p.removeCounters(counter.getName(), counter.getCount(), game); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null && permanent.getCounters().getCount(counter.getName()) >= counter.getCount()) { + permanent.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) { - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) - .append(" counter from ").append(p.getName()).toString()); + game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + " counter from " + permanent.getLogName()); } return true; } - Card c = game.getCard(source.getSourceId()); - if (c != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { - c.removeCounters(counter.getName(), counter.getCount(), game); + Card card = game.getCard(source.getSourceId()); + if (card != null && card.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { + card.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) { - game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) - .append(" counter from ").append(c.getName()) - .append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString()); + game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + + " counter from " + card.getLogName() + + " (" + card.getCounters(game).getCount(counter.getName()) + " left)"); } return true; - } + } return false; } @@ -84,7 +82,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { return new RemoveCounterSourceEffect(this); } - private void setText() { + private void setText() { if (counter.getCount() > 1) { StringBuilder sb = new StringBuilder(); sb.append("remove ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters from {this}"); diff --git a/Mage/src/mage/target/Targets.java b/Mage/src/mage/target/Targets.java index ad1f1c37fb..c29f1932d9 100644 --- a/Mage/src/mage/target/Targets.java +++ b/Mage/src/mage/target/Targets.java @@ -1,58 +1,57 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.target; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import mage.constants.Outcome; import mage.abilities.Ability; +import mage.constants.Outcome; import mage.game.Game; - /** * * @author BetaSteward_at_googlemail.com */ public class Targets extends ArrayList { - public Targets() {} + public Targets() { + } public Targets(final Targets targets) { - for (Target target: targets) { + for (Target target : targets) { this.add(target.copy()); } } public List getUnchosen() { List unchosen = new ArrayList<>(); - for (Target target: this) { + for (Target target : this) { if (!target.isChosen()) { unchosen.add(target); } @@ -61,13 +60,13 @@ public class Targets extends ArrayList { } public void clearChosen() { - for (Target target: this) { + for (Target target : this) { target.clearChosen(); } } public boolean isChosen() { - for (Target target: this) { + for (Target target : this) { if (!target.isChosen()) { return false; } @@ -90,7 +89,7 @@ public class Targets extends ArrayList { return true; } - public boolean chooseTargets(Outcome outcome, UUID playerId, Ability source, Game game) { + public boolean chooseTargets(Outcome outcome, UUID playerId, Ability source, boolean noMana, Game game) { if (this.size() > 0) { if (!canChoose(source.getSourceId(), playerId, game)) { return false; @@ -101,6 +100,9 @@ public class Targets extends ArrayList { if (target.getTargetController() != null) { // some targets can have controller different than ability controller targetController = target.getTargetController(); } + if (noMana) { // if cast without mana (e.g. by supend you may notr be able to cancel the casting if you are able to cast it + target.setRequired(true); + } if (!target.chooseTarget(outcome, targetController, source, game)) { return false; } @@ -113,7 +115,7 @@ public class Targets extends ArrayList { // 608.2 // The spell or ability is countered if all its targets, for every instance of the word "target," are now illegal int illegalCount = 0; - for (Target target: this) { + for (Target target : this) { if (!target.isLegal(source, game)) { illegalCount++; } @@ -123,8 +125,8 @@ public class Targets extends ArrayList { } /** - * Checks if there are enough targets that can be chosen. Should only be used - * for Ability targets since this checks for protection, shroud etc. + * Checks if there are enough targets that can be chosen. Should only be + * used for Ability targets since this checks for protection, shroud etc. * * @param sourceId - the target event source * @param sourceControllerId - controller of the target event source @@ -132,7 +134,7 @@ public class Targets extends ArrayList { * @return - true if enough valid targets exist */ public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { - for (Target target: this) { + for (Target target : this) { if (!target.canChoose(sourceId, sourceControllerId, game)) { return false; } @@ -141,15 +143,16 @@ public class Targets extends ArrayList { } /** - * Checks if there are enough objects that can be selected. Should not be used - * for Ability targets since this does not check for protection, shroud etc. + * Checks if there are enough objects that can be selected. Should not be + * used for Ability targets since this does not check for protection, shroud + * etc. * * @param sourceControllerId - controller of the select event * @param game * @return - true if enough valid objects exist */ public boolean canChoose(UUID sourceControllerId, Game game) { - for (Target target: this) { + for (Target target : this) { if (!target.canChoose(sourceControllerId, game)) { return false; }