From 9abd150a7b6bc0f1e09040cb1be1e8e62140e037 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 21 Jun 2019 13:01:01 -0400 Subject: [PATCH] Implemented Diamond Knight --- Mage.Sets/src/mage/cards/d/DiamondKnight.java | 75 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DiamondKnight.java diff --git a/Mage.Sets/src/mage/cards/d/DiamondKnight.java b/Mage.Sets/src/mage/cards/d/DiamondKnight.java new file mode 100644 index 0000000000..adccd6c302 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DiamondKnight.java @@ -0,0 +1,75 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.MageObject; +import mage.ObjectColor; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.ChooseColorEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.FilterSpell; +import mage.filter.predicate.ObjectPlayerPredicate; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DiamondKnight extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a spell of the chosen color"); + + static { + filter.add(DiamondKnightPredicate.instance); + } + + public DiamondKnight(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); + + this.subtype.add(SubType.KNIGHT); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // As Diamond Knight enters the battlefield, choose a color. + this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit))); + + // Whenever you cast a spell of the chosen color, put a +1/+1 counter on Diamond Knight. + this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), filter, false)); + } + + private DiamondKnight(final DiamondKnight card) { + super(card); + } + + @Override + public DiamondKnight copy() { + return new DiamondKnight(this); + } +} + +enum DiamondKnightPredicate implements ObjectPlayerPredicate> { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + ObjectColor color = (ObjectColor) game.getState().getValue(input.getSourceId() + "_color"); + return input.getObject().getColor(game).shares(color); + } + + @Override + public String toString() { + return "Chosen color"; + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 66343b18f8..397d780f56 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -52,6 +52,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Cryptic Caves", 244, Rarity.UNCOMMON, mage.cards.c.CrypticCaves.class)); cards.add(new SetCardInfo("Destructive Digger", 134, Rarity.COMMON, mage.cards.d.DestructiveDigger.class)); cards.add(new SetCardInfo("Devout Decree", 13, Rarity.UNCOMMON, mage.cards.d.DevoutDecree.class)); + cards.add(new SetCardInfo("Diamond Knight", 224, Rarity.UNCOMMON, mage.cards.d.DiamondKnight.class)); cards.add(new SetCardInfo("Disenchant", 14, Rarity.COMMON, mage.cards.d.Disenchant.class)); cards.add(new SetCardInfo("Disfigure", 95, Rarity.UNCOMMON, mage.cards.d.Disfigure.class)); cards.add(new SetCardInfo("Dragon Mage", 135, Rarity.UNCOMMON, mage.cards.d.DragonMage.class));