Improved DevotionCount DynamicValue to support a list of mana types.

This commit is contained in:
LevelX2 2014-01-14 17:03:05 +01:00
parent 1c5f0c8b7f
commit caa32f6eb6
18 changed files with 67 additions and 63 deletions

View file

@ -39,7 +39,7 @@ import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -63,7 +63,7 @@ public class AbhorrentOverlord extends CardImpl<AbhorrentOverlord> {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Abhorrent Overlord enters the battlefield, put a number of 1/1 black Harpy creature tokens with flying onto the battlefield equal to your devotion to black. // When Abhorrent Overlord enters the battlefield, put a number of 1/1 black Harpy creature tokens with flying onto the battlefield equal to your devotion to black.
Effect effect = new CreateTokenEffect(new AbhorrentOverlordHarpyToken(), new DevotionCount(ManaType.BLACK)); Effect effect = new CreateTokenEffect(new AbhorrentOverlordHarpyToken(), new DevotionCount(ColoredManaSymbol.B));
effect.setText("put a number of 1/1 black Harpy creature tokens with flying onto the battlefield equal to your devotion to black. <i>(Each {B} in the mana costs of permanents you control counts toward your devotion to black.)</i>"); effect.setText("put a number of 1/1 black Harpy creature tokens with flying onto the battlefield equal to your devotion to black. <i>(Each {B} in the mana costs of permanents you control counts toward your devotion to black.)</i>");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect)); this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// At the beginning of your upkeep, sacrifice a creature. // At the beginning of your upkeep, sacrifice a creature.

View file

@ -39,7 +39,7 @@ import mage.cards.CardImpl;
import mage.cards.Cards; import mage.cards.Cards;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
@ -102,7 +102,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect<DiscipleOfPhenaxEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int devotion = new DevotionCount(ManaType.BLACK).calculate(game, source); int devotion = new DevotionCount(ColoredManaSymbol.B).calculate(game, source);
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (devotion > 0 && targetPlayer != null) { if (devotion > 0 && targetPlayer != null) {
Cards revealedCards = new CardsImpl(Zone.PICK); Cards revealedCards = new CardsImpl(Zone.PICK);

View file

@ -42,9 +42,9 @@ import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Layer; import mage.constants.Layer;
import mage.constants.ManaType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.SubLayer; import mage.constants.SubLayer;
@ -71,7 +71,7 @@ public class ErebosGodOfTheDead extends CardImpl<ErebosGodOfTheDead> {
// Indestructible // Indestructible
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to black is less than five, Erebos isn't a creature. // As long as your devotion to black is less than five, Erebos isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ManaType.BLACK), 5); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.B), 5);
effect.setText("As long as your devotion to black is less than five, Erebos isn't a creature.<i>(Each {B} in the mana costs of permanents you control counts towards your devotion to black.)</i>"); effect.setText("As long as your devotion to black is less than five, Erebos isn't a creature.<i>(Each {B} in the mana costs of permanents you control counts towards your devotion to black.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -35,7 +35,7 @@ import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
@ -56,7 +56,7 @@ public class EvangelOfHeliod extends CardImpl<EvangelOfHeliod> {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// When Evangel of Heliod enters the battlefield, put a number of 1/1 white Soldier creature tokens onto the battlefield equal to your devotion to white. // When Evangel of Heliod enters the battlefield, put a number of 1/1 white Soldier creature tokens onto the battlefield equal to your devotion to white.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new EvangelOfHeliodSoldierToken(), new DevotionCount(ManaType.WHITE)))); this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new EvangelOfHeliodSoldierToken(), new DevotionCount(ColoredManaSymbol.W))));
} }
public EvangelOfHeliod(final EvangelOfHeliod card) { public EvangelOfHeliod(final EvangelOfHeliod card) {

View file

@ -35,7 +35,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamagePlayersEffect; import mage.abilities.effects.common.DamagePlayersEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
@ -57,7 +57,7 @@ public class FanaticOfMogis extends CardImpl<FanaticOfMogis> {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// When Fanatic of Mogis enters the battlefield, it deals damage to each opponent equal to your devotion to red. // When Fanatic of Mogis enters the battlefield, it deals damage to each opponent equal to your devotion to red.
Effect effect = new DamagePlayersEffect(Outcome.Damage, new DevotionCount(ManaType.RED), TargetController.OPPONENT); Effect effect = new DamagePlayersEffect(Outcome.Damage, new DevotionCount(ColoredManaSymbol.R), TargetController.OPPONENT);
effect.setText("it deals damage to each opponent equal to your devotion to red. (Each {R} in the mana costs of permanents you control counts towards your devotion to red.)"); effect.setText("it deals damage to each opponent equal to your devotion to red. (Each {R} in the mana costs of permanents you control counts towards your devotion to red.)");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, false)); this.addAbility(new EntersBattlefieldTriggeredAbility(effect, false));
} }

View file

@ -35,7 +35,7 @@ import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game; import mage.game.Game;
@ -91,7 +91,7 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect<GrayMerchantOfAsphodelE
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
int lifeLost = 0; int lifeLost = 0;
int damage = new DevotionCount(ManaType.BLACK).calculate(game, source); int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source);
if (damage > 0) { if (damage > 0) {
for (UUID playerId : game.getOpponents(source.getControllerId())) { for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId); Player opponent = game.getPlayer(playerId);

View file

@ -41,8 +41,8 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -68,7 +68,7 @@ public class HeliodGodOfTheSun extends CardImpl<HeliodGodOfTheSun> {
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to white is less than five, Heliod isn't a creature.<i>(Each {W} in the mana costs of permanents you control counts towards your devotion to white.)</i> // As long as your devotion to white is less than five, Heliod isn't a creature.<i>(Each {W} in the mana costs of permanents you control counts towards your devotion to white.)</i>
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ManaType.WHITE), 5); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.W), 5);
effect.setText("As long as your devotion to white is less than five, Heliod isn't a creature.<i>(Each {W} in the mana costs of permanents you control counts towards your devotion to white.)</i>"); effect.setText("As long as your devotion to white is less than five, Heliod isn't a creature.<i>(Each {W} in the mana costs of permanents you control counts towards your devotion to white.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -34,7 +34,7 @@ import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.mana.DynamicManaAbility; import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
/** /**
@ -54,7 +54,7 @@ public class KarametrasAcolyte extends CardImpl<KarametrasAcolyte> {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// {T}: Add an amount of {G} to your mana pool equal to your devotion to green. // {T}: Add an amount of {G} to your mana pool equal to your devotion to green.
this.addAbility(new DynamicManaAbility(Mana.GreenMana, new DevotionCount(ManaType.GREEN), this.addAbility(new DynamicManaAbility(Mana.GreenMana, new DevotionCount(ColoredManaSymbol.G),
"Add an amount of {G} to your mana pool equal to your devotion to green. (Each {G} in the mana costs of permanents you control counts towards your devotion to green.)")); "Add an amount of {G} to your mana pool equal to your devotion to green. (Each {G} in the mana costs of permanents you control counts towards your devotion to green.)"));
} }

View file

@ -39,8 +39,8 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.ProtectionAbility; import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
@ -78,7 +78,7 @@ public class MasterOfWaves extends CardImpl<MasterOfWaves> {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterBoost, false))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterBoost, false)));
// When Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. // When Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue.
// <i>(Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)</i> // <i>(Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)</i>
Effect effect = new CreateTokenEffect(new MasterOfWavesElementalToken(), new DevotionCount(ManaType.BLUE)); Effect effect = new CreateTokenEffect(new MasterOfWavesElementalToken(), new DevotionCount(ColoredManaSymbol.U));
effect.setText("put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. <i>(Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)</i>"); effect.setText("put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. <i>(Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)</i>");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect)); this.addAbility(new EntersBattlefieldTriggeredAbility(effect));

View file

@ -37,8 +37,8 @@ import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.IntimidateAbility; import mage.abilities.keyword.IntimidateAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.Game; import mage.game.Game;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -73,7 +73,7 @@ public class MogissMarauder extends CardImpl<MogissMarauder> {
public void adjustTargets(Ability ability, Game game) { public void adjustTargets(Ability ability, Game game) {
if (ability instanceof EntersBattlefieldTriggeredAbility) { if (ability instanceof EntersBattlefieldTriggeredAbility) {
ability.getTargets().clear(); ability.getTargets().clear();
int numbTargets = new DevotionCount(ManaType.BLACK).calculate(game, ability); int numbTargets = new DevotionCount(ColoredManaSymbol.B).calculate(game, ability);
if (numbTargets > 0) { if (numbTargets > 0) {
ability.addTarget(new TargetCreaturePermanent(0,numbTargets)); ability.addTarget(new TargetCreaturePermanent(0,numbTargets));
} }

View file

@ -40,7 +40,7 @@ import mage.cards.CardImpl;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceColor; import mage.choices.ChoiceColor;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
@ -104,7 +104,7 @@ class NykthosShrineToNyxManaAbility extends ManaAbility<NykthosShrineToNyxManaAb
class NykthosDynamicManaEffect extends ManaEffect { class NykthosDynamicManaEffect extends ManaEffect {
private Mana computedMana; private final Mana computedMana;
public NykthosDynamicManaEffect() { public NykthosDynamicManaEffect() {
super(); super();
@ -132,19 +132,19 @@ class NykthosDynamicManaEffect extends ManaEffect {
public Mana computeMana(Game game, Ability source){ public Mana computeMana(Game game, Ability source){
this.computedMana.clear(); this.computedMana.clear();
if (!source.getChoices().isEmpty()) { if (!source.getChoices().isEmpty()) {
Choice choice = source.getChoices().get(0); ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
if (choice != null && choice instanceof ChoiceColor && choice.getChoice() != null) { if (choice != null && choice instanceof ChoiceColor && choice.getChoice() != null) {
String color = choice.getChoice(); String color = choice.getChoice();
if (color.equals("Red")) { if (color.equals("Red")) {
computedMana.setRed(new DevotionCount(ManaType.RED).calculate(game, source)); computedMana.setRed(new DevotionCount(ColoredManaSymbol.R).calculate(game, source));
} else if (color.equals("Blue")) { } else if (color.equals("Blue")) {
computedMana.setBlue(new DevotionCount(ManaType.BLUE).calculate(game, source)); computedMana.setBlue(new DevotionCount(ColoredManaSymbol.U).calculate(game, source));
} else if (color.equals("White")) { } else if (color.equals("White")) {
computedMana.setWhite(new DevotionCount(ManaType.WHITE).calculate(game, source)); computedMana.setWhite(new DevotionCount(ColoredManaSymbol.W).calculate(game, source));
} else if (color.equals("Black")) { } else if (color.equals("Black")) {
computedMana.setBlack(new DevotionCount(ManaType.BLACK).calculate(game, source)); computedMana.setBlack(new DevotionCount(ColoredManaSymbol.B).calculate(game, source));
} else if (color.equals("Green")) { } else if (color.equals("Green")) {
computedMana.setGreen(new DevotionCount(ManaType.GREEN).calculate(game, source)); computedMana.setGreen(new DevotionCount(ColoredManaSymbol.G).calculate(game, source));
} }
} }
} }

View file

@ -42,8 +42,8 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
@ -68,7 +68,7 @@ public class NyleaGodOfTheHunt extends CardImpl<NyleaGodOfTheHunt> {
// Indestructible // Indestructible
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to white is less than five, Nylea isn't a creature.<i>(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)</i> // As long as your devotion to white is less than five, Nylea isn't a creature.<i>(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)</i>
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ManaType.GREEN), 5); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.G), 5);
effect.setText("As long as your devotion to green is less than five, Nylea isn't a creature.<i>(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)</i>"); effect.setText("As long as your devotion to green is less than five, Nylea isn't a creature.<i>(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// Other creatures you control have trample. // Other creatures you control have trample.

View file

@ -34,7 +34,7 @@ import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
/** /**
@ -54,7 +54,7 @@ public class NyleasDisciple extends CardImpl<NyleasDisciple> {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// When Nylea's Disciple enters the battlefield, you gain life equal to your devotion to green. // When Nylea's Disciple enters the battlefield, you gain life equal to your devotion to green.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(new DevotionCount(ManaType.GREEN)))); this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(new DevotionCount(ColoredManaSymbol.G))));
} }
public NyleasDisciple(final NyleasDisciple card) { public NyleasDisciple(final NyleasDisciple card) {

View file

@ -41,8 +41,8 @@ import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
@ -73,7 +73,7 @@ public class PurphorosGodOfTheForge extends CardImpl<PurphorosGodOfTheForge> {
// Indestructible // Indestructible
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to red is less than five, Purphoros isn't a creature. // As long as your devotion to red is less than five, Purphoros isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ManaType.RED), 5); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.R), 5);
effect.setText("As long as your devotion to red is less than five, Purphoros isn't a creature.<i>(Each {R} in the mana costs of permanents you control counts towards your devotion to red.)</i>"); effect.setText("As long as your devotion to red is less than five, Purphoros isn't a creature.<i>(Each {R} in the mana costs of permanents you control counts towards your devotion to red.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -34,7 +34,7 @@ import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -55,7 +55,7 @@ public class ReverentHunter extends CardImpl<ReverentHunter> {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// When Reverent Hunter enters the battlefield, put a number of +1/+1 counters on it equal to your devotion to green. // When Reverent Hunter enters the battlefield, put a number of +1/+1 counters on it equal to your devotion to green.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new DevotionCount(ManaType.GREEN), true))); this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new DevotionCount(ColoredManaSymbol.G), true)));
} }

View file

@ -43,8 +43,8 @@ import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
@ -71,7 +71,7 @@ public class ThassaGodOfTheSea extends CardImpl<ThassaGodOfTheSea> {
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to white is less than five, Thassa isn't a creature.<i>(Each {U} in the mana costs of permanents you control counts towards your devotion to white.)</i> // As long as your devotion to white is less than five, Thassa isn't a creature.<i>(Each {U} in the mana costs of permanents you control counts towards your devotion to white.)</i>
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ManaType.BLUE), 5); Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.U), 5);
effect.setText("As long as your devotion to blue is less than five, Thassa isn't a creature.<i>(Each {U} in the mana costs of permanents you control counts towards your devotion to blue.)</i>"); effect.setText("As long as your devotion to blue is less than five, Thassa isn't a creature.<i>(Each {U} in the mana costs of permanents you control counts towards your devotion to blue.)</i>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -4,9 +4,11 @@
*/ */
package mage.abilities.dynamicvalue.common; package mage.abilities.dynamicvalue.common;
import java.util.ArrayList;
import java.util.Arrays;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.constants.ManaType; import mage.constants.ColoredManaSymbol;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -17,37 +19,22 @@ import mage.game.permanent.Permanent;
*/ */
public class DevotionCount implements DynamicValue { public class DevotionCount implements DynamicValue {
private ManaType devotionColor; private ArrayList<ColoredManaSymbol> devotionColors = new ArrayList();
public DevotionCount(ColoredManaSymbol... devotionColor) {
public DevotionCount(ManaType devotionColor) { this.devotionColors.addAll(Arrays.asList(devotionColor));
this.devotionColor = devotionColor;
} }
public DevotionCount(final DevotionCount dynamicValue) { public DevotionCount(final DevotionCount dynamicValue) {
this.devotionColor = dynamicValue.devotionColor; this.devotionColors = dynamicValue.devotionColors;
} }
@Override @Override
public int calculate(Game game, Ability sourceAbility) { public int calculate(Game game, Ability sourceAbility) {
int devotion = 0; int devotion = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
switch (devotionColor) { for(ColoredManaSymbol coloredManaSymbol: devotionColors) {
case BLACK: devotion += permanent.getManaCost().getMana().getColor(coloredManaSymbol);
devotion += permanent.getManaCost().getMana().getBlack();
break;
case BLUE:
devotion += permanent.getManaCost().getMana().getBlue();
break;
case GREEN:
devotion += permanent.getManaCost().getMana().getGreen();
break;
case RED:
devotion += permanent.getManaCost().getMana().getRed();
break;
case WHITE:
devotion += permanent.getManaCost().getMana().getWhite();
break;
} }
} }
return devotion; return devotion;
@ -65,6 +52,15 @@ public class DevotionCount implements DynamicValue {
@Override @Override
public String getMessage() { public String getMessage() {
return new StringBuilder("devotion to ").append(devotionColor.toString()).toString(); StringBuilder sb = new StringBuilder("devotion to ");
int count = 0;
for (ColoredManaSymbol coloredManaSymbol:devotionColors) {
if (count > 0) {
sb.append(" and ");
}
sb.append(coloredManaSymbol.getColorName());
count++;
}
return sb.toString();
} }
} }

View file

@ -5,19 +5,27 @@ package mage.constants;
* @author North * @author North
*/ */
public enum ColoredManaSymbol { public enum ColoredManaSymbol {
W("W"), U("U"), B("B"), R("R"), G("G"); W("W","white"), U("U","blue"), B("B","black"), R("R","red"), G("G","green");
private final String text; private final String text;
private final String colorName;
ColoredManaSymbol(String text) { ColoredManaSymbol(String text, String colorName) {
this.text = text; this.text = text;
this.colorName = colorName;
} }
@Override @Override
public String toString() { public String toString() {
return text; return text;
} }
public String getColorName() {
return colorName;
}
public static ColoredManaSymbol lookup(char c) { public static ColoredManaSymbol lookup(char c) {
switch (c) { switch (c) {
case 'W': case 'W':