diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/RadiantFlames.java b/Mage.Sets/src/mage/sets/battleforzendikar/RadiantFlames.java new file mode 100644 index 00000000000..da9829e3905 --- /dev/null +++ b/Mage.Sets/src/mage/sets/battleforzendikar/RadiantFlames.java @@ -0,0 +1,62 @@ +/* + * 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.battleforzendikar; + +import java.util.UUID; +import mage.abilities.dynamicvalue.common.ColorsOfManaSpentToCastCount; +import mage.abilities.effects.common.DamageAllEffect; +import mage.cards.CardImpl; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class RadiantFlames extends CardImpl { + + public RadiantFlames(UUID ownerId) { + super(ownerId, 151, "Radiant Flames", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}"); + this.expansionSetCode = "BFZ"; + + // Converge — Radiant Flames deals X damage to each creature, where X is the number of colors of mana spent to cast Radiant Flames. + getSpellAbility().setAbilityWord(AbilityWord.CONVERGE); + getSpellAbility().addEffect(new DamageAllEffect(ColorsOfManaSpentToCastCount.getInstance(), new FilterCreaturePermanent())); + } + + public RadiantFlames(final RadiantFlames card) { + super(card); + } + + @Override + public RadiantFlames copy() { + return new RadiantFlames(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/JelevaNephaliasScourge.java b/Mage.Sets/src/mage/sets/commander2013/JelevaNephaliasScourge.java index 4fbc4aba7cb..965cb69fd59 100644 --- a/Mage.Sets/src/mage/sets/commander2013/JelevaNephaliasScourge.java +++ b/Mage.Sets/src/mage/sets/commander2013/JelevaNephaliasScourge.java @@ -116,7 +116,7 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { int cardsToExile = Math.min(player.getLibrary().size(), xValue); - for(int i = 0; i < cardsToExile; i++) { + for (int i = 0; i < cardsToExile; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { card.moveToExile(CardUtil.getCardExileZoneId(game, source), sourceCard.getName(), source.getSourceId(), game); @@ -170,7 +170,7 @@ class JelevaNephaliasCastEffect extends OneShotEffect { class JelevaNephaliasWatcher extends Watcher { - private Map manaSpendToCast = new HashMap<>(); // cast + private final Map manaSpendToCast = new HashMap<>(); // cast public JelevaNephaliasWatcher() { super("ManaPaidToCastJelevaNephalias", WatcherScope.CARD); @@ -190,10 +190,10 @@ class JelevaNephaliasWatcher extends Watcher { if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(sourceId)) { if (!game.getStack().isEmpty()) { for (StackObject stackObject : game.getStack()) { - if (stackObject instanceof Spell && ((Spell)stackObject).getSourceId().equals(sourceId)) { + if (stackObject instanceof Spell && ((Spell) stackObject).getSourceId().equals(sourceId)) { Card card = game.getCard(sourceId); if (!manaSpendToCast.containsValue(card.getZoneChangeCounter(game))) { - manaSpendToCast.put(new Integer(card.getZoneChangeCounter(game)), new Integer(((Spell)stackObject).getSpellAbility().getManaCostsToPay().convertedManaCost())); + manaSpendToCast.put(card.getZoneChangeCounter(game), ((Spell) stackObject).getSpellAbility().getManaCostsToPay().convertedManaCost()); } } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/abilitywords/ConvergeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/abilitywords/ConvergeTest.java new file mode 100644 index 00000000000..d374c691c5e --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/abilitywords/ConvergeTest.java @@ -0,0 +1,89 @@ +/* + * 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 org.mage.test.cards.abilities.abilitywords; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class ConvergeTest extends CardTestPlayerBase { + + /** + * Test with only red mana + */ + @Test + public void testOnlyOneColor() { + // Converge — Radiant Flames deals X damage to each creature, where X is the number of colors of mana spent to cast Radiant Flames. + addCard(Zone.HAND, playerA, "Radiant Flames", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerA, "Akroan Jailer", 1); // 1/1 + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerB, "Akroan Jailer", 1); // 1/1 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Radiant Flames"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Akroan Jailer", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerB, "Akroan Jailer", 1); + assertPermanentCount(playerB, "Silvercoat Lion", 1); + } + + @Test + public void testWithTwoColors() { + // Converge — Radiant Flames deals X damage to each creature, where X is the number of colors of mana spent to cast Radiant Flames. + addCard(Zone.HAND, playerA, "Radiant Flames", 1); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerA, "Akroan Jailer", 1); // 1/1 + + addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerB, "Akroan Jailer", 1); // 1/1 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Radiant Flames"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Akroan Jailer", 1); + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerB, "Akroan Jailer", 1); + assertGraveyardCount(playerB, "Silvercoat Lion", 1); + } + +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java new file mode 100644 index 00000000000..88c54fd7fb8 --- /dev/null +++ b/Mage/src/mage/abilities/dynamicvalue/common/ColorsOfManaSpentToCastCount.java @@ -0,0 +1,81 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.dynamicvalue.common; + +import java.io.ObjectStreamException; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.stack.Spell; + +/** + * + * @author LevelX2 + */ +public class ColorsOfManaSpentToCastCount implements DynamicValue { + + private static final ColorsOfManaSpentToCastCount fINSTANCE = new ColorsOfManaSpentToCastCount(); + + private Object readResolve() throws ObjectStreamException { + return fINSTANCE; + } + + public static ColorsOfManaSpentToCastCount getInstance() { + return fINSTANCE; + } + + @Override + public int calculate(Game game, Ability source, Effect effect) { + int count = 0; + Spell spell = game.getStack().getSpell(source.getSourceId()); + if (spell == null) { + MageObject mageObject = game.getLastKnownInformation(source.getSourceId(), Zone.STACK); + if (mageObject instanceof Spell) { + spell = (Spell) mageObject; + } + } + if (spell != null) { + // NOT the cmc of the spell on the stack + Mana mana = spell.getSpellAbility().getManaCostsToPay().getPayment(); + if (mana.getBlack() > 0) { + count++; + } + if (mana.getBlue() > 0) { + count++; + } + if (mana.getGreen() > 0) { + count++; + } + if (mana.getRed() > 0) { + count++; + } + if (mana.getWhite() > 0) { + count++; + } + } + return count; + } + + @Override + public ColorsOfManaSpentToCastCount copy() { + return new ColorsOfManaSpentToCastCount(); + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "the number of colors of mana spent to cast {this}"; + } + +} diff --git a/Mage/src/mage/abilities/effects/common/DamageAllEffect.java b/Mage/src/mage/abilities/effects/common/DamageAllEffect.java index 7c2bb29618c..e537e7b304d 100644 --- a/Mage/src/mage/abilities/effects/common/DamageAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageAllEffect.java @@ -1,16 +1,16 @@ /* * 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 @@ -20,20 +20,19 @@ * 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.abilities.effects.common; import java.util.List; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -50,6 +49,7 @@ public class DamageAllEffect extends OneShotEffect { public DamageAllEffect(int amount, FilterPermanent filter) { this(new StaticValue(amount), filter); } + public DamageAllEffect(DynamicValue amount, FilterPermanent filter) { super(Outcome.Damage); this.amount = amount; @@ -71,7 +71,7 @@ public class DamageAllEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); - for (Permanent permanent: permanents) { + for (Permanent permanent : permanents) { permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } return true; @@ -82,9 +82,13 @@ public class DamageAllEffect extends OneShotEffect { sb.append("{source} deals ").append(amount.toString()).append(" damage to each ").append(filter.getMessage()); String message = amount.getMessage(); if (message.length() > 0) { - sb.append(" for each "); + if (amount.toString().equals("X")) { + sb.append(", where X is "); + } else { + sb.append(" for each "); + } + sb.append(message); } - sb.append(message); staticText = sb.toString(); } diff --git a/Mage/src/mage/constants/AbilityWord.java b/Mage/src/mage/constants/AbilityWord.java index 1ef899c62fd..29088e89d1f 100644 --- a/Mage/src/mage/constants/AbilityWord.java +++ b/Mage/src/mage/constants/AbilityWord.java @@ -33,7 +33,9 @@ package mage.constants; */ public enum AbilityWord { + RALLY("Rally"), BLOODRUSH("Bloodrush"), + CONVERGE("Converge"), CONSTELLATION("Constellation"), FEROCIOUS("Ferocious"), FORMIDABLE("Formidable"), diff --git a/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java b/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java index c8f9eb2258c..33ea4c44808 100644 --- a/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java +++ b/Mage/src/mage/target/common/TargetCreatureOrPlayerAmount.java @@ -1,41 +1,40 @@ /* -* 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.common; import java.util.HashSet; import java.util.Set; import java.util.UUID; -import mage.constants.Zone; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreatureOrPlayer; import mage.filter.common.FilterCreaturePermanent; @@ -64,7 +63,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { public TargetCreatureOrPlayerAmount(DynamicValue amount) { super(amount); this.zone = Zone.ALL; - this.filter = new FilterCreatureOrPlayer(); + this.filter = new FilterCreatureOrPlayer("creatures and/or players"); this.targetName = filter.getMessage(); } @@ -124,7 +123,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { int count = 0; MageObject targetSource = game.getObject(sourceId); - for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) { + for (UUID playerId : game.getPlayer(sourceControllerId).getInRange()) { Player player = game.getPlayer(playerId); if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(player, game)) { count++; @@ -133,7 +132,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { } } } - for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) { count++; if (count >= this.minNumberOfTargets) { @@ -147,7 +146,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { @Override public boolean canChoose(UUID sourceControllerId, Game game) { int count = 0; - for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) { + for (UUID playerId : game.getPlayer(sourceControllerId).getInRange()) { Player player = game.getPlayer(playerId); if (player != null && filter.match(player, game)) { count++; @@ -156,7 +155,7 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { } } } - for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { if (filter.match(permanent, null, sourceControllerId, game)) { count++; if (count >= this.minNumberOfTargets) { @@ -171,13 +170,13 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); MageObject targetSource = game.getObject(sourceId); - for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) { + for (UUID playerId : game.getPlayer(sourceControllerId).getInRange()) { Player player = game.getPlayer(playerId); if (player != null && player.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(player, game)) { possibleTargets.add(playerId); } } - for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) { possibleTargets.add(permanent.getId()); } @@ -188,13 +187,13 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { @Override public Set possibleTargets(UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); - for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()) { + for (UUID playerId : game.getPlayer(sourceControllerId).getInRange()) { Player player = game.getPlayer(playerId); if (player != null && filter.match(player, game)) { possibleTargets.add(playerId); } } - for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), sourceControllerId, game)) { if (filter.match(permanent, null, sourceControllerId, game)) { possibleTargets.add(permanent.getId()); } @@ -205,12 +204,11 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount { @Override public String getTargetedName(Game game) { StringBuilder sb = new StringBuilder(); - for (UUID targetId: getTargets()) { + for (UUID targetId : getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { sb.append(permanent.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); - } - else { + } else { Player player = game.getPlayer(targetId); sb.append(player.getLogName()).append("(").append(getTargetAmount(targetId)).append(") "); }