diff --git a/Mage.Sets/src/mage/cards/k/KarametraGodOfHarvests.java b/Mage.Sets/src/mage/cards/k/KarametraGodOfHarvests.java
index 76bef998816..103caf6364f 100644
--- a/Mage.Sets/src/mage/cards/k/KarametraGodOfHarvests.java
+++ b/Mage.Sets/src/mage/cards/k/KarametraGodOfHarvests.java
@@ -3,7 +3,6 @@ package mage.cards.k;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.LoseCreatureTypeSourceEffect;
@@ -12,7 +11,9 @@ import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.*;
+import mage.constants.CardType;
+import mage.constants.SubType;
+import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
@@ -31,11 +32,10 @@ public final class KarametraGodOfHarvests extends CardImpl {
static {
filter.add(Predicates.or(
new SubtypePredicate(SubType.FOREST),
- new SubtypePredicate(SubType.PLAINS)));
+ new SubtypePredicate(SubType.PLAINS)
+ ));
}
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G, ColoredManaSymbol.W);
-
public KarametraGodOfHarvests(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{3}{G}{W}");
addSuperType(SuperType.LEGENDARY);
@@ -48,13 +48,15 @@ public final class KarametraGodOfHarvests extends CardImpl {
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to green and white is less than seven, Karametra isn't a creature.
- Effect effect = new LoseCreatureTypeSourceEffect(xValue, 7);
- effect.setText("As long as your devotion to green and white is less than seven, Karametra isn't a creature");
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect).addHint(new ValueHint("Devotion to green and white", xValue)));
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.GW, 7);
+ effect.setText("As long as your devotion to green and white is less than seven, {this} isn't a creature");
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to green and white", DevotionCount.GW)));
// Whenever you cast a creature spell, you may search your library for a Forest or Plains card, put it onto the battlefield tapped, then shuffle your library.
this.addAbility(new SpellCastControllerTriggeredAbility(
- new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), StaticFilters.FILTER_SPELL_A_CREATURE, true));
+ new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true),
+ StaticFilters.FILTER_SPELL_A_CREATURE, true
+ ));
}
public KarametraGodOfHarvests(final KarametraGodOfHarvests card) {
diff --git a/Mage.Sets/src/mage/cards/k/KarametrasAcolyte.java b/Mage.Sets/src/mage/cards/k/KarametrasAcolyte.java
index 9f53fc8cf07..fe583cde502 100644
--- a/Mage.Sets/src/mage/cards/k/KarametrasAcolyte.java
+++ b/Mage.Sets/src/mage/cards/k/KarametrasAcolyte.java
@@ -2,14 +2,12 @@ package mage.cards.k;
import mage.MageInt;
import mage.Mana;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.hint.ValueHint;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.ColoredManaSymbol;
import mage.constants.SubType;
import java.util.UUID;
@@ -19,8 +17,6 @@ import java.util.UUID;
*/
public final class KarametrasAcolyte extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G);
-
public KarametrasAcolyte(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.HUMAN);
@@ -30,9 +26,10 @@ public final class KarametrasAcolyte extends CardImpl {
this.toughness = new MageInt(4);
// {T}: Add an amount of {G} equal to your devotion to green.
- this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), xValue,
- "Add an amount of {G} equal to your devotion to green. (Each {G} in the mana costs of permanents you control counts towards your devotion to green.)")
- .addHint(new ValueHint("Devotion to green", xValue)));
+ this.addAbility(new DynamicManaAbility(
+ Mana.GreenMana(1), DevotionCount.G, "Add an amount of {G} equal to your devotion to green. " +
+ "(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)"
+ ).addHint(new ValueHint("Devotion to green", DevotionCount.G)));
}
public KarametrasAcolyte(final KarametrasAcolyte card) {
diff --git a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java
index c78258feeae..5de8783f246 100644
--- a/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java
+++ b/Mage.Sets/src/mage/cards/k/KeranosGodOfStorms.java
@@ -3,7 +3,6 @@ package mage.cards.k;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
@@ -16,7 +15,10 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
-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.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@@ -32,8 +34,6 @@ import java.util.UUID;
*/
public final class KeranosGodOfStorms extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.U, ColoredManaSymbol.R);
-
public KeranosGodOfStorms(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{3}{U}{R}");
addSuperType(SuperType.LEGENDARY);
@@ -46,16 +46,14 @@ public final class KeranosGodOfStorms extends CardImpl {
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to blue and red is less than seven, Keranos isn't a creature.
- Effect effect = new LoseCreatureTypeSourceEffect(xValue, 7);
- effect.setText("As long as your devotion to blue and red is less than seven, Keranos isn't a creature");
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect).addHint(new ValueHint("Devotion to blue and red", xValue)));
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.UR, 7);
+ effect.setText("As long as your devotion to blue and red is less than seven, {this} isn't a creature");
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to blue and red", DevotionCount.UR)));
// Reveal the first card you draw on each of your turns.
// Whenever you reveal a land card this way, draw a card.
// Whenever you reveal a nonland card this way, Keranos deals 3 damage to any target.
this.addAbility(new KeranosGodOfStormsTriggeredAbility(), new CardsAmountDrawnThisTurnWatcher());
-
-
}
public KeranosGodOfStorms(final KeranosGodOfStorms card) {
@@ -74,7 +72,7 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
super(Zone.BATTLEFIELD, new InfoEffect(""), false);
}
- KeranosGodOfStormsTriggeredAbility(final KeranosGodOfStormsTriggeredAbility ability) {
+ private KeranosGodOfStormsTriggeredAbility(final KeranosGodOfStormsTriggeredAbility ability) {
super(ability);
}
@@ -90,36 +88,38 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
- if (event.getPlayerId().equals(this.getControllerId())) {
- if (game.isActivePlayer(this.getControllerId())) {
- CardsAmountDrawnThisTurnWatcher watcher =
- game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
- if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
- return false;
- }
- Card card = game.getCard(event.getTargetId());
- Player controller = game.getPlayer(this.getControllerId());
- Permanent sourcePermanent = (Permanent) getSourceObject(game);
- if (card != null && controller != null && sourcePermanent != null) {
- controller.revealCards(sourcePermanent.getIdName(), new CardsImpl(card), game);
- this.getTargets().clear();
- this.getEffects().clear();
- if (card.isLand()) {
- this.addEffect(new DrawCardSourceControllerEffect(1));
- } else {
- this.addEffect(new DamageTargetEffect(3));
- this.addTarget(new TargetAnyTarget());
- }
- return true;
- }
- }
+ if (!event.getPlayerId().equals(this.getControllerId())) {
+ return false;
}
- return false;
+ if (!game.isActivePlayer(this.getControllerId())) {
+ return false;
+ }
+ CardsAmountDrawnThisTurnWatcher watcher =
+ game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class);
+ if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) {
+ return false;
+ }
+ Card card = game.getCard(event.getTargetId());
+ Player controller = game.getPlayer(this.getControllerId());
+ Permanent sourcePermanent = (Permanent) getSourceObject(game);
+ if (card == null || controller == null || sourcePermanent == null) {
+ return false;
+ }
+ controller.revealCards(sourcePermanent.getIdName(), new CardsImpl(card), game);
+ this.getTargets().clear();
+ this.getEffects().clear();
+ if (card.isLand()) {
+ this.addEffect(new DrawCardSourceControllerEffect(1));
+ } else {
+ this.addEffect(new DamageTargetEffect(3));
+ this.addTarget(new TargetAnyTarget());
+ }
+ return true;
}
@Override
public String getRule() {
return "Reveal the first card you draw on each of your turns. Whenever you reveal a land card this way, draw a card. " +
- "Whenever you reveal a nonland card this way, Keranos deals 3 damage to any target.";
+ "Whenever you reveal a nonland card this way, {this} deals 3 damage to any target.";
}
}
diff --git a/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java
index 1e092b63bfe..6cb9ae76b0d 100644
--- a/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java
+++ b/Mage.Sets/src/mage/cards/k/KlothysGodOfDestiny.java
@@ -5,7 +5,6 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@@ -28,8 +27,6 @@ import java.util.UUID;
*/
public final class KlothysGodOfDestiny extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.R, ColoredManaSymbol.G);
-
public KlothysGodOfDestiny(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{R}{G}");
@@ -42,9 +39,9 @@ public final class KlothysGodOfDestiny extends CardImpl {
this.addAbility(IndestructibleAbility.getInstance());
// As long as your devotion to red and green is less than seven, Klothys isn't a creature.
- Effect effect = new LoseCreatureTypeSourceEffect(xValue, 7);
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.RG, 7);
effect.setText("As long as your devotion to red and green is less than seven, {this} isn't a creature");
- this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to red and green", xValue)));
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to red and green", DevotionCount.RG)));
// At the beginning of your precombat main phase, exile target card from a graveyard. If it was a land card, add {R} or {G}. Otherwise, you gain 2 life and Klothys deals 2 damage to each opponent.
Ability ability = new BeginningOfPreCombatMainTriggeredAbility(
diff --git a/Mage.Sets/src/mage/cards/k/KlothyssDesign.java b/Mage.Sets/src/mage/cards/k/KlothyssDesign.java
index 147d6845600..57d327364c2 100644
--- a/Mage.Sets/src/mage/cards/k/KlothyssDesign.java
+++ b/Mage.Sets/src/mage/cards/k/KlothyssDesign.java
@@ -1,13 +1,11 @@
package mage.cards.k;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.filter.StaticFilters;
@@ -18,18 +16,16 @@ import java.util.UUID;
*/
public final class KlothyssDesign extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G);
-
public KlothyssDesign(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{G}");
// Creatures you control get +X/+X until end of turn, where X is your devotion to green.
this.getSpellAbility().addEffect(new BoostControlledEffect(
- xValue, xValue, Duration.EndOfTurn,
+ DevotionCount.G, DevotionCount.G, Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURES,
false, true
));
- this.getSpellAbility().addHint(new ValueHint("Devotion to green", xValue));
+ this.getSpellAbility().addHint(new ValueHint("Devotion to green", DevotionCount.G));
}
private KlothyssDesign(final KlothyssDesign card) {
diff --git a/Mage.Sets/src/mage/cards/k/KruphixGodOfHorizons.java b/Mage.Sets/src/mage/cards/k/KruphixGodOfHorizons.java
index b0effcf4c83..2d36ca74ebf 100644
--- a/Mage.Sets/src/mage/cards/k/KruphixGodOfHorizons.java
+++ b/Mage.Sets/src/mage/cards/k/KruphixGodOfHorizons.java
@@ -3,7 +3,6 @@ package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl;
@@ -24,8 +23,6 @@ import java.util.UUID;
*/
public final class KruphixGodOfHorizons extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G, ColoredManaSymbol.U);
-
public KruphixGodOfHorizons(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{3}{G}{U}");
addSuperType(SuperType.LEGENDARY);
@@ -36,20 +33,23 @@ public final class KruphixGodOfHorizons extends CardImpl {
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
+
// As long as your devotion to green and blue is less than seven, Kruhpix isn't a creature.
- Effect effect = new LoseCreatureTypeSourceEffect(xValue, 7);
- effect.setText("As long as your devotion to green and blue is less than seven, Kruhpix isn't a creature");
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect).addHint(new ValueHint("Devotion to green and blue", xValue)));
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.GU, 7);
+ effect.setText("As long as your devotion to green and blue is less than seven, {this} isn't a creature");
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to green and blue", DevotionCount.GU)));
// You have no maximum hand size.
- effect = new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.WhileOnBattlefield, MaximumHandSizeControllerEffect.HandSizeModification.SET);
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
+ this.addAbility(new SimpleStaticAbility(new MaximumHandSizeControllerEffect(
+ Integer.MAX_VALUE, Duration.WhileOnBattlefield,
+ MaximumHandSizeControllerEffect.HandSizeModification.SET
+ )));
// If unused mana would empty from your mana pool, that mana becomes colorless instead.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KruphixGodOfHorizonsEffect()));
+ this.addAbility(new SimpleStaticAbility(new KruphixGodOfHorizonsEffect()));
}
- public KruphixGodOfHorizons(final KruphixGodOfHorizons card) {
+ private KruphixGodOfHorizons(final KruphixGodOfHorizons card) {
super(card);
}
@@ -61,12 +61,12 @@ public final class KruphixGodOfHorizons extends CardImpl {
class KruphixGodOfHorizonsEffect extends ReplacementEffectImpl {
- public KruphixGodOfHorizonsEffect() {
+ KruphixGodOfHorizonsEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If you would lose unspent mana, that mana becomes colorless instead.";
}
- public KruphixGodOfHorizonsEffect(final KruphixGodOfHorizonsEffect effect) {
+ private KruphixGodOfHorizonsEffect(final KruphixGodOfHorizonsEffect effect) {
super(effect);
}
diff --git a/Mage.Sets/src/mage/cards/m/MarshmistTitan.java b/Mage.Sets/src/mage/cards/m/MarshmistTitan.java
index a4cfca2c7d2..b799b27b279 100644
--- a/Mage.Sets/src/mage/cards/m/MarshmistTitan.java
+++ b/Mage.Sets/src/mage/cards/m/MarshmistTitan.java
@@ -5,7 +5,6 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.hint.ValueHint;
@@ -30,10 +29,10 @@ public final class MarshmistTitan extends CardImpl {
// Marshmist Titan costs {X} less to cast, where X is your devotion to black.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new MarshmistTitanCostReductionEffect())
- .addHint(new ValueHint("Devotion to black", MarshmistTitanCostReductionEffect.xValue)));
+ .addHint(new ValueHint("Devotion to black", DevotionCount.B)));
}
- public MarshmistTitan(final MarshmistTitan card) {
+ private MarshmistTitan(final MarshmistTitan card) {
super(card);
}
@@ -45,14 +44,13 @@ public final class MarshmistTitan extends CardImpl {
class MarshmistTitanCostReductionEffect extends CostModificationEffectImpl {
- static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.B);
-
- public MarshmistTitanCostReductionEffect() {
+ MarshmistTitanCostReductionEffect() {
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
- staticText = "{this} costs {X} less to cast, where X is your devotion to black (Each {B} in the mana costs of permanents you control counts toward your devotion to black.) ";
+ staticText = "{this} costs {X} less to cast, where X is your devotion to black. " +
+ "(Each {B} in the mana costs of permanents you control counts toward your devotion to black.) ";
}
- public MarshmistTitanCostReductionEffect(final MarshmistTitanCostReductionEffect effect) {
+ private MarshmistTitanCostReductionEffect(final MarshmistTitanCostReductionEffect effect) {
super(effect);
}
@@ -60,22 +58,19 @@ class MarshmistTitanCostReductionEffect extends CostModificationEffectImpl {
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
Mana mana = spellAbility.getManaCostsToPay().getMana();
- if (mana.getGeneric() > 0) {
- int count = xValue.calculate(game, source, this);
- int newCount = mana.getGeneric() - count;
- if (newCount < 0) {
- newCount = 0;
- }
- mana.setGeneric(newCount);
- spellAbility.getManaCostsToPay().load(mana.toString());
- return true;
+ if (mana.getGeneric() == 0) {
+ return false;
}
- return false;
+ int count = DevotionCount.B.calculate(game, source, this);
+ mana.setGeneric(Math.max(mana.getGeneric() - count, 0));
+ spellAbility.getManaCostsToPay().load(mana.toString());
+ return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
- return abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility);
+ return abilityToModify instanceof SpellAbility
+ && abilityToModify.getSourceId().equals(source.getSourceId());
}
@Override
diff --git a/Mage.Sets/src/mage/cards/m/MasterOfWaves.java b/Mage.Sets/src/mage/cards/m/MasterOfWaves.java
index a563aafd4e9..e10ef691621 100644
--- a/Mage.Sets/src/mage/cards/m/MasterOfWaves.java
+++ b/Mage.Sets/src/mage/cards/m/MasterOfWaves.java
@@ -4,7 +4,6 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
@@ -13,9 +12,10 @@ import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.*;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
-import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.permanent.token.MasterOfWavesElementalToken;
import java.util.UUID;
@@ -25,13 +25,8 @@ import java.util.UUID;
*/
public final class MasterOfWaves extends CardImpl {
- private static final FilterCreaturePermanent filterBoost = new FilterCreaturePermanent("Elemental creatures");
-
- static {
- filterBoost.add(new SubtypePredicate(SubType.ELEMENTAL));
- }
-
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.U);
+ private static final FilterCreaturePermanent filterBoost
+ = new FilterCreaturePermanent(SubType.ELEMENTAL, "Elemental creatures");
public MasterOfWaves(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
@@ -45,13 +40,15 @@ public final class MasterOfWaves extends CardImpl {
this.addAbility(ProtectionAbility.from(ObjectColor.RED));
// Elemental creatures you control get +1/+1.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterBoost, false)));
+ this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
+ 1, 1, Duration.WhileOnBattlefield, filterBoost, false
+ )));
// When Master of Waves enters the battlefield, create a number of 1/0 blue Elemental creature tokens equal to your devotion to blue.
// (Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)
- Effect effect = new CreateTokenEffect(new MasterOfWavesElementalToken(), xValue);
+ Effect effect = new CreateTokenEffect(new MasterOfWavesElementalToken(), DevotionCount.U);
effect.setText("create a number of 1/0 blue Elemental creature tokens equal to your devotion to blue. (Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)");
- this.addAbility(new EntersBattlefieldTriggeredAbility(effect).addHint(new ValueHint("Devotion to blue", xValue)));
+ this.addAbility(new EntersBattlefieldTriggeredAbility(effect).addHint(new ValueHint("Devotion to blue", DevotionCount.U)));
}
public MasterOfWaves(final MasterOfWaves card) {
diff --git a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java
index 4b366f69908..0baac0226aa 100644
--- a/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java
+++ b/Mage.Sets/src/mage/cards/m/MogisGodOfSlaughter.java
@@ -8,7 +8,6 @@ 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.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@@ -34,8 +33,6 @@ import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
*/
public final class MogisGodOfSlaughter extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.B, ColoredManaSymbol.R);
-
public MogisGodOfSlaughter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{B}{R}");
addSuperType(SuperType.LEGENDARY);
@@ -48,9 +45,9 @@ public final class MogisGodOfSlaughter extends CardImpl {
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(xValue, 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).addHint(new ValueHint("Devotion to black and red", xValue)));
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.BR, 7);
+ effect.setText("As long as your devotion to black and red is less than seven, {this} isn't a creature");
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to black and red", DevotionCount.BR)));
// At the beginning of each opponent's upkeep, Mogis deals 2 damage to that player unless they sacrifice a creature.
effect = new DoUnlessTargetPaysCost(new DamageTargetEffect(2, true, "that player"),
@@ -61,7 +58,7 @@ public final class MogisGodOfSlaughter extends CardImpl {
this.addAbility(ability);
}
- public MogisGodOfSlaughter(final MogisGodOfSlaughter card) {
+ private MogisGodOfSlaughter(final MogisGodOfSlaughter card) {
super(card);
}
diff --git a/Mage.Sets/src/mage/cards/m/MogissMarauder.java b/Mage.Sets/src/mage/cards/m/MogissMarauder.java
index cc839ac2fbe..10b87cd340c 100644
--- a/Mage.Sets/src/mage/cards/m/MogissMarauder.java
+++ b/Mage.Sets/src/mage/cards/m/MogissMarauder.java
@@ -3,7 +3,6 @@ package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.hint.ValueHint;
@@ -12,7 +11,6 @@ import mage.abilities.keyword.IntimidateAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.game.Game;
@@ -36,16 +34,21 @@ public final class MogissMarauder extends CardImpl {
// When Mogis's Marauder enters the battlefield, up to X target creatures each gain intimidate and haste, where X is your devotion to black.
Ability ability = new EntersBattlefieldTriggeredAbility(
- new GainAbilityTargetEffect(IntimidateAbility.getInstance(), Duration.EndOfTurn,
- "up to X target creatures each gain intimidate"), false);
- ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn,
- "and haste until end of turn, where X is your devotion to black"));
+ new GainAbilityTargetEffect(
+ IntimidateAbility.getInstance(), Duration.EndOfTurn,
+ "up to X target creatures each gain intimidate"
+ ), false
+ );
+ ability.addEffect(new GainAbilityTargetEffect(
+ HasteAbility.getInstance(), Duration.EndOfTurn,
+ "and haste until end of turn, where X is your devotion to black"
+ ));
ability.setTargetAdjuster(MogissMarauderAdjuster.instance);
- ability.addHint(new ValueHint("Devotion to black", MogissMarauderAdjuster.xValue));
+ ability.addHint(new ValueHint("Devotion to black", DevotionCount.B));
this.addAbility(ability);
}
- public MogissMarauder(final MogissMarauder card) {
+ private MogissMarauder(final MogissMarauder card) {
super(card);
}
@@ -56,15 +59,12 @@ public final class MogissMarauder extends CardImpl {
}
enum MogissMarauderAdjuster implements TargetAdjuster {
-
instance;
- static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.B);
-
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
- int numbTargets = xValue.calculate(game, ability, null);
+ int numbTargets = DevotionCount.B.calculate(game, ability, null);
if (numbTargets > 0) {
ability.addTarget(new TargetCreaturePermanent(0, numbTargets));
}
diff --git a/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java b/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java
index 87497bb64f9..7306bd6a603 100644
--- a/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java
+++ b/Mage.Sets/src/mage/cards/n/NykthosShrineToNyx.java
@@ -4,7 +4,6 @@ import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.hint.ValueHint;
@@ -14,7 +13,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
-import mage.constants.ColoredManaSymbol;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game;
@@ -23,6 +21,7 @@ import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import java.util.stream.Collectors;
/**
* @author LevelX2
@@ -37,15 +36,15 @@ public final class NykthosShrineToNyx extends CardImpl {
this.addAbility(new ColorlessManaAbility());
// {2}, {T}: Choose a color. Add an amount of mana of that color equal to your devotion to that color.
Ability ability = new NykthosShrineToNyxManaAbility();
- ability.addHint(new ValueHint("Devotion to red", NykthosDynamicManaEffect.xValueR));
- ability.addHint(new ValueHint("Devotion to blue", NykthosDynamicManaEffect.xValueU));
- ability.addHint(new ValueHint("Devotion to white", NykthosDynamicManaEffect.xValueW));
- ability.addHint(new ValueHint("Devotion to black", NykthosDynamicManaEffect.xValueB));
- ability.addHint(new ValueHint("Devotion to green", NykthosDynamicManaEffect.xValueG));
+ ability.addHint(new ValueHint("Devotion to white", DevotionCount.W));
+ ability.addHint(new ValueHint("Devotion to blue", DevotionCount.U));
+ ability.addHint(new ValueHint("Devotion to black", DevotionCount.B));
+ ability.addHint(new ValueHint("Devotion to red", DevotionCount.R));
+ ability.addHint(new ValueHint("Devotion to green", DevotionCount.G));
this.addAbility(ability);
}
- public NykthosShrineToNyx(final NykthosShrineToNyx card) {
+ private NykthosShrineToNyx(final NykthosShrineToNyx card) {
super(card);
}
@@ -57,12 +56,12 @@ public final class NykthosShrineToNyx extends CardImpl {
class NykthosShrineToNyxManaAbility extends ActivatedManaAbilityImpl {
- public NykthosShrineToNyxManaAbility() {
+ NykthosShrineToNyxManaAbility() {
super(Zone.BATTLEFIELD, new NykthosDynamicManaEffect(), new GenericManaCost(2));
this.addCost(new TapSourceCost());
}
- public NykthosShrineToNyxManaAbility(final NykthosShrineToNyxManaAbility ability) {
+ private NykthosShrineToNyxManaAbility(final NykthosShrineToNyxManaAbility ability) {
super(ability);
}
@@ -74,27 +73,22 @@ class NykthosShrineToNyxManaAbility extends ActivatedManaAbilityImpl {
@Override
public List getNetMana(Game game) {
ArrayList netManaCopy = new ArrayList<>();
- if (game != null) {
- netManaCopy.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this));
+ if (game == null) {
+ return netManaCopy;
}
+ netManaCopy.addAll(((ManaEffect) this.getEffects().get(0)).getNetMana(game, this));
return netManaCopy;
}
}
class NykthosDynamicManaEffect extends ManaEffect {
- static final DynamicValue xValueR = new DevotionCount(ColoredManaSymbol.R);
- static final DynamicValue xValueU = new DevotionCount(ColoredManaSymbol.U);
- static final DynamicValue xValueW = new DevotionCount(ColoredManaSymbol.W);
- static final DynamicValue xValueB = new DevotionCount(ColoredManaSymbol.B);
- static final DynamicValue xValueG = new DevotionCount(ColoredManaSymbol.G);
-
- public NykthosDynamicManaEffect() {
+ NykthosDynamicManaEffect() {
super();
this.staticText = "Choose a color. Add an amount of mana of that color equal to your devotion to that color. (Your devotion to a color is the number of mana symbols of that color in the mana costs of permanents you control.)";
}
- public NykthosDynamicManaEffect(final NykthosDynamicManaEffect effect) {
+ private NykthosDynamicManaEffect(final NykthosDynamicManaEffect effect) {
super(effect);
}
@@ -106,60 +100,59 @@ class NykthosDynamicManaEffect extends ManaEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
- if (controller != null) {
- checkToFirePossibleEvents(getMana(game, source), game, source);
- controller.getManaPool().addMana(getMana(game, source), game, source);
- return true;
+ if (controller == null) {
+ return false;
}
- return false;
+ checkToFirePossibleEvents(getMana(game, source), game, source);
+ controller.getManaPool().addMana(getMana(game, source), game, source);
+ return true;
}
@Override
public List getNetMana(Game game, Ability source) {
- List netMana = new ArrayList<>();
- for (String colorChoice : ChoiceColor.getBaseColors()) {
- Mana mana = computeMana(colorChoice, game, source);
- if (mana.count() > 0) {
- netMana.add(mana);
- }
- }
- return netMana;
+ return ChoiceColor.getBaseColors()
+ .stream()
+ .map(s -> computeMana(s, game, source))
+ .filter(mana -> mana.count() > 0)
+ .collect(Collectors.toList());
}
@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
- if (controller != null) {
- ChoiceColor choice = new ChoiceColor();
- choice.setMessage("Choose a color for devotion of Nykthos");
- if (controller.choose(outcome, choice, game)) {
- return computeMana(choice.getChoice(), game, source);
- }
+ if (controller == null) {
+ return null;
}
- return null;
+ ChoiceColor choice = new ChoiceColor();
+ choice.setMessage("Choose a color for devotion of Nykthos");
+ if (!controller.choose(outcome, choice, game)) {
+ return null;
+ }
+ return computeMana(choice.getChoice(), game, source);
}
- public Mana computeMana(String color, Game game, Ability source) {
+ private Mana computeMana(String color, Game game, Ability source) {
Mana mana = new Mana();
- if (color != null && !color.isEmpty()) {
- switch (color) {
- case "Red":
- mana.setRed(xValueR.calculate(game, source, this));
- break;
- case "Blue":
- mana.setBlue(xValueU.calculate(game, source, this));
- break;
- case "White":
- mana.setWhite(xValueW.calculate(game, source, this));
- break;
- case "Black":
- mana.setBlack(xValueB.calculate(game, source, this));
- break;
- case "Green":
- mana.setGreen(xValueG.calculate(game, source, this));
- break;
- }
+ if (color == null || color.isEmpty()) {
+ return mana;
+ }
+ switch (color) {
+ case "White":
+ mana.setWhite(DevotionCount.W.calculate(game, source, this));
+ break;
+ case "Blue":
+ mana.setBlue(DevotionCount.U.calculate(game, source, this));
+ break;
+ case "Black":
+ mana.setBlack(DevotionCount.B.calculate(game, source, this));
+ break;
+ case "Red":
+ mana.setRed(DevotionCount.R.calculate(game, source, this));
+ break;
+ case "Green":
+ mana.setGreen(DevotionCount.G.calculate(game, source, this));
+ break;
}
return mana;
}
diff --git a/Mage.Sets/src/mage/cards/n/NyleaGodOfTheHunt.java b/Mage.Sets/src/mage/cards/n/NyleaGodOfTheHunt.java
index 0f4f9b80d8a..cc746f96baf 100644
--- a/Mage.Sets/src/mage/cards/n/NyleaGodOfTheHunt.java
+++ b/Mage.Sets/src/mage/cards/n/NyleaGodOfTheHunt.java
@@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
@@ -16,7 +15,10 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.*;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.SubType;
+import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent;
@@ -27,8 +29,6 @@ import java.util.UUID;
*/
public final class NyleaGodOfTheHunt extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G);
-
public NyleaGodOfTheHunt(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{3}{G}");
addSuperType(SuperType.LEGENDARY);
@@ -40,22 +40,27 @@ public final class NyleaGodOfTheHunt extends CardImpl {
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
- // As long as your devotion to white is less than five, Nylea isn't a creature.(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)
- Effect effect = new LoseCreatureTypeSourceEffect(xValue, 5);
- effect.setText("As long as your devotion to green is less than five, Nylea isn't a creature.(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)");
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect).addHint(new ValueHint("Devotion to green", xValue)));
+ // As long as your devotion to green is less than five, Nylea isn't a creature.(Each {G} in the mana costs of permanents you control counts towards your devotion to green.)
+ Effect effect = new LoseCreatureTypeSourceEffect(DevotionCount.G, 5);
+ effect.setText("As long as your devotion to green is less than five, {this} isn't a creature.");
+ this.addAbility(new SimpleStaticAbility(effect).addHint(new ValueHint("Devotion to green", DevotionCount.G)));
// Other creatures you control have trample.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE, true)));
+ this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
+ TrampleAbility.getInstance(), Duration.WhileOnBattlefield,
+ StaticFilters.FILTER_PERMANENT_CREATURE, true
+ )));
// {3}{G}: Target creature gets +2/+2 until end of turn.
- Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}"));
+ Ability ability = new SimpleActivatedAbility(
+ new BoostTargetEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")
+ );
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
- public NyleaGodOfTheHunt(final NyleaGodOfTheHunt card) {
+ private NyleaGodOfTheHunt(final NyleaGodOfTheHunt card) {
super(card);
}
diff --git a/Mage.Sets/src/mage/cards/n/NyleasDisciple.java b/Mage.Sets/src/mage/cards/n/NyleasDisciple.java
index 771edf605d1..39766259d11 100644
--- a/Mage.Sets/src/mage/cards/n/NyleasDisciple.java
+++ b/Mage.Sets/src/mage/cards/n/NyleasDisciple.java
@@ -2,15 +2,12 @@ package mage.cards.n;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
-import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.DevotionCount;
-import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.ColoredManaSymbol;
import mage.constants.SubType;
import java.util.UUID;
@@ -20,8 +17,6 @@ import java.util.UUID;
*/
public final class NyleasDisciple extends CardImpl {
- private static final DynamicValue xValue = new DevotionCount(ColoredManaSymbol.G);
-
public NyleasDisciple(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.subtype.add(SubType.CENTAUR);
@@ -31,12 +26,12 @@ public final class NyleasDisciple extends CardImpl {
this.toughness = new MageInt(3);
// When Nylea's Disciple enters the battlefield, you gain life equal to your devotion to green.
- Effect effect = new GainLifeEffect(xValue);
- effect.setText("you gain life equal to your devotion to green");
- this.addAbility(new EntersBattlefieldTriggeredAbility(effect).addHint(new ValueHint("Devotion to green", xValue)));
+ this.addAbility(new EntersBattlefieldTriggeredAbility(
+ new GainLifeEffect(DevotionCount.G).setText("you gain life equal to your devotion to green")
+ ).addHint(new ValueHint("Devotion to green", DevotionCount.G)));
}
- public NyleasDisciple(final NyleasDisciple card) {
+ private NyleasDisciple(final NyleasDisciple card) {
super(card);
}