Additional fixes for getNetMana from #6132 (final)

This commit is contained in:
Oleg Agafonov 2020-01-03 06:27:39 +04:00
parent 579a37c7c8
commit dceb93e7a6
22 changed files with 219 additions and 238 deletions

View file

@ -61,7 +61,6 @@ class ManaScrewAbility extends ActivatedManaAbilityImpl {
public ManaScrewAbility() { public ManaScrewAbility() {
super(Zone.BATTLEFIELD, new ManaScrewEffect(), new GenericManaCost(1)); super(Zone.BATTLEFIELD, new ManaScrewEffect(), new GenericManaCost(1));
this.netMana.add(Mana.ColorlessMana(2));
} }
public ManaScrewAbility(final ManaScrewAbility ability) { public ManaScrewAbility(final ManaScrewAbility ability) {

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.*; import mage.*;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -10,8 +8,8 @@ import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -27,8 +25,9 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com, nantuko * @author BetaSteward_at_googlemail.com, nantuko
*/ */
public final class GrandArchitect extends CardImpl { public final class GrandArchitect extends CardImpl {
@ -42,17 +41,22 @@ public final class GrandArchitect extends CardImpl {
} }
public GrandArchitect(UUID ownerId, CardSetInfo setInfo) { 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.VEDALKEN);
this.subtype.add(SubType.ARTIFICER); this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(3); 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))); 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 ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GrandArchitectEffect(), new ManaCostsImpl("{U}"));
ability.addTarget(new TargetPermanent(targetFilter)); ability.addTarget(new TargetPermanent(targetFilter));
this.addAbility(ability); 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()); this.addAbility(new GrandArchitectManaAbility());
} }
@ -137,9 +141,6 @@ class GrandArchitectManaCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId()); MageObject object = game.getObject(source.getSourceId());
if (object != null && object.isArtifact()) { return object != null && object.isArtifact();
return true;
}
return false;
} }
} }

View file

@ -1,9 +1,5 @@
package mage.cards.k; package mage.cards.k;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -23,8 +19,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class KyrenToy extends CardImpl { public final class KyrenToy extends CardImpl {
@ -79,6 +78,17 @@ public final class KyrenToy extends CardImpl {
super(effect); super(effect);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null) {
List<Mana> netMana = new ArrayList<>();
netMana.add(Mana.ColorlessMana(sourceObject.getCounters(game).getCount(CounterType.CHARGE) + 1));
return netMana;
}
return null;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
@ -89,18 +99,7 @@ public final class KyrenToy extends CardImpl {
numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount(); numberOfMana = ((RemoveVariableCountersSourceCost) cost).getAmount();
} }
} }
return new Mana(0, 0, 0, 0, 0, 0, 0, numberOfMana + 1); return new Mana(Mana.ColorlessMana(numberOfMana + 1));
}
return null;
}
@Override
public List<Mana> getNetMana(Game game, Ability source) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null) {
List<Mana> netMana = new ArrayList<>();
netMana.add(new Mana(0, 0, 0, 0, 0, 0, 0, sourceObject.getCounters(game).getCount(CounterType.CHARGE) + 1));
return netMana;
} }
return null; return null;
} }

View file

@ -1,8 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -10,18 +7,16 @@ import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.choices.ManaChoice; import mage.choices.ManaChoice;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author spjspj * @author spjspj
*/ */
public final class MadScienceFairProject extends CardImpl { public final class MadScienceFairProject extends CardImpl {
@ -59,6 +54,11 @@ class MadScienceFairManaEffect extends ManaEffect {
return new MadScienceFairManaEffect(this); return new MadScienceFairManaEffect(this);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
@ -72,10 +72,4 @@ class MadScienceFairManaEffect extends ManaEffect {
} }
return null; return null;
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
} }

View file

@ -1,7 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
@ -14,8 +12,10 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author L_J * @author L_J
*/ */
public final class ManaScrew extends CardImpl { public final class ManaScrew extends CardImpl {
@ -41,7 +41,8 @@ class ManaScrewAbility extends ActivatedManaAbilityImpl {
public ManaScrewAbility() { public ManaScrewAbility() {
super(Zone.BATTLEFIELD, new ManaScrewEffect(), new GenericManaCost(1)); 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) { public ManaScrewAbility(final ManaScrewAbility ability) {
@ -84,6 +85,11 @@ class ManaScrewEffect extends ManaEffect {
return new ManaScrewEffect(this); return new ManaScrewEffect(this);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player player = getPlayer(game, source); Player player = getPlayer(game, source);

View file

@ -1,8 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.MageObject;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
@ -11,7 +8,6 @@ import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.TriggeredManaAbility; import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.choices.ManaChoice; import mage.choices.ManaChoice;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -25,8 +21,11 @@ import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class MarketFestival extends CardImpl { public final class MarketFestival extends CardImpl {
@ -112,6 +111,13 @@ class MarketFestivalManaEffect extends ManaEffect {
return game.getPlayer(sourceObject.getControllerId()); return game.getPlayer(sourceObject.getControllerId());
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> netMana = new ArrayList<>();
netMana.add(Mana.AnyMana(2));
return netMana;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player controller = getPlayer(game, source); Player controller = getPlayer(game, source);

View file

@ -1,9 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -18,15 +14,16 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author anonymous * @author anonymous
*/ */
public final class Metalworker extends CardImpl { public final class Metalworker extends CardImpl {
@ -68,6 +65,20 @@ class MetalworkerManaEffect extends ManaEffect {
return new MetalworkerManaEffect(this); return new MetalworkerManaEffect(this);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
Player controller = getPlayer(game, source);
if (controller == null) {
return null;
}
List<Mana> 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 @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player controller = getPlayer(game, source); Player controller = getPlayer(game, source);
@ -85,17 +96,4 @@ class MetalworkerManaEffect extends ManaEffect {
} }
return new Mana(); return new Mana();
} }
@Override
public List<Mana> 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<Mana> netMana = new ArrayList<>();
netMana.add(Mana.ColorlessMana(artifacts * 2));
return netMana;
}
} }

View file

@ -1,9 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -22,8 +18,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author anonymous * @author anonymous
*/ */
public final class MeteorCrater extends CardImpl { public final class MeteorCrater extends CardImpl {
@ -63,6 +62,28 @@ class MeteorCraterEffect extends ManaEffect {
super(effect); super(effect);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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 @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Mana types = getManaTypes(game, source); Mana types = getManaTypes(game, source);
@ -124,28 +145,6 @@ class MeteorCraterEffect extends ManaEffect {
return null; return null;
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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) { private Mana getManaTypes(Game game, Ability source) {
List<Permanent> controlledPermanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); List<Permanent> controlledPermanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
Mana types = new Mana(); Mana types = new Mana();

View file

@ -1,9 +1,5 @@
package mage.cards.r; package mage.cards.r;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
@ -16,15 +12,17 @@ import mage.abilities.effects.mana.DoUnlessAnyPlayerPaysManaEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.choices.ManaChoice; import mage.choices.ManaChoice;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author jerekwilson * @author jerekwilson
*/ */
public final class RhysticCave extends CardImpl { public final class RhysticCave extends CardImpl {
@ -95,16 +93,16 @@ class RhysticCaveManaEffect extends ManaEffect {
} }
@Override @Override
public Mana produceMana(Game game, Ability source) { public List<Mana> getNetMana(Game game, Ability source) {
Player controller = getPlayer(game, source); List<Mana> netMana = new ArrayList<>();
return ManaChoice.chooseAnyColor(controller, game, 1); netMana.add(Mana.AnyMana(1));
return netMana;
} }
@Override @Override
public List<Mana> getNetMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
List<Mana> netMana = new ArrayList<>(); Player controller = getPlayer(game, source);
netMana.add(new Mana(0, 0, 0, 0, 0, 0, 1, 0)); return ManaChoice.chooseAnyColor(controller, game, 1);
return netMana;
} }
@Override @Override

View file

@ -1,31 +1,24 @@
package mage.cards.s; package mage.cards.s;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* @author Plopman * @author Plopman
*/ */
@ -80,11 +73,15 @@ class SacellumGodspeakerEffect extends ManaEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
List<Mana> netMana = new ArrayList<>(); List<Mana> 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 netMana;
} }
return null; return null;
} }
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter); TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter);

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -28,8 +26,10 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.TokenImpl;
import mage.players.Player; import mage.players.Player;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class SasayaOrochiAscendant extends CardImpl { public final class SasayaOrochiAscendant extends CardImpl {
@ -130,6 +130,11 @@ class SasayasEssenceManaEffect extends ManaEffect {
return new SasayasEssenceManaEffect(this); return new SasayasEssenceManaEffect(this);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
@ -203,9 +208,4 @@ class SasayasEssenceManaEffect extends ManaEffect {
} }
return null; return null;
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
} }

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -14,11 +12,11 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.players.ManaPool;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class SavageVentmaw extends CardImpl { public final class SavageVentmaw extends CardImpl {
@ -59,7 +57,7 @@ class SavageVentmawManaEffect extends ManaEffect {
public SavageVentmawManaEffect(final SavageVentmawManaEffect effect) { public SavageVentmawManaEffect(final SavageVentmawManaEffect effect) {
super(effect); super(effect);
this.mana = effect.mana; this.mana = effect.mana.copy();
this.staticText = effect.staticText; this.staticText = effect.staticText;
} }

View file

@ -1,8 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.List;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -15,16 +12,14 @@ import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.AbilityWord; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class SelvalaExplorerReturned extends CardImpl { public final class SelvalaExplorerReturned extends CardImpl {
@ -72,6 +67,11 @@ class SelvalaExplorerReturnedEffect extends ManaEffect {
return new SelvalaExplorerReturnedEffect(this); return new SelvalaExplorerReturnedEffect(this);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
@Override @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
int parleyCount = ParleyCount.getInstance().calculate(game, source, this); int parleyCount = ParleyCount.getInstance().calculate(game, source, this);
@ -81,10 +81,4 @@ class SelvalaExplorerReturnedEffect extends ManaEffect {
} }
return Mana.GreenMana(parleyCount); return Mana.GreenMana(parleyCount);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
return null;
}
} }

View file

@ -1,8 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -11,7 +8,6 @@ import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.choices.ManaChoice; import mage.choices.ManaChoice;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -19,8 +15,11 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author Galatolol * @author Galatolol
*/ */
public final class SpectralSearchlight extends CardImpl { public final class SpectralSearchlight extends CardImpl {
@ -63,14 +62,16 @@ class SpectralSearchlightManaEffect extends ManaEffect {
} }
@Override @Override
public Mana produceMana(Game game, Ability source) { public List<Mana> getNetMana(Game game, Ability source) {
Player player = getPlayer(game, source); List<Mana> netMana = new ArrayList<>();
return ManaChoice.chooseAnyColor(player, game, 1); netMana.add(Mana.AnyMana(1));
return netMana;
} }
@Override @Override
public List<Mana> getNetMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
return null; Player player = getPlayer(game, source);
return ManaChoice.chooseAnyColor(player, game, 1);
} }
@Override @Override

View file

@ -1,9 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -26,8 +22,11 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetControlledPermanent; 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) * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/ */
public final class SquanderedResources extends CardImpl { public final class SquanderedResources extends CardImpl {
@ -62,6 +61,31 @@ class SquanderedResourcesEffect extends ManaEffect {
super(effect); super(effect);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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 @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Mana types = getManaTypes(game, source); Mana types = getManaTypes(game, source);
@ -97,7 +121,7 @@ class SquanderedResourcesEffect extends ManaEffect {
Mana mana = new Mana(); Mana mana = new Mana();
if (!choice.getChoices().isEmpty()) { if (!choice.getChoices().isEmpty()) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if(player == null){ if (player == null) {
return mana; return mana;
} }
if (choice.getChoices().size() == 1) { if (choice.getChoices().size() == 1) {
@ -132,33 +156,7 @@ class SquanderedResourcesEffect extends ManaEffect {
return mana; return mana;
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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) { private Mana getManaTypes(Game game, Ability source) {
Mana types = new Mana(); Mana types = new Mana();
for (Cost cost : source.getCosts()) { for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {

View file

@ -1,9 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -27,8 +23,11 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author anonymous * @author anonymous
*/ */
public final class StarCompass extends CardImpl { public final class StarCompass extends CardImpl {
@ -69,6 +68,31 @@ class StarCompassManaEffect extends ManaEffect {
super(effect); super(effect);
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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 @Override
public Mana produceMana(Game game, Ability source) { public Mana produceMana(Game game, Ability source) {
Mana types = getManaTypes(game, source); Mana types = getManaTypes(game, source);
@ -103,7 +127,7 @@ class StarCompassManaEffect extends ManaEffect {
} }
if (!choice.getChoices().isEmpty()) { if (!choice.getChoices().isEmpty()) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if(player == null){ if (player == null) {
return null; return null;
} }
if (choice.getChoices().size() == 1) { if (choice.getChoices().size() == 1) {
@ -141,31 +165,6 @@ class StarCompassManaEffect extends ManaEffect {
return null; return null;
} }
@Override
public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> 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) { private Mana getManaTypes(Game game, Ability source) {
List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
Mana types = new Mana(); Mana types = new Mana();

View file

@ -85,13 +85,11 @@ class VedalkenEngineerEffect extends ManaEffect {
private final int amount; private final int amount;
private final ConditionalManaBuilder manaBuilder; private final ConditionalManaBuilder manaBuilder;
protected final ArrayList<Mana> netMana = new ArrayList<>();
public VedalkenEngineerEffect(int amount, ConditionalManaBuilder manaBuilder) { public VedalkenEngineerEffect(int amount, ConditionalManaBuilder manaBuilder) {
super(); super();
this.amount = amount; this.amount = amount;
this.manaBuilder = manaBuilder; this.manaBuilder = manaBuilder;
netMana.add(Mana.AnyMana(amount));
staticText = "Add " + amount + " mana of any one color. " + manaBuilder.getRule(); staticText = "Add " + amount + " mana of any one color. " + manaBuilder.getRule();
} }
@ -99,7 +97,6 @@ class VedalkenEngineerEffect extends ManaEffect {
super(effect); super(effect);
this.amount = effect.amount; this.amount = effect.amount;
this.manaBuilder = effect.manaBuilder; this.manaBuilder = effect.manaBuilder;
this.netMana.addAll(effect.netMana);
} }
@Override @Override
@ -109,6 +106,8 @@ class VedalkenEngineerEffect extends ManaEffect {
@Override @Override
public List<Mana> getNetMana(Game game, Ability source) { public List<Mana> getNetMana(Game game, Ability source) {
List<Mana> netMana = new ArrayList<>();
Mana.AnyMana(amount);
return netMana; return netMana;
} }

View file

@ -1,7 +1,5 @@
package mage.cards.v; package mage.cards.v;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -18,8 +16,9 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class VictoryChimes extends CardImpl { 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. // Untap Victory Chimes during each other player's untap step.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UntapSourceDuringEachOtherPlayersUntapStepEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UntapSourceDuringEachOtherPlayersUntapStepEffect()));
// {T}: A player of your choice adds {C}. // {T}: A player of your choice adds {C}.
ManaEffect effect = new VictoryChimesManaEffect("chosen player"); ManaEffect effect = new VictoryChimesManaEffect("chosen player");
effect.setText("a player of your choice adds {C}"); effect.setText("a player of your choice adds {C}");

View file

@ -10,10 +10,8 @@ import mage.abilities.Ability;
import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.game.Game; import mage.game.Game;
import mage.players.Player;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class AddConditionalManaEffect extends ManaEffect { public class AddConditionalManaEffect extends ManaEffect {
@ -30,7 +28,7 @@ public class AddConditionalManaEffect extends ManaEffect {
public AddConditionalManaEffect(final AddConditionalManaEffect effect) { public AddConditionalManaEffect(final AddConditionalManaEffect effect) {
super(effect); super(effect);
this.mana = effect.mana; this.mana = effect.mana.copy();
this.manaBuilder = effect.manaBuilder; this.manaBuilder = effect.manaBuilder;
} }

View file

@ -14,7 +14,6 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
/** /**
*
* @author magenoxx * @author magenoxx
*/ */
public class AddManaToManaPoolSourceControllerEffect extends OneShotEffect { public class AddManaToManaPoolSourceControllerEffect extends OneShotEffect {
@ -29,7 +28,7 @@ public class AddManaToManaPoolSourceControllerEffect extends OneShotEffect {
public AddManaToManaPoolSourceControllerEffect(final AddManaToManaPoolSourceControllerEffect effect) { public AddManaToManaPoolSourceControllerEffect(final AddManaToManaPoolSourceControllerEffect effect) {
super(effect); super(effect);
this.mana = effect.mana; this.mana = effect.mana.copy();
} }
@Override @Override

View file

@ -44,7 +44,7 @@ public class AddManaToManaPoolTargetControllerEffect extends ManaEffect {
public AddManaToManaPoolTargetControllerEffect(final AddManaToManaPoolTargetControllerEffect effect) { public AddManaToManaPoolTargetControllerEffect(final AddManaToManaPoolTargetControllerEffect effect) {
super(effect); super(effect);
this.mana = effect.mana; this.mana = effect.mana.copy();
this.emptyOnlyOnTurnsEnd = effect.emptyOnlyOnTurnsEnd; this.emptyOnlyOnTurnsEnd = effect.emptyOnlyOnTurnsEnd;
} }

View file

@ -12,7 +12,6 @@ import mage.abilities.mana.builder.ConditionalManaBuilder;
import mage.constants.Zone; import mage.constants.Zone;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl { public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl {
@ -23,7 +22,6 @@ public class ConditionalColorlessManaAbility extends ActivatedManaAbilityImpl {
public ConditionalColorlessManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) { public ConditionalColorlessManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder) {
super(Zone.BATTLEFIELD, new AddConditionalColorlessManaEffect(amount, manaBuilder), cost); 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) { public ConditionalColorlessManaAbility(final ConditionalColorlessManaAbility ability) {