diff --git a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java index 44b06ad565..d2516e3a65 100644 --- a/Mage.Sets/src/mage/cards/a/AstralCornucopia.java +++ b/Mage.Sets/src/mage/cards/a/AstralCornucopia.java @@ -1,9 +1,5 @@ - package mage.cards.a; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -21,8 +17,11 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class AstralCornucopia extends CardImpl { @@ -67,6 +66,19 @@ class AstralCornucopiaManaEffect extends ManaEffect { return new AstralCornucopiaManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (sourcePermanent != null) { + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); + if (counters > 0) { + netMana.add(Mana.AnyMana(counters)); + } + } + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { Mana mana = new Mana(); @@ -107,16 +119,4 @@ class AstralCornucopiaManaEffect extends ManaEffect { return mana; } - @Override - public List getNetMana(Game game, Ability source) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null) { - int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); - List netMana = new ArrayList<>(); - netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters, 0)); - return netMana; - } - return null; - } - } diff --git a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java index 82c6f7003b..7fe85cffb6 100644 --- a/Mage.Sets/src/mage/cards/b/BenthicExplorers.java +++ b/Mage.Sets/src/mage/cards/b/BenthicExplorers.java @@ -1,8 +1,5 @@ package mage.cards.b; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Abilities; @@ -13,16 +10,11 @@ import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; -import mage.constants.SubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.Choice; import mage.choices.ChoiceColor; -import mage.constants.CardType; -import mage.constants.ColoredManaSymbol; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.TappedPredicate; @@ -32,8 +24,11 @@ import mage.players.Player; import mage.target.common.TargetLandPermanent; import mage.util.CardUtil; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class BenthicExplorers extends CardImpl { @@ -87,7 +82,7 @@ class BenthicExplorersCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (target.choose(Outcome.Untap, controllerId, sourceId, game)) { - for (UUID targetId : (List) target.getTargets()) { + for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent == null) { return false; @@ -123,6 +118,34 @@ class BenthicExplorersManaEffect extends ManaEffect { super(effect); } + @Override + public List getNetMana(Game game, Ability source) { + List netManas = new ArrayList<>(); + Mana types = getManaTypes(game, source); + if (types.getBlack() > 0) { + netManas.add(new Mana(ColoredManaSymbol.B)); + } + if (types.getRed() > 0) { + netManas.add(new Mana(ColoredManaSymbol.R)); + } + if (types.getBlue() > 0) { + netManas.add(new Mana(ColoredManaSymbol.U)); + } + if (types.getGreen() > 0) { + netManas.add(new Mana(ColoredManaSymbol.G)); + } + if (types.getWhite() > 0) { + netManas.add(new Mana(ColoredManaSymbol.W)); + } + if (types.getColorless() > 0) { + netManas.add(Mana.ColorlessMana(1)); + } + if (types.getAny() > 0) { + netManas.add(Mana.AnyMana(1)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana mana = new Mana(); @@ -215,34 +238,6 @@ class BenthicExplorersManaEffect extends ManaEffect { return types; } - @Override - public List getNetMana(Game game, Ability source) { - List netManas = new ArrayList<>(); - Mana types = getManaTypes(game, source); - if (types.getBlack() > 0) { - netManas.add(new Mana(ColoredManaSymbol.B)); - } - if (types.getRed() > 0) { - netManas.add(new Mana(ColoredManaSymbol.R)); - } - if (types.getBlue() > 0) { - netManas.add(new Mana(ColoredManaSymbol.U)); - } - if (types.getGreen() > 0) { - netManas.add(new Mana(ColoredManaSymbol.G)); - } - if (types.getWhite() > 0) { - netManas.add(new Mana(ColoredManaSymbol.W)); - } - if (types.getColorless() > 0) { - netManas.add(Mana.ColorlessMana(1)); - } - if (types.getAny() > 0) { - netManas.add(Mana.AnyMana(1)); - } - return netManas; - } - @Override public BenthicExplorersManaEffect copy() { return new BenthicExplorersManaEffect(this); diff --git a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java index cc0513321c..7ded0c7a72 100644 --- a/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/cards/c/CarpetOfFlowers.java @@ -20,6 +20,8 @@ import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetOpponent; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; /** @@ -85,8 +87,8 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl { boolean value = super.resolve(game); if (value == true) { game.getState().setValue(this.originalId.toString() - + "addMana" - + game.getState().getZoneChangeCounter(sourceId), + + "addMana" + + game.getState().getZoneChangeCounter(sourceId), Boolean.TRUE); } return value; @@ -95,8 +97,8 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl { @Override public void reset(Game game) { game.getState().setValue(this.originalId.toString() - + "addMana" - + game.getState().getZoneChangeCounter(sourceId), + + "addMana" + + game.getState().getZoneChangeCounter(sourceId), Boolean.FALSE); } @@ -127,6 +129,16 @@ class CarpetOfFlowersEffect extends ManaEffect { super(effect); } + @Override + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + int count = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game); + if (count > 0) { + netMana.add(Mana.AnyMana(count)); + } + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/cards/c/CharmedPendant.java b/Mage.Sets/src/mage/cards/c/CharmedPendant.java index af20ff0c11..f406c12560 100644 --- a/Mage.Sets/src/mage/cards/c/CharmedPendant.java +++ b/Mage.Sets/src/mage/cards/c/CharmedPendant.java @@ -1,22 +1,11 @@ - package mage.cards.c; -import java.util.List; -import java.util.Set; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.PutTopCardOfYourLibraryToGraveyardCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.costs.mana.ColoredManaCost; -import mage.abilities.costs.mana.ColorlessManaCost; -import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.costs.mana.ManaCost; -import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.costs.mana.MonoHybridManaCost; -import mage.abilities.costs.mana.VariableManaCost; +import mage.abilities.costs.mana.*; import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; @@ -31,8 +20,11 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.List; +import java.util.Set; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class CharmedPendant extends CardImpl { @@ -107,6 +99,25 @@ class CharmedPendantManaEffect extends ManaEffect { return new CharmedPendantManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + if (controller.isTopCardRevealed()) { + Card card = controller.getLibrary().getFromTop(game); + if (card != null) { + List netMana = card.getManaCost().getManaOptions(); + for (Mana mana : netMana) { + mana.setColorless(0); + mana.setGeneric(0); + } + return netMana; + } + } + } + return null; + } + @Override public Mana produceMana(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); @@ -157,23 +168,4 @@ class CharmedPendantManaEffect extends ManaEffect { return null; } - - @Override - public List getNetMana(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (controller.isTopCardRevealed()) { - Card card = controller.getLibrary().getFromTop(game); - if (card != null) { - List netMana = card.getManaCost().getManaOptions(); - for (Mana mana : netMana) { - mana.setColorless(0); - mana.setGeneric(0); - } - return netMana; - } - } - } - return null; - } } diff --git a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java index 62c2bc55a2..ef507227a2 100644 --- a/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java +++ b/Mage.Sets/src/mage/cards/c/CorruptedGrafstone.java @@ -1,9 +1,5 @@ - package mage.cards.c; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; @@ -22,8 +18,11 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author spjspj */ public final class CorruptedGrafstone extends CardImpl { @@ -89,6 +88,31 @@ class CorruptedGrafstoneManaEffect extends ManaEffect { return new CorruptedGrafstoneManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + List netManas = new ArrayList<>(); + Mana types = getManaTypesInGraveyard(game, source); + if (types == null) { + return null; + } + if (types.getBlack() > 0) { + netManas.add(new Mana(ColoredManaSymbol.B)); + } + if (types.getRed() > 0) { + netManas.add(new Mana(ColoredManaSymbol.R)); + } + if (types.getBlue() > 0) { + netManas.add(new Mana(ColoredManaSymbol.U)); + } + if (types.getGreen() > 0) { + netManas.add(new Mana(ColoredManaSymbol.G)); + } + if (types.getWhite() > 0) { + netManas.add(new Mana(ColoredManaSymbol.W)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana types = getManaTypesInGraveyard(game, source); @@ -144,31 +168,6 @@ class CorruptedGrafstoneManaEffect extends ManaEffect { return null; } - @Override - public List getNetMana(Game game, Ability source) { - List netManas = new ArrayList<>(); - Mana types = getManaTypesInGraveyard(game, source); - if (types == null) { - return null; - } - if (types.getBlack() > 0) { - netManas.add(new Mana(ColoredManaSymbol.B)); - } - if (types.getRed() > 0) { - netManas.add(new Mana(ColoredManaSymbol.R)); - } - if (types.getBlue() > 0) { - netManas.add(new Mana(ColoredManaSymbol.U)); - } - if (types.getGreen() > 0) { - netManas.add(new Mana(ColoredManaSymbol.G)); - } - if (types.getWhite() > 0) { - netManas.add(new Mana(ColoredManaSymbol.W)); - } - return netManas; - } - private Mana getManaTypesInGraveyard(Game game, Ability source) { if (source != null && source.getControllerId() != null) { diff --git a/Mage.Sets/src/mage/cards/d/DawnsReflection.java b/Mage.Sets/src/mage/cards/d/DawnsReflection.java index 3b3cb44781..a36c50cc58 100644 --- a/Mage.Sets/src/mage/cards/d/DawnsReflection.java +++ b/Mage.Sets/src/mage/cards/d/DawnsReflection.java @@ -1,9 +1,5 @@ - package mage.cards.d; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; @@ -12,7 +8,6 @@ import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.choices.ChoiceColor; import mage.choices.ManaChoice; import mage.constants.CardType; import mage.constants.Outcome; @@ -26,8 +21,11 @@ import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author Plopman */ public final class DawnsReflection extends CardImpl { @@ -116,17 +114,16 @@ class DawnsReflectionManaEffect extends ManaEffect { return null; } + @Override + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + netMana.add(Mana.AnyMana(2)); + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { Player player = getPlayer(game, source); return ManaChoice.chooseAnyColor(player, game, 2); } - - @Override - public List getNetMana(Game game, Ability source) { - List netMana = new ArrayList<>(); - netMana.add(new Mana(0, 0, 0, 0, 0, 0, 2, 0)); - return netMana; - } - } diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java index c77f0fd892..ccb47b68a5 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java @@ -49,7 +49,7 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect { @Override public List getNetMana(Game game, Ability source) { - return netMana; + return new ArrayList<>(this.netMana); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java index 2e7f29857a..0f91a11a9f 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfTwoDifferentColorsEffect.java @@ -23,16 +23,16 @@ public class AddManaOfTwoDifferentColorsEffect extends ManaEffect { } @Override - public Mana produceMana(Game game, Ability source) { - Player player = getPlayer(game, source); - return ManaChoice.chooseTwoDifferentColors(player, game); + public List getNetMana(Game game, Ability source) { + ArrayList netMana = new ArrayList<>(); + netMana.add(Mana.AnyMana(2)); + return netMana; } @Override - public List getNetMana(Game game, Ability source) { - ArrayList netMana = new ArrayList<>(); - netMana.add(new Mana(0, 0, 0, 0, 0, 0, 2, 0)); - return netMana; + public Mana produceMana(Game game, Ability source) { + Player player = getPlayer(game, source); + return ManaChoice.chooseTwoDifferentColors(player, game); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java index 4798057e87..4f01d2dc8b 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java @@ -11,10 +11,10 @@ import mage.abilities.effects.common.ManaEffect; import mage.game.Game; import mage.players.Player; +import java.util.ArrayList; import java.util.List; /** - * * @author LevelX2 */ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect { @@ -29,12 +29,11 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect { /** * Adds mana to the mana pool of target pointer player * - * @param mana mana that will be added to the pool + * @param mana mana that will be added to the pool * @param textManaPoolOwner text that references to the mana pool owner - * (e.g. "damaged player's") - * @param emptyOnTurnsEnd if set, the mana will empty only on end of - * turnstep - * + * (e.g. "damaged player's") + * @param emptyOnTurnsEnd if set, the mana will empty only on end of + * turnstep */ public AddManaToManaPoolTargetControllerEffect(Mana mana, String textManaPoolOwner, boolean emptyOnTurnsEnd) { super(); @@ -59,6 +58,13 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect { return game.getPlayer(getTargetPointer().getFirst(game, source)); } + @Override + public List getNetMana(Game game, Ability source) { + ArrayList netMana = new ArrayList<>(); + netMana.add(mana.copy()); + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { return mana.copy(); @@ -68,9 +74,4 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect { protected void addManaToPool(Player player, Mana manaToAdd, Game game, Ability source) { player.getManaPool().addMana(manaToAdd, game, source, emptyOnlyOnTurnsEnd); } - - @Override - public List getNetMana(Game game, Ability source) { - return null; - } } diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java index 057329b0f4..d60a9377c2 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorLandsProduceManaAbility.java @@ -1,4 +1,3 @@ - package mage.abilities.mana; import mage.Mana; @@ -86,6 +85,34 @@ class AnyColorLandsProduceManaEffect extends ManaEffect { this.onlyColors = effect.onlyColors; } + @Override + public List getNetMana(Game game, Ability source) { + List netManas = new ArrayList<>(); + Mana types = getManaTypes(game, source); + if (types.getBlack() > 0) { + netManas.add(new Mana(ColoredManaSymbol.B)); + } + if (types.getRed() > 0) { + netManas.add(new Mana(ColoredManaSymbol.R)); + } + if (types.getBlue() > 0) { + netManas.add(new Mana(ColoredManaSymbol.U)); + } + if (types.getGreen() > 0) { + netManas.add(new Mana(ColoredManaSymbol.G)); + } + if (types.getWhite() > 0) { + netManas.add(new Mana(ColoredManaSymbol.W)); + } + if (!onlyColors && types.getColorless() > 0) { + netManas.add(Mana.ColorlessMana(1)); + } + if (types.getAny() > 0) { + netManas.add(Mana.AnyMana(1)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana mana = new Mana(); @@ -181,34 +208,6 @@ class AnyColorLandsProduceManaEffect extends ManaEffect { return types; } - @Override - public List getNetMana(Game game, Ability source) { - List netManas = new ArrayList<>(); - Mana types = getManaTypes(game, source); - if (types.getBlack() > 0) { - netManas.add(new Mana(ColoredManaSymbol.B)); - } - if (types.getRed() > 0) { - netManas.add(new Mana(ColoredManaSymbol.R)); - } - if (types.getBlue() > 0) { - netManas.add(new Mana(ColoredManaSymbol.U)); - } - if (types.getGreen() > 0) { - netManas.add(new Mana(ColoredManaSymbol.G)); - } - if (types.getWhite() > 0) { - netManas.add(new Mana(ColoredManaSymbol.W)); - } - if (types.getColorless() > 0) { - netManas.add(Mana.ColorlessMana(1)); - } - if (types.getAny() > 0) { - netManas.add(Mana.AnyMana(1)); - } - return netManas; - } - @Override public AnyColorLandsProduceManaEffect copy() { return new AnyColorLandsProduceManaEffect(this); diff --git a/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java b/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java index 093c0736aa..6da2e90e69 100644 --- a/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/AnyColorPermanentTypesManaAbility.java @@ -5,8 +5,6 @@ */ package mage.abilities.mana; -import java.util.ArrayList; -import java.util.List; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; @@ -23,8 +21,10 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.ArrayList; +import java.util.List; + /** - * * @author CountAndromalius */ public class AnyColorPermanentTypesManaAbility extends ActivatedManaAbilityImpl { @@ -80,6 +80,34 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect { this.onlyColors = effect.onlyColors; } + @Override + public List getNetMana(Game game, Ability source) { + List netManas = new ArrayList<>(); + Mana types = getManaTypes(game, source); + if (types.getBlack() > 0) { + netManas.add(new Mana(ColoredManaSymbol.B)); + } + if (types.getRed() > 0) { + netManas.add(new Mana(ColoredManaSymbol.R)); + } + if (types.getBlue() > 0) { + netManas.add(new Mana(ColoredManaSymbol.U)); + } + if (types.getGreen() > 0) { + netManas.add(new Mana(ColoredManaSymbol.G)); + } + if (types.getWhite() > 0) { + netManas.add(new Mana(ColoredManaSymbol.W)); + } + if (!onlyColors && types.getColorless() > 0) { + netManas.add(Mana.ColorlessMana(1)); + } + if (types.getAny() > 0) { + netManas.add(Mana.AnyMana(1)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana mana = new Mana(); @@ -181,34 +209,6 @@ class AnyColorPermanentTypesManaEffect extends ManaEffect { return types; } - @Override - public List getNetMana(Game game, Ability source) { - List netManas = new ArrayList<>(); - Mana types = getManaTypes(game, source); - if (types.getBlack() > 0) { - netManas.add(new Mana(ColoredManaSymbol.B)); - } - if (types.getRed() > 0) { - netManas.add(new Mana(ColoredManaSymbol.R)); - } - if (types.getBlue() > 0) { - netManas.add(new Mana(ColoredManaSymbol.U)); - } - if (types.getGreen() > 0) { - netManas.add(new Mana(ColoredManaSymbol.G)); - } - if (types.getWhite() > 0) { - netManas.add(new Mana(ColoredManaSymbol.W)); - } - if (types.getColorless() > 0) { - netManas.add(Mana.ColorlessMana(1)); - } - if (types.getAny() > 0) { - netManas.add(Mana.AnyMana(1)); - } - return netManas; - } - @Override public AnyColorPermanentTypesManaEffect copy() { return new AnyColorPermanentTypesManaEffect(this); diff --git a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java index e9509a7afd..17c75f4b05 100644 --- a/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/CommanderColorIdentityManaAbility.java @@ -14,7 +14,9 @@ import mage.filter.FilterMana; import mage.game.Game; import mage.players.Player; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; /** * @author LevelX2 @@ -61,6 +63,36 @@ class CommanderIdentityManaEffect extends ManaEffect { return new CommanderIdentityManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + for (UUID commanderId : game.getCommandersIds(controller)) { + Card commander = game.getCard(commanderId); + if (commander != null) { + FilterMana commanderMana = commander.getColorIdentity(); + if (commanderMana.isBlack()) { + netMana.add(new Mana(ColoredManaSymbol.B)); + } + if (commanderMana.isBlue()) { + netMana.add(new Mana(ColoredManaSymbol.U)); + } + if (commanderMana.isGreen()) { + netMana.add(new Mana(ColoredManaSymbol.G)); + } + if (commanderMana.isRed()) { + netMana.add(new Mana(ColoredManaSymbol.R)); + } + if (commanderMana.isWhite()) { + netMana.add(new Mana(ColoredManaSymbol.W)); + } + } + } + } + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { Mana mana = new Mana(); @@ -120,35 +152,4 @@ class CommanderIdentityManaEffect extends ManaEffect { } return mana; } - - @Override - public List getNetMana(Game game, Ability source) { - List netMana = new ArrayList<>(); - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - for (UUID commanderId : game.getCommandersIds(controller)) { - Card commander = game.getCard(commanderId); - if (commander != null) { - FilterMana commanderMana = commander.getColorIdentity(); - if (commanderMana.isBlack()) { - netMana.add(new Mana(ColoredManaSymbol.B)); - } - if (commanderMana.isBlue()) { - netMana.add(new Mana(ColoredManaSymbol.U)); - } - if (commanderMana.isGreen()) { - netMana.add(new Mana(ColoredManaSymbol.G)); - } - if (commanderMana.isRed()) { - netMana.add(new Mana(ColoredManaSymbol.R)); - } - if (commanderMana.isWhite()) { - netMana.add(new Mana(ColoredManaSymbol.W)); - } - } - } - } - return netMana; - } - }