diff --git a/Mage.Sets/src/mage/cards/d/DiamondMare.java b/Mage.Sets/src/mage/cards/d/DiamondMare.java new file mode 100644 index 00000000000..a239e90d4a3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DiamondMare.java @@ -0,0 +1,86 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.effects.common.ChooseColorEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; + +/** + * + * @author TheElk801 + */ +public final class DiamondMare extends CardImpl { + + public DiamondMare(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + + this.subtype.add(SubType.HORSE); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // As Diamond Mare enters the battlefield, choose a color. + this.addAbility(new EntersBattlefieldAbility(new ChooseColorEffect(Outcome.Neutral))); + + // Whenever you cast a spell of the chosen color, you gain 1 life. + this.addAbility(new DiamondMareTriggeredAbility()); + } + + public DiamondMare(final DiamondMare card) { + super(card); + } + + @Override + public DiamondMare copy() { + return new DiamondMare(this); + } +} + +class DiamondMareTriggeredAbility extends TriggeredAbilityImpl { + + public DiamondMareTriggeredAbility() { + super(Zone.BATTLEFIELD, new GainLifeEffect(1), false); + } + + public DiamondMareTriggeredAbility(final DiamondMareTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getPlayerId().equals(this.getControllerId())) { + Spell spell = game.getStack().getSpell(event.getTargetId()); + ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); + if (spell != null && color != null && spell.getColor(game).shares(color)) { + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever you cast a spell of the chosen color, you gain 1 life."; + } + + @Override + public DiamondMareTriggeredAbility copy() { + return new DiamondMareTriggeredAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2019.java b/Mage.Sets/src/mage/sets/CoreSet2019.java index 45d37463a7e..fe6f729e96c 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2019.java +++ b/Mage.Sets/src/mage/sets/CoreSet2019.java @@ -63,6 +63,7 @@ public final class CoreSet2019 extends ExpansionSet { cards.add(new SetCardInfo("Declare Dominance", 175, Rarity.UNCOMMON, mage.cards.d.DeclareDominance.class)); cards.add(new SetCardInfo("Demon of Catastrophes", 91, Rarity.RARE, mage.cards.d.DemonOfCatastrophes.class)); cards.add(new SetCardInfo("Desecrated Tomb", 230, Rarity.RARE, mage.cards.d.DesecratedTomb.class)); + cards.add(new SetCardInfo("Diamond Mare", 231, Rarity.UNCOMMON, mage.cards.d.DiamondMare.class)); cards.add(new SetCardInfo("Diregraf Ghoul", 92, Rarity.UNCOMMON, mage.cards.d.DiregrafGhoul.class)); cards.add(new SetCardInfo("Disperse", 50, Rarity.COMMON, mage.cards.d.Disperse.class)); cards.add(new SetCardInfo("Divination", 51, Rarity.COMMON, mage.cards.d.Divination.class));