Implemented Diamond Knight

This commit is contained in:
Evan Kranzler 2019-06-21 13:01:01 -04:00
parent 96040a872f
commit 9abd150a7b
2 changed files with 76 additions and 0 deletions

View file

@ -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<ObjectSourcePlayer<MageObject>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<MageObject> 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";
}
}

View file

@ -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));