From 7dc8133eec6ae6f7794de693202179c2a3867b83 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 26 Mar 2021 07:01:14 -0400 Subject: [PATCH] [STX] Implemented Waterfall Aerialist --- .../src/mage/cards/w/WaterfallAerialist.java | 42 +++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + .../mage/abilities/keyword/WardAbility.java | 54 +++++++++++++++++++ Utils/keywords.txt | 1 + 4 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/w/WaterfallAerialist.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/WardAbility.java diff --git a/Mage.Sets/src/mage/cards/w/WaterfallAerialist.java b/Mage.Sets/src/mage/cards/w/WaterfallAerialist.java new file mode 100644 index 0000000000..75d092a7b1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WaterfallAerialist.java @@ -0,0 +1,42 @@ +package mage.cards.w; + +import mage.MageInt; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WaterfallAerialist extends CardImpl { + + public WaterfallAerialist(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); + + this.subtype.add(SubType.DJINN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Ward {2} + this.addAbility(new WardAbility(new ManaCostsImpl<>("{2}"))); + } + + private WaterfallAerialist(final WaterfallAerialist card) { + super(card); + } + + @Override + public WaterfallAerialist copy() { + return new WaterfallAerialist(this); + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 734dbfdd49..35f7a9317d 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -46,6 +46,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class)); cards.add(new SetCardInfo("Storm-Kiln Artist", 115, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class)); cards.add(new SetCardInfo("Vineglimmer Snarl", 274, Rarity.RARE, mage.cards.v.VineglimmerSnarl.class)); + cards.add(new SetCardInfo("Waterfall Aerialist", 61, Rarity.COMMON, mage.cards.w.WaterfallAerialist.class)); cards.add(new SetCardInfo("Witherbloom Command", 248, Rarity.RARE, mage.cards.w.WitherbloomCommand.class)); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/WardAbility.java b/Mage/src/main/java/mage/abilities/keyword/WardAbility.java new file mode 100644 index 0000000000..d3afdf848c --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/WardAbility.java @@ -0,0 +1,54 @@ +package mage.abilities.keyword; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.costs.Cost; +import mage.abilities.effects.common.CounterUnlessPaysEffect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.StackObject; +import mage.target.targetpointer.FixedTarget; + +/** + * @author TheElk801 + */ +public class WardAbility extends TriggeredAbilityImpl { + + public WardAbility(Cost cost) { + super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(cost), false); + } + + private WardAbility(final WardAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TARGETED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!getSourceId().equals(event.getTargetId())) { + return false; + } + StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); + if (stackObject == null || !game.getOpponents(getControllerId()).contains(stackObject.getControllerId())) { + return false; + } + getEffects().setTargetPointer(new FixedTarget(event.getSourceId(), game)); + return true; + } + + @Override + public WardAbility copy() { + return new WardAbility(this); + } + + @Override + public String getRule() { + return "Ward " + this.getCosts().getText() + + " (Whenever {this} becomes the target of a spell or ability an opponent controls, " + + "counter that spell or ability unless its controller pays " + this.getCosts().getText() + ")"; + } +} diff --git a/Utils/keywords.txt b/Utils/keywords.txt index 3b75c7c86b..f3724aab56 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -104,4 +104,5 @@ Undying|new| Unearth|cost| Unleash|new| Vigilance|instance| +Ward|cost| Wither|instance|