This commit is contained in:
LevelX2 2014-01-15 01:45:33 +01:00
commit 7007e35569
22 changed files with 249 additions and 66 deletions

View file

@ -0,0 +1,171 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class MogisGodOfSlaughter extends CardImpl<MogisGodOfSlaughter> {
public MogisGodOfSlaughter(UUID ownerId) {
super(ownerId, 151, "Mogis, God of Slaughter", Rarity.MYTHIC, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{B}{R}");
this.expansionSetCode = "BNG";
this.supertype.add("Legendary");
this.subtype.add("God");
this.color.setRed(true);
this.color.setBlack(true);
this.power = new MageInt(7);
this.toughness = new MageInt(5);
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to black and red is less than seven, Mogis isn't a creature.
Effect effect = new LoseCreatureTypeSourceEffect(new DevotionCount(ColoredManaSymbol.B, ColoredManaSymbol.R), 7);
effect.setText("As long as your devotion to black and red is less than seven, Mogis isn't a creature");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// At the beginning of each opponent's upkeep, Mogis deals 2 damage to that player unless he or she sacrifices a creature.
effect = new DoUnlessTargetPaysCost(new DamageTargetEffect(2, false, "that player"), new SacrificeTargetCost(new TargetControlledCreaturePermanent()),
"Sacrifice a creature? (Otherwise you get 2 damge.)");
effect.setText("Mogis deals 2 damage to that player unless he or she sacrifices a creature");
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.OPPONENT, false, true);
this.addAbility(ability);
}
public MogisGodOfSlaughter(final MogisGodOfSlaughter card) {
super(card);
}
@Override
public MogisGodOfSlaughter copy() {
return new MogisGodOfSlaughter(this);
}
}
class DoUnlessTargetPaysCost extends OneShotEffect<DoUnlessTargetPaysCost> {
private final OneShotEffect executingEffect;
private final Cost cost;
private final String userMessage;
public DoUnlessTargetPaysCost(OneShotEffect effect, Cost cost) {
this(effect, cost, null);
}
public DoUnlessTargetPaysCost(OneShotEffect effect, Cost cost, String userMessage) {
super(Outcome.Benefit);
this.executingEffect = effect;
this.cost = cost;
this.userMessage = userMessage;
}
public DoUnlessTargetPaysCost(final DoUnlessTargetPaysCost effect) {
super(effect);
this.executingEffect = (OneShotEffect) effect.executingEffect.copy();
this.cost = effect.cost.copy();
this.userMessage = effect.userMessage;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
MageObject mageObject = game.getObject(source.getSourceId());
if (player != null && mageObject != null) {
String message = userMessage;
if (message == null) {
message = new StringBuilder(getCostText()).append(" to prevent ").append(executingEffect.getText(source.getModes().getMode())).append("?").toString();
}
message = CardUtil.replaceSourceName(message, mageObject.getName());
cost.clearPaid();
if (cost.canPay(source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, game)) {
cost.pay(source, game, source.getSourceId(), player.getId(), false);
}
if (!cost.isPaid()) {
executingEffect.setTargetPointer(this.targetPointer);
return executingEffect.apply(game, source);
}
return true;
}
return false;
}
@Override
public String getText(Mode mode) {
if (!staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder(executingEffect.getText(mode));
sb.append("unless he or she");
sb.append(getCostText());
return sb.toString();
}
private String getCostText() {
StringBuilder sb = new StringBuilder();
String costText = cost.getText();
if (costText != null &&
!costText.toLowerCase().startsWith("discard")
&& !costText.toLowerCase().startsWith("sacrifice")
&& !costText.toLowerCase().startsWith("remove")) {
sb.append("pay ");
}
return sb.append(costText).toString();
}
@Override
public DoUnlessTargetPaysCost copy() {
return new DoUnlessTargetPaysCost(this);
}
}

View file

@ -39,7 +39,7 @@ import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
@ -63,7 +63,7 @@ public class AbhorrentOverlord extends CardImpl<AbhorrentOverlord> {
// Flying
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.
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>");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
// 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.CardsImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
@ -102,7 +102,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect<DiscipleOfPhenaxEffect> {
@Override
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));
if (devotion > 0 && targetPlayer != null) {
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
@ -71,7 +71,7 @@ public class ErebosGodOfTheDead extends CardImpl<ErebosGodOfTheDead> {
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// 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>");
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.game.permanent.token.Token;
@ -56,7 +56,7 @@ public class EvangelOfHeliod extends CardImpl<EvangelOfHeliod> {
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.
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) {

View file

@ -35,7 +35,7 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
@ -57,7 +57,7 @@ public class FanaticOfMogis extends CardImpl<FanaticOfMogis> {
this.toughness = new MageInt(2);
// 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.)");
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
@ -91,7 +91,7 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect<GrayMerchantOfAsphodelE
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int lifeLost = 0;
int damage = new DevotionCount(ManaType.BLACK).calculate(game, source);
int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source);
if (damage > 0) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);

View file

@ -41,8 +41,8 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
@ -68,7 +68,7 @@ public class HeliodGodOfTheSun extends CardImpl<HeliodGodOfTheSun> {
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>
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>");
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
/**
@ -54,7 +54,7 @@ public class KarametrasAcolyte extends CardImpl<KarametrasAcolyte> {
this.toughness = new MageInt(4);
// {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.)"));
}

View file

@ -39,8 +39,8 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
import mage.constants.Zone;
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)));
// 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>
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>");
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));

View file

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

View file

@ -40,7 +40,7 @@ import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
@ -104,7 +104,7 @@ class NykthosShrineToNyxManaAbility extends ManaAbility<NykthosShrineToNyxManaAb
class NykthosDynamicManaEffect extends ManaEffect {
private Mana computedMana;
private final Mana computedMana;
public NykthosDynamicManaEffect() {
super();
@ -132,19 +132,19 @@ class NykthosDynamicManaEffect extends ManaEffect {
public Mana computeMana(Game game, Ability source){
this.computedMana.clear();
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) {
String color = choice.getChoice();
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")) {
computedMana.setBlue(new DevotionCount(ManaType.BLUE).calculate(game, source));
computedMana.setBlue(new DevotionCount(ColoredManaSymbol.U).calculate(game, source));
} 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")) {
computedMana.setBlack(new DevotionCount(ManaType.BLACK).calculate(game, source));
computedMana.setBlack(new DevotionCount(ColoredManaSymbol.B).calculate(game, source));
} 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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
@ -68,7 +68,7 @@ public class NyleaGodOfTheHunt extends CardImpl<NyleaGodOfTheHunt> {
// Indestructible
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>
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>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// 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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
/**
@ -54,7 +54,7 @@ public class NyleasDisciple extends CardImpl<NyleasDisciple> {
this.toughness = new MageInt(3);
// 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) {

View file

@ -41,8 +41,8 @@ import mage.abilities.effects.common.continious.LoseCreatureTypeSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
@ -73,7 +73,7 @@ public class PurphorosGodOfTheForge extends CardImpl<PurphorosGodOfTheForge> {
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
// 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>");
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.counters.CounterType;
@ -55,7 +55,7 @@ public class ReverentHunter extends CardImpl<ReverentHunter> {
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.
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.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
@ -71,7 +71,7 @@ public class ThassaGodOfTheSea extends CardImpl<ThassaGodOfTheSea> {
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>
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>");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));

View file

@ -132,8 +132,7 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
}
}
sb.append(superRule.substring(0, 1).toLowerCase());
sb.append(superRule.substring(1));
sb.append(superRule);
}
return sb.toString();

View file

@ -4,9 +4,11 @@
*/
package mage.abilities.dynamicvalue.common;
import java.util.ArrayList;
import java.util.Arrays;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.constants.ManaType;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -17,37 +19,22 @@ import mage.game.permanent.Permanent;
*/
public class DevotionCount implements DynamicValue {
private ManaType devotionColor;
private ArrayList<ColoredManaSymbol> devotionColors = new ArrayList();
public DevotionCount(ManaType devotionColor) {
this.devotionColor = devotionColor;
public DevotionCount(ColoredManaSymbol... devotionColor) {
this.devotionColors.addAll(Arrays.asList(devotionColor));
}
public DevotionCount(final DevotionCount dynamicValue) {
this.devotionColor = dynamicValue.devotionColor;
this.devotionColors = dynamicValue.devotionColors;
}
@Override
public int calculate(Game game, Ability sourceAbility) {
int devotion = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
switch (devotionColor) {
case BLACK:
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;
for(ColoredManaSymbol coloredManaSymbol: devotionColors) {
devotion += permanent.getManaCost().getMana().getColor(coloredManaSymbol);
}
}
return devotion;
@ -65,6 +52,15 @@ public class DevotionCount implements DynamicValue {
@Override
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

@ -80,7 +80,10 @@ public class UntapTargetEffect extends OneShotEffect<UntapTargetEffect> {
if (target.getMaxNumberOfTargets() > 1 || target.getNumberOfTargets() == 0) {
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append("s");
} else {
sb.append("target ").append(target.getTargetName());
if (!target.getTargetName().startsWith("another")) {
sb.append("target ");
}
sb.append(target.getTargetName());
}
return sb.toString();

View file

@ -49,6 +49,12 @@ public class LoseCreatureTypeSourceEffect extends ContinuousEffectImpl<LoseCreat
private final DynamicValue dynamicValue;
private final int lessThan;
/**
* Permanent loses the creature type as long as the dynamic value is less than the value of lessThan.
*
* @param dynamicValue
* @param lessThan
*/
public LoseCreatureTypeSourceEffect(DynamicValue dynamicValue, int lessThan) {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.dynamicValue = dynamicValue;

View file

@ -5,19 +5,27 @@ package mage.constants;
* @author North
*/
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 colorName;
ColoredManaSymbol(String text) {
ColoredManaSymbol(String text, String colorName) {
this.text = text;
this.colorName = colorName;
}
@Override
public String toString() {
return text;
}
public String getColorName() {
return colorName;
}
public static ColoredManaSymbol lookup(char c) {
switch (c) {
case 'W':