Implemented Cerulean Drake

This commit is contained in:
Evan Kranzler 2019-06-20 20:24:58 -04:00
parent 1ff0f47829
commit 930504bee0
2 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.c;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CeruleanDrake extends CardImpl {
private static final FilterSpell filter = new FilterSpell("spell that targets you");
static {
filter.add(CeruleanDrakePredicate.instance);
}
public CeruleanDrake(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.DRAKE);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Protection from red
this.addAbility(ProtectionAbility.from(ObjectColor.RED));
// Sacrifice Cerulean Drake: Counter target spell that targets you.
Ability ability = new SimpleActivatedAbility(new CounterTargetEffect(), new SacrificeSourceCost());
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
private CeruleanDrake(final CeruleanDrake card) {
super(card);
}
@Override
public CeruleanDrake copy() {
return new CeruleanDrake(this);
}
}
enum CeruleanDrakePredicate implements ObjectPlayerPredicate<ObjectPlayer<StackObject>> {
instance;
@Override
public boolean apply(ObjectPlayer<StackObject> input, Game game) {
if (input.getPlayerId() == null) {
return false;
}
return input
.getObject()
.getStackAbility()
.getTargets()
.stream()
.anyMatch(
target -> target
.getTargets()
.stream()
.anyMatch(uuid -> uuid != null && uuid.equals(input.getPlayerId()))
);
}
}

View file

@ -36,6 +36,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Bloodthirsty Aerialist", 91, Rarity.UNCOMMON, mage.cards.b.BloodthirstyAerialist.class));
cards.add(new SetCardInfo("Bone Splinters", 92, Rarity.COMMON, mage.cards.b.BoneSplinters.class));
cards.add(new SetCardInfo("Captivating Gyre", 51, Rarity.UNCOMMON, mage.cards.c.CaptivatingGyre.class));
cards.add(new SetCardInfo("Cerulean Drake", 53, Rarity.UNCOMMON, mage.cards.c.CeruleanDrake.class));
cards.add(new SetCardInfo("Chandra's Embercat", 129, Rarity.COMMON, mage.cards.c.ChandrasEmbercat.class));
cards.add(new SetCardInfo("Chandra's Spitfire", 132, Rarity.UNCOMMON, mage.cards.c.ChandrasSpitfire.class));
cards.add(new SetCardInfo("Chandra, Acolyte of Flame", 126, Rarity.RARE, mage.cards.c.ChandraAcolyteOfFlame.class));