diff --git a/Mage.Sets/src/mage/cards/c/CeruleanDrake.java b/Mage.Sets/src/mage/cards/c/CeruleanDrake.java new file mode 100644 index 0000000000..00cbafc41f --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CeruleanDrake.java @@ -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> { + instance; + + @Override + public boolean apply(ObjectPlayer 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())) + ); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 7cdad243c7..e27103ec6b 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -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));