From dceb93e7a690bf33982af7674fd15897cbf05b00 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 3 Jan 2020 06:27:39 +0400 Subject: [PATCH] Additional fixes for getNetMana from #6132 (final) --- .../src/mage/cards/e/EverythingamajigC.java | 1 - .../src/mage/cards/g/GrandArchitect.java | 19 +++--- Mage.Sets/src/mage/cards/k/KyrenToy.java | 33 +++++----- .../mage/cards/m/MadScienceFairProject.java | 22 +++---- Mage.Sets/src/mage/cards/m/ManaScrew.java | 14 +++-- .../src/mage/cards/m/MarketFestival.java | 16 +++-- Mage.Sets/src/mage/cards/m/Metalworker.java | 38 ++++++------ Mage.Sets/src/mage/cards/m/MeteorCrater.java | 53 ++++++++-------- Mage.Sets/src/mage/cards/r/RhysticCave.java | 24 ++++--- .../src/mage/cards/s/SacellumGodspeaker.java | 23 +++---- .../mage/cards/s/SasayaOrochiAscendant.java | 16 ++--- Mage.Sets/src/mage/cards/s/SavageVentmaw.java | 8 +-- .../mage/cards/s/SelvalaExplorerReturned.java | 24 +++---- .../src/mage/cards/s/SpectralSearchlight.java | 21 ++++--- .../src/mage/cards/s/SquanderedResources.java | 62 +++++++++---------- Mage.Sets/src/mage/cards/s/StarCompass.java | 61 +++++++++--------- .../src/mage/cards/v/VedalkenEngineer.java | 5 +- Mage.Sets/src/mage/cards/v/VictoryChimes.java | 6 +- .../mana/AddConditionalManaEffect.java | 4 +- ...dManaToManaPoolSourceControllerEffect.java | 3 +- ...dManaToManaPoolTargetControllerEffect.java | 2 +- .../mana/ConditionalColorlessManaAbility.java | 2 - 22 files changed, 219 insertions(+), 238 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/EverythingamajigC.java b/Mage.Sets/src/mage/cards/e/EverythingamajigC.java index f4908d897f..f46d32454a 100644 --- a/Mage.Sets/src/mage/cards/e/EverythingamajigC.java +++ b/Mage.Sets/src/mage/cards/e/EverythingamajigC.java @@ -61,7 +61,6 @@ class ManaScrewAbility extends ActivatedManaAbilityImpl { public ManaScrewAbility() { super(Zone.BATTLEFIELD, new ManaScrewEffect(), new GenericManaCost(1)); - this.netMana.add(Mana.ColorlessMana(2)); } public ManaScrewAbility(final ManaScrewAbility ability) { diff --git a/Mage.Sets/src/mage/cards/g/GrandArchitect.java b/Mage.Sets/src/mage/cards/g/GrandArchitect.java index 3060d39137..3c9631b869 100644 --- a/Mage.Sets/src/mage/cards/g/GrandArchitect.java +++ b/Mage.Sets/src/mage/cards/g/GrandArchitect.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.*; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -10,8 +8,8 @@ import mage.abilities.condition.Condition; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -27,8 +25,9 @@ import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author BetaSteward_at_googlemail.com, nantuko */ public final class GrandArchitect extends CardImpl { @@ -42,17 +41,22 @@ public final class GrandArchitect extends CardImpl { } public GrandArchitect(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); this.subtype.add(SubType.VEDALKEN); this.subtype.add(SubType.ARTIFICER); this.power = new MageInt(1); this.toughness = new MageInt(3); + // Other blue creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, boostFilter, true))); + + // {U}: Target artifact creature becomes blue until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GrandArchitectEffect(), new ManaCostsImpl("{U}")); ability.addTarget(new TargetPermanent(targetFilter)); this.addAbility(ability); + + // Tap an untapped blue creature you control: Add {C}{C}. Spend this mana only to cast artifact spells or activate abilities of artifacts. this.addAbility(new GrandArchitectManaAbility()); } @@ -137,9 +141,6 @@ class GrandArchitectManaCondition implements Condition { @Override public boolean apply(Game game, Ability source) { MageObject object = game.getObject(source.getSourceId()); - if (object != null && object.isArtifact()) { - return true; - } - return false; + return object != null && object.isArtifact(); } } diff --git a/Mage.Sets/src/mage/cards/k/KyrenToy.java b/Mage.Sets/src/mage/cards/k/KyrenToy.java index 7a09169227..b1e2ebb172 100644 --- a/Mage.Sets/src/mage/cards/k/KyrenToy.java +++ b/Mage.Sets/src/mage/cards/k/KyrenToy.java @@ -1,9 +1,5 @@ - package mage.cards.k; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -23,8 +19,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 KyrenToy extends CardImpl { @@ -79,6 +78,17 @@ public final class KyrenToy extends CardImpl { super(effect); } + @Override + public List getNetMana(Game game, Ability source) { + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (sourceObject != null) { + List netMana = new ArrayList<>(); + netMana.add(Mana.ColorlessMana(sourceObject.getCounters(game).getCount(CounterType.CHARGE) + 1)); + return netMana; + } + return null; + } + @Override public Mana produceMana(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); @@ -89,18 +99,7 @@ public final class KyrenToy extends CardImpl { numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount(); } } - return new Mana(0, 0, 0, 0, 0, 0, 0, numberOfMana + 1); - } - return null; - } - - @Override - public List getNetMana(Game game, Ability source) { - Permanent sourceObject = game.getPermanent(source.getSourceId()); - if (sourceObject != null) { - List netMana = new ArrayList<>(); - netMana.add(new Mana(0, 0, 0, 0, 0, 0, 0, sourceObject.getCounters(game).getCount(CounterType.CHARGE) + 1)); - return netMana; + return new Mana(Mana.ColorlessMana(numberOfMana + 1)); } return null; } diff --git a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java index 871c231ed8..4542cf637a 100644 --- a/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java +++ b/Mage.Sets/src/mage/cards/m/MadScienceFairProject.java @@ -1,8 +1,5 @@ package mage.cards.m; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; @@ -10,18 +7,16 @@ import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.choices.ChoiceColor; import mage.choices.ManaChoice; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Zone; -import mage.counters.CounterType; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.List; +import java.util.UUID; + /** - * * @author spjspj */ public final class MadScienceFairProject extends CardImpl { @@ -59,6 +54,11 @@ class MadScienceFairManaEffect extends ManaEffect { return new MadScienceFairManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + return null; + } + @Override public Mana produceMana(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); @@ -72,10 +72,4 @@ class MadScienceFairManaEffect extends ManaEffect { } return null; } - - @Override - public List getNetMana(Game game, Ability source) { - return null; - } - } diff --git a/Mage.Sets/src/mage/cards/m/ManaScrew.java b/Mage.Sets/src/mage/cards/m/ManaScrew.java index 282bdefc18..31545156de 100644 --- a/Mage.Sets/src/mage/cards/m/ManaScrew.java +++ b/Mage.Sets/src/mage/cards/m/ManaScrew.java @@ -1,7 +1,5 @@ - package mage.cards.m; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.mana.GenericManaCost; @@ -14,8 +12,10 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.List; +import java.util.UUID; + /** - * * @author L_J */ public final class ManaScrew extends CardImpl { @@ -41,7 +41,8 @@ class ManaScrewAbility extends ActivatedManaAbilityImpl { public ManaScrewAbility() { super(Zone.BATTLEFIELD, new ManaScrewEffect(), new GenericManaCost(1)); - this.netMana.add(new Mana(0, 0, 0, 0, 0, 2, 0, 0)); + { + } } public ManaScrewAbility(final ManaScrewAbility ability) { @@ -84,6 +85,11 @@ class ManaScrewEffect extends ManaEffect { return new ManaScrewEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + return null; + } + @Override public Mana produceMana(Game game, Ability source) { Player player = getPlayer(game, source); diff --git a/Mage.Sets/src/mage/cards/m/MarketFestival.java b/Mage.Sets/src/mage/cards/m/MarketFestival.java index df45a64eba..4e0e04f94f 100644 --- a/Mage.Sets/src/mage/cards/m/MarketFestival.java +++ b/Mage.Sets/src/mage/cards/m/MarketFestival.java @@ -1,8 +1,5 @@ - package mage.cards.m; -import java.util.UUID; -import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; @@ -11,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; @@ -25,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 LevelX2 */ public final class MarketFestival extends CardImpl { @@ -112,6 +111,13 @@ class MarketFestivalManaEffect extends ManaEffect { return game.getPlayer(sourceObject.getControllerId()); } + @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 controller = getPlayer(game, source); diff --git a/Mage.Sets/src/mage/cards/m/Metalworker.java b/Mage.Sets/src/mage/cards/m/Metalworker.java index 1996839380..815502872b 100644 --- a/Mage.Sets/src/mage/cards/m/Metalworker.java +++ b/Mage.Sets/src/mage/cards/m/Metalworker.java @@ -1,9 +1,5 @@ - package mage.cards.m; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -18,15 +14,16 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; -import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInHand; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author anonymous */ public final class Metalworker extends CardImpl { @@ -68,6 +65,20 @@ class MetalworkerManaEffect extends ManaEffect { return new MetalworkerManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + Player controller = getPlayer(game, source); + if (controller == null) { + return null; + } + List netMana = new ArrayList<>(); + int artifacts = controller.getHand().count(StaticFilters.FILTER_CARD_ARTIFACT, game); + if (artifacts > 0) { + netMana.add(Mana.ColorlessMana(artifacts * 2)); + } + return netMana; + } + @Override public Mana produceMana(Game game, Ability source) { Player controller = getPlayer(game, source); @@ -85,17 +96,4 @@ class MetalworkerManaEffect extends ManaEffect { } return new Mana(); } - - @Override - public List getNetMana(Game game, Ability source) { - Player controller = getPlayer(game, source); - if (controller == null) { - return null; - } - int artifacts = controller.getHand().count(StaticFilters.FILTER_CARD_ARTIFACT, game); - List netMana = new ArrayList<>(); - netMana.add(Mana.ColorlessMana(artifacts * 2)); - return netMana; - } - } diff --git a/Mage.Sets/src/mage/cards/m/MeteorCrater.java b/Mage.Sets/src/mage/cards/m/MeteorCrater.java index 0a0ca8ed81..184fac9f47 100644 --- a/Mage.Sets/src/mage/cards/m/MeteorCrater.java +++ b/Mage.Sets/src/mage/cards/m/MeteorCrater.java @@ -1,9 +1,5 @@ - package mage.cards.m; -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.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author anonymous */ public final class MeteorCrater extends CardImpl { @@ -63,6 +62,28 @@ class MeteorCraterEffect 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)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana types = getManaTypes(game, source); @@ -124,28 +145,6 @@ class MeteorCraterEffect extends ManaEffect { return null; } - @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)); - } - return netManas; - } - private Mana getManaTypes(Game game, Ability source) { List controlledPermanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); Mana types = new Mana(); diff --git a/Mage.Sets/src/mage/cards/r/RhysticCave.java b/Mage.Sets/src/mage/cards/r/RhysticCave.java index 57347858ca..ddcd3af550 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticCave.java +++ b/Mage.Sets/src/mage/cards/r/RhysticCave.java @@ -1,9 +1,5 @@ - package mage.cards.r; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; @@ -16,15 +12,17 @@ import mage.abilities.effects.mana.DoUnlessAnyPlayerPaysManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.choices.ChoiceColor; import mage.choices.ManaChoice; import mage.constants.CardType; 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 jerekwilson */ public final class RhysticCave extends CardImpl { @@ -95,16 +93,16 @@ class RhysticCaveManaEffect extends ManaEffect { } @Override - public Mana produceMana(Game game, Ability source) { - Player controller = getPlayer(game, source); - return ManaChoice.chooseAnyColor(controller, game, 1); + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + netMana.add(Mana.AnyMana(1)); + return netMana; } @Override - public List getNetMana(Game game, Ability source) { - List netMana = new ArrayList<>(); - netMana.add(new Mana(0, 0, 0, 0, 0, 0, 1, 0)); - return netMana; + public Mana produceMana(Game game, Ability source) { + Player controller = getPlayer(game, source); + return ManaChoice.chooseAnyColor(controller, game, 1); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java b/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java index 24662821bd..2323f31a8a 100644 --- a/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java +++ b/Mage.Sets/src/mage/cards/s/SacellumGodspeaker.java @@ -1,31 +1,24 @@ - package mage.cards.s; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.SimpleManaAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.ComparisonType; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInHand; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** * @author Plopman */ @@ -80,11 +73,15 @@ class SacellumGodspeakerEffect extends ManaEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { List netMana = new ArrayList<>(); - netMana.add(Mana.GreenMana(controller.getHand().count(filter, game))); + int count = controller.getHand().count(filter, game); + if (count > 0) { + netMana.add(Mana.GreenMana(count)); + } return netMana; } return null; } + @Override public Mana produceMana(Game game, Ability source) { TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter); diff --git a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java index 3079091424..7b59af4008 100644 --- a/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java +++ b/Mage.Sets/src/mage/cards/s/SasayaOrochiAscendant.java @@ -1,7 +1,5 @@ package mage.cards.s; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -28,8 +26,10 @@ import mage.game.permanent.Permanent; import mage.game.permanent.token.TokenImpl; import mage.players.Player; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class SasayaOrochiAscendant extends CardImpl { @@ -130,6 +130,11 @@ class SasayasEssenceManaEffect extends ManaEffect { return new SasayasEssenceManaEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + return null; + } + @Override public Mana produceMana(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); @@ -203,9 +208,4 @@ class SasayasEssenceManaEffect extends ManaEffect { } return null; } - - @Override - public List getNetMana(Game game, Ability source) { - return null; - } } diff --git a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java index a47a29dabc..820b99062c 100644 --- a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java +++ b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java @@ -1,7 +1,5 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -14,11 +12,11 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.game.Game; -import mage.players.ManaPool; import mage.players.Player; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class SavageVentmaw extends CardImpl { @@ -59,7 +57,7 @@ class SavageVentmawManaEffect extends ManaEffect { public SavageVentmawManaEffect(final SavageVentmawManaEffect effect) { super(effect); - this.mana = effect.mana; + this.mana = effect.mana.copy(); this.staticText = effect.staticText; } diff --git a/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java b/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java index 7666181b6a..ad1f16c949 100644 --- a/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java +++ b/Mage.Sets/src/mage/cards/s/SelvalaExplorerReturned.java @@ -1,8 +1,5 @@ - package mage.cards.s; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -15,16 +12,14 @@ import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.AbilityWord; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.players.Player; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class SelvalaExplorerReturned extends CardImpl { @@ -72,6 +67,11 @@ class SelvalaExplorerReturnedEffect extends ManaEffect { return new SelvalaExplorerReturnedEffect(this); } + @Override + public List getNetMana(Game game, Ability source) { + return null; + } + @Override public Mana produceMana(Game game, Ability source) { int parleyCount = ParleyCount.getInstance().calculate(game, source, this); @@ -81,10 +81,4 @@ class SelvalaExplorerReturnedEffect extends ManaEffect { } return Mana.GreenMana(parleyCount); } - - @Override - public List getNetMana(Game game, Ability source) { - return null; - } - } diff --git a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java index 3b185b61f8..ea9475b1ca 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java +++ b/Mage.Sets/src/mage/cards/s/SpectralSearchlight.java @@ -1,8 +1,5 @@ - package mage.cards.s; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.common.TapSourceCost; @@ -11,7 +8,6 @@ import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.choices.ChoiceColor; import mage.choices.ManaChoice; import mage.constants.CardType; import mage.constants.Outcome; @@ -19,8 +15,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 Galatolol */ public final class SpectralSearchlight extends CardImpl { @@ -63,14 +62,16 @@ class SpectralSearchlightManaEffect extends ManaEffect { } @Override - public Mana produceMana(Game game, Ability source) { - Player player = getPlayer(game, source); - return ManaChoice.chooseAnyColor(player, game, 1); + public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + netMana.add(Mana.AnyMana(1)); + return netMana; } @Override - public List getNetMana(Game game, Ability source) { - return null; + public Mana produceMana(Game game, Ability source) { + Player player = getPlayer(game, source); + return ManaChoice.chooseAnyColor(player, game, 1); } @Override diff --git a/Mage.Sets/src/mage/cards/s/SquanderedResources.java b/Mage.Sets/src/mage/cards/s/SquanderedResources.java index 13aef9ab7f..ebb86bd2af 100644 --- a/Mage.Sets/src/mage/cards/s/SquanderedResources.java +++ b/Mage.Sets/src/mage/cards/s/SquanderedResources.java @@ -1,9 +1,5 @@ - package mage.cards.s; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; @@ -26,8 +22,11 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetControlledPermanent; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class SquanderedResources extends CardImpl { @@ -62,6 +61,31 @@ class SquanderedResourcesEffect 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.getGeneric() > 0) { + netManas.add(Mana.ColorlessMana(1)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana types = getManaTypes(game, source); @@ -97,7 +121,7 @@ class SquanderedResourcesEffect extends ManaEffect { Mana mana = new Mana(); if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); - if(player == null){ + if (player == null) { return mana; } if (choice.getChoices().size() == 1) { @@ -132,33 +156,7 @@ class SquanderedResourcesEffect extends ManaEffect { return mana; } - @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.getGeneric() > 0) { - netManas.add(Mana.ColorlessMana(1)); - } - return netManas; - } - private Mana getManaTypes(Game game, Ability source) { - Mana types = new Mana(); for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/s/StarCompass.java b/Mage.Sets/src/mage/cards/s/StarCompass.java index 88a07f6505..6fafe1124b 100644 --- a/Mage.Sets/src/mage/cards/s/StarCompass.java +++ b/Mage.Sets/src/mage/cards/s/StarCompass.java @@ -1,9 +1,5 @@ - package mage.cards.s; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.Mana; import mage.abilities.Abilities; import mage.abilities.Ability; @@ -27,8 +23,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 anonymous */ public final class StarCompass extends CardImpl { @@ -69,6 +68,31 @@ class StarCompassManaEffect 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.getGeneric() > 0) { + netManas.add(Mana.ColorlessMana(1)); + } + return netManas; + } + @Override public Mana produceMana(Game game, Ability source) { Mana types = getManaTypes(game, source); @@ -103,7 +127,7 @@ class StarCompassManaEffect extends ManaEffect { } if (!choice.getChoices().isEmpty()) { Player player = game.getPlayer(source.getControllerId()); - if(player == null){ + if (player == null) { return null; } if (choice.getChoices().size() == 1) { @@ -141,31 +165,6 @@ class StarCompassManaEffect extends ManaEffect { return null; } - @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.getGeneric() > 0) { - netManas.add(Mana.ColorlessMana(1)); - } - return netManas; - } - private Mana getManaTypes(Game game, Ability source) { List lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); Mana types = new Mana(); diff --git a/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java b/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java index b8d99e0c32..23307004c1 100644 --- a/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java +++ b/Mage.Sets/src/mage/cards/v/VedalkenEngineer.java @@ -85,13 +85,11 @@ class VedalkenEngineerEffect extends ManaEffect { private final int amount; private final ConditionalManaBuilder manaBuilder; - protected final ArrayList netMana = new ArrayList<>(); public VedalkenEngineerEffect(int amount, ConditionalManaBuilder manaBuilder) { super(); this.amount = amount; this.manaBuilder = manaBuilder; - netMana.add(Mana.AnyMana(amount)); staticText = "Add " + amount + " mana of any one color. " + manaBuilder.getRule(); } @@ -99,7 +97,6 @@ class VedalkenEngineerEffect extends ManaEffect { super(effect); this.amount = effect.amount; this.manaBuilder = effect.manaBuilder; - this.netMana.addAll(effect.netMana); } @Override @@ -109,6 +106,8 @@ class VedalkenEngineerEffect extends ManaEffect { @Override public List getNetMana(Game game, Ability source) { + List netMana = new ArrayList<>(); + Mana.AnyMana(amount); return netMana; } diff --git a/Mage.Sets/src/mage/cards/v/VictoryChimes.java b/Mage.Sets/src/mage/cards/v/VictoryChimes.java index a9353239d2..e46c1a7676 100644 --- a/Mage.Sets/src/mage/cards/v/VictoryChimes.java +++ b/Mage.Sets/src/mage/cards/v/VictoryChimes.java @@ -1,7 +1,5 @@ - package mage.cards.v; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -18,8 +16,9 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class VictoryChimes extends CardImpl { @@ -29,6 +28,7 @@ public final class VictoryChimes extends CardImpl { // Untap Victory Chimes during each other player's untap step. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UntapSourceDuringEachOtherPlayersUntapStepEffect())); + // {T}: A player of your choice adds {C}. ManaEffect effect = new VictoryChimesManaEffect("chosen player"); effect.setText("a player of your choice adds {C}"); diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java index a489ec5440..f8abc56bfe 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddConditionalManaEffect.java @@ -10,10 +10,8 @@ import mage.abilities.Ability; import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.game.Game; -import mage.players.Player; /** - * * @author LevelX2 */ public class AddConditionalManaEffect extends ManaEffect { @@ -30,7 +28,7 @@ public class AddConditionalManaEffect extends ManaEffect { public AddConditionalManaEffect(final AddConditionalManaEffect effect) { super(effect); - this.mana = effect.mana; + this.mana = effect.mana.copy(); this.manaBuilder = effect.manaBuilder; } diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolSourceControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolSourceControllerEffect.java index a2d8eabde4..455df4f3ce 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolSourceControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolSourceControllerEffect.java @@ -14,7 +14,6 @@ import mage.game.Game; import mage.players.Player; /** - * * @author magenoxx */ public class AddManaToManaPoolSourceControllerEffect extends OneShotEffect { @@ -29,7 +28,7 @@ public class AddManaToManaPoolSourceControllerEffect extends OneShotEffect { public AddManaToManaPoolSourceControllerEffect(final AddManaToManaPoolSourceControllerEffect effect) { super(effect); - this.mana = effect.mana; + this.mana = effect.mana.copy(); } @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 4f01d2dc8b..4a842cf0d9 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaToManaPoolTargetControllerEffect.java @@ -44,7 +44,7 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect { public AddManaToManaPoolTargetControllerEffect(final AddManaToManaPoolTargetControllerEffect effect) { super(effect); - this.mana = effect.mana; + this.mana = effect.mana.copy(); this.emptyOnlyOnTurnsEnd = effect.emptyOnlyOnTurnsEnd; } diff --git a/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java b/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java index 09f903b075..937c8d38d4 100644 --- a/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java +++ b/Mage/src/main/java/mage/abilities/mana/ConditionalColorlessManaAbility.java @@ -12,7 +12,6 @@ import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.constants.Zone; /** - * * @author LevelX2 */ public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl { @@ -23,7 +22,6 @@ public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl { public ConditionalColorlessManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) { super(Zone.BATTLEFIELD, new AddConditionalColorlessManaEffect(amount, manaBuilder), cost); - // this.netMana.add(Mana.ColorlessMana(amount)); // When produced during runtime, condition is added (how to add condition here?) } public ConditionalColorlessManaAbility(final ConditionalColorlessManaAbility ability) {