diff --git a/Mage.Sets/src/mage/cards/h/HeartlashCinder.java b/Mage.Sets/src/mage/cards/h/HeartlashCinder.java index e83705684e..3fb8fd9d7b 100644 --- a/Mage.Sets/src/mage/cards/h/HeartlashCinder.java +++ b/Mage.Sets/src/mage/cards/h/HeartlashCinder.java @@ -1,30 +1,25 @@ - package mage.cards.h; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.common.ChromaOutrageShamanCount; +import mage.abilities.dynamicvalue.common.ChromaCount; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.ContinuousEffect; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.hint.ValueHint; import mage.abilities.keyword.HasteAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.filter.common.FilterControlledPermanent; -import mage.game.Game; +import mage.constants.ManaType; +import mage.constants.SubType; + +import java.util.UUID; /** - * * @author jeffwadsworth - * */ public final class HeartlashCinder extends CardImpl { @@ -40,13 +35,14 @@ public final class HeartlashCinder extends CardImpl { this.addAbility(HasteAbility.getInstance()); // Chroma - When Heartlash Cinder enters the battlefield, it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control. - ContinuousEffect effect = new BoostSourceEffect(new ChromaHeartlashCinderCount(), StaticValue.get(0), Duration.EndOfTurn, true); + DynamicValue xValue = new ChromaCount(ManaType.RED); + ContinuousEffect effect = new BoostSourceEffect(xValue, StaticValue.get(0), Duration.EndOfTurn, true); effect.setText("it gets +X/+0 until end of turn, where X is the number of red mana symbols in the mana costs of permanents you control"); this.addAbility(new EntersBattlefieldTriggeredAbility( effect, false) .withFlavorWord("Chroma") + .addHint(new ValueHint("Red mana symbols in your permanents", xValue)) ); - } private HeartlashCinder(final HeartlashCinder card) { @@ -58,32 +54,3 @@ public final class HeartlashCinder extends CardImpl { return new HeartlashCinder(this); } } - -class ChromaHeartlashCinderCount implements DynamicValue { - - private int chroma; - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - chroma = 0; - for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { - chroma += card.getManaCost().getMana().getRed(); - } - return chroma; - } - - @Override - public DynamicValue copy() { - return new ChromaOutrageShamanCount(); - } - - @Override - public String toString() { - return "1"; - } - - @Override - public String getMessage() { - return ""; - } -} diff --git a/Mage.Sets/src/mage/cards/o/OutrageShaman.java b/Mage.Sets/src/mage/cards/o/OutrageShaman.java index 9a9e56f9b2..cd3cb95701 100644 --- a/Mage.Sets/src/mage/cards/o/OutrageShaman.java +++ b/Mage.Sets/src/mage/cards/o/OutrageShaman.java @@ -1,28 +1,29 @@ - package mage.cards.o; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.dynamicvalue.common.ChromaOutrageShamanCount; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ChromaCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.hint.ValueHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.ManaType; import mage.constants.SubType; import mage.target.common.TargetCreaturePermanent; -/** - * - * @author jeffwadsworth +import java.util.UUID; +/** + * @author jeffwadsworth */ public final class OutrageShaman extends CardImpl { public OutrageShaman(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.subtype.add(SubType.GOBLIN); this.subtype.add(SubType.SHAMAN); @@ -30,13 +31,15 @@ public final class OutrageShaman extends CardImpl { this.toughness = new MageInt(2); // Chroma - When Outrage Shaman enters the battlefield, it deals damage to target creature equal to the number of red mana symbols in the mana costs of permanents you control. - Effect effect = new DamageTargetEffect(new ChromaOutrageShamanCount()); + DynamicValue xValue = new ChromaCount(ManaType.RED); + Effect effect = new DamageTargetEffect(xValue); effect.setText("it deals damage to target creature equal to the number of red mana symbols in the mana costs of permanents you control"); Ability ability = new EntersBattlefieldTriggeredAbility(effect, false); ability.addTarget(new TargetCreaturePermanent()); ability.withFlavorWord("Chroma"); + ability.addHint(new ValueHint("Red mana symbols in your permanents", xValue)); this.addAbility(ability); - + } private OutrageShaman(final OutrageShaman card) { diff --git a/Mage.Sets/src/mage/cards/p/PhosphorescentFeast.java b/Mage.Sets/src/mage/cards/p/PhosphorescentFeast.java index 6012647064..55a2bb9fd8 100644 --- a/Mage.Sets/src/mage/cards/p/PhosphorescentFeast.java +++ b/Mage.Sets/src/mage/cards/p/PhosphorescentFeast.java @@ -1,15 +1,9 @@ - package mage.cards.p; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.Cards; -import mage.cards.CardsImpl; +import mage.cards.*; import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.FilterCard; @@ -17,16 +11,15 @@ import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInHand; +import java.util.UUID; + /** - * * @author jeffwadsworth - * */ public final class PhosphorescentFeast extends CardImpl { public PhosphorescentFeast(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}{G}{G}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}{G}{G}"); // Chroma - Reveal any number of cards in your hand. You gain 2 life for each green mana symbol in those cards' mana costs. Effect effect = new PhosphorescentFeastEffect(); diff --git a/Mage.Sets/src/mage/cards/p/Primalcrux.java b/Mage.Sets/src/mage/cards/p/Primalcrux.java index 1cc623a1e0..9f43f16962 100644 --- a/Mage.Sets/src/mage/cards/p/Primalcrux.java +++ b/Mage.Sets/src/mage/cards/p/Primalcrux.java @@ -1,33 +1,26 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ChromaCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.hint.ValueHint; import mage.abilities.keyword.TrampleAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Zone; -import mage.filter.common.FilterControlledPermanent; -import mage.game.Game; +import mage.constants.*; + +import java.util.UUID; /** - * * @author jeffwadsworth - * */ public final class Primalcrux extends CardImpl { public Primalcrux(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{G}{G}{G}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{G}{G}{G}{G}{G}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(0); @@ -37,9 +30,12 @@ public final class Primalcrux extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Chroma - Primalcrux's power and toughness are each equal to the number of green mana symbols in the mana costs of permanents you control. - Effect effect = new SetPowerToughnessSourceEffect(new ChromaPrimalcruxCount(), Duration.WhileOnBattlefield); + DynamicValue xValue = new ChromaCount(ManaType.GREEN); + Effect effect = new SetPowerToughnessSourceEffect(xValue, Duration.WhileOnBattlefield); effect.setText("Chroma — Primalcrux's power and toughness are each equal to the number of green mana symbols in the mana costs of permanents you control."); - this.addAbility(new SimpleStaticAbility(Zone.ALL, effect)); + this.addAbility(new SimpleStaticAbility(Zone.ALL, effect) + .addHint(new ValueHint("Green mana symbols in your permanents", xValue)) + ); } private Primalcrux(final Primalcrux card) { @@ -51,32 +47,3 @@ public final class Primalcrux extends CardImpl { return new Primalcrux(this); } } - -class ChromaPrimalcruxCount implements DynamicValue { - - private int chroma; - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - chroma = 0; - for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { - chroma += card.getManaCost().getMana().getGreen(); - } - return chroma; - } - - @Override - public DynamicValue copy() { - return new ChromaPrimalcruxCount(); - } - - @Override - public String toString() { - return "1"; - } - - @Override - public String getMessage() { - return ""; - } -} diff --git a/Mage.Sets/src/mage/cards/s/SpringjackShepherd.java b/Mage.Sets/src/mage/cards/s/SpringjackShepherd.java index 0f7a9424cf..0c1fe8cbdd 100644 --- a/Mage.Sets/src/mage/cards/s/SpringjackShepherd.java +++ b/Mage.Sets/src/mage/cards/s/SpringjackShepherd.java @@ -1,31 +1,28 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.ChromaCount; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.ValueHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.ManaType; import mage.constants.SubType; -import mage.filter.FilterPermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.game.permanent.token.GoatToken; +import java.util.UUID; + /** - * * @author jeffwadsworth - * */ public final class SpringjackShepherd extends CardImpl { public SpringjackShepherd(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.KITHKIN); this.subtype.add(SubType.WIZARD); @@ -33,11 +30,13 @@ public final class SpringjackShepherd extends CardImpl { this.toughness = new MageInt(2); // Chroma - When Springjack Shepherd enters the battlefield, create a 0/1 white Goat creature token for each white mana symbol in the mana costs of permanents you control. - Effect effect = new CreateTokenEffect(new GoatToken(), new ChromaSpringjackShepherdCount()); + DynamicValue xValue = new ChromaCount(ManaType.WHITE); + Effect effect = new CreateTokenEffect(new GoatToken(), xValue); effect.setText("create a 0/1 white Goat creature token for each white mana symbol in the mana costs of permanents you control."); this.addAbility(new EntersBattlefieldTriggeredAbility( effect, false) .withFlavorWord("Chroma") + .addHint(new ValueHint("White mana symbols in your permanents", xValue)) ); } @@ -49,31 +48,4 @@ public final class SpringjackShepherd extends CardImpl { public SpringjackShepherd copy() { return new SpringjackShepherd(this); } -} - -class ChromaSpringjackShepherdCount implements DynamicValue { - - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - int chroma = 0; - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterPermanent(), sourceAbility.getControllerId(), game)) { - chroma += permanent.getManaCost().getMana().getWhite(); - } - return chroma; - } - - @Override - public DynamicValue copy() { - return new ChromaSpringjackShepherdCount(); - } - - @Override - public String toString() { - return "1"; - } - - @Override - public String getMessage() { - return ""; - } -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/u/UmbraStalker.java b/Mage.Sets/src/mage/cards/u/UmbraStalker.java index 20901ddc6e..4674191b5b 100644 --- a/Mage.Sets/src/mage/cards/u/UmbraStalker.java +++ b/Mage.Sets/src/mage/cards/u/UmbraStalker.java @@ -1,42 +1,43 @@ - package mage.cards.u; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.hint.ValueHint; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** - * * @author jeffwadsworth - * */ public final class UmbraStalker extends CardImpl { public UmbraStalker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{B}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(0); this.toughness = new MageInt(0); // Chroma - Umbra Stalker's power and toughness are each equal to the number of black mana symbols in the mana costs of cards in your graveyard. - Effect effect = new SetPowerToughnessSourceEffect(new ChromaUmbraStalkerCount(), Duration.WhileOnBattlefield); + DynamicValue xValue = new ChromaUmbraStalkerCount(); + Effect effect = new SetPowerToughnessSourceEffect(xValue, Duration.WhileOnBattlefield); effect.setText("Chroma — Umbra Stalker's power and toughness are each equal to the number of black mana symbols in the mana costs of cards in your graveyard."); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); - + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect) + .addHint(new ValueHint("Black mana symbols in your graveyard's permanents", xValue)) + ); } private UmbraStalker(final UmbraStalker card) { @@ -51,11 +52,9 @@ public final class UmbraStalker extends CardImpl { class ChromaUmbraStalkerCount implements DynamicValue { - private int chroma; - @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - chroma = 0; + int chroma = 0; Player you = game.getPlayer(sourceAbility.getControllerId()); if (you == null) { return 0; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaOutrageShamanCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaCount.java similarity index 56% rename from Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaOutrageShamanCount.java rename to Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaCount.java index 424b88fc14..f5f28a958c 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaOutrageShamanCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/ChromaCount.java @@ -4,28 +4,38 @@ import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; import mage.cards.Card; +import mage.constants.ManaType; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; /** - * Created by Eric on 9/24/2016. + * @author JayDi85 */ -public class ChromaOutrageShamanCount implements DynamicValue { +public class ChromaCount implements DynamicValue { - private int chroma; + private final ManaType needManaType; + + public ChromaCount(ManaType needManaType) { + this.needManaType = needManaType; + } + + private ChromaCount(final ChromaCount dynamicValue) { + super(); + this.needManaType = dynamicValue.needManaType; + } @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - chroma = 0; + int chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { - chroma += card.getManaCost().getMana().getRed(); + chroma += card.getManaCost().getMana().get(this.needManaType); } return chroma; } @Override - public DynamicValue copy() { - return new ChromaOutrageShamanCount(); + public ChromaCount copy() { + return new ChromaCount(this); } @Override @@ -37,4 +47,5 @@ public class ChromaOutrageShamanCount implements DynamicValue { public String getMessage() { return ""; } -} + +} \ No newline at end of file