From 0bbacc2a49cc7286a9bc1937371929050ebd1457 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 3 Jan 2020 11:36:08 -0500 Subject: [PATCH] Implemented Stinging Lionfish --- .../src/mage/cards/s/StingingLionfish.java | 85 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 86 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StingingLionfish.java diff --git a/Mage.Sets/src/mage/cards/s/StingingLionfish.java b/Mage.Sets/src/mage/cards/s/StingingLionfish.java new file mode 100644 index 0000000000..4a885ea730 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StingingLionfish.java @@ -0,0 +1,85 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.MayTapOrUntapTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.target.common.TargetNonlandPermanent; +import mage.watchers.common.SpellsCastWatcher; + +import java.util.List; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class StingingLionfish extends CardImpl { + + public StingingLionfish(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.FISH); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever you cast your first spell during each opponent's turn, you may tap or untap target nonland permanent. + this.addAbility(new StingingLionfishTriggeredAbility(), new SpellsCastWatcher()); + } + + private StingingLionfish(final StingingLionfish card) { + super(card); + } + + @Override + public StingingLionfish copy() { + return new StingingLionfish(this); + } +} + +class StingingLionfishTriggeredAbility extends SpellCastControllerTriggeredAbility { + + StingingLionfishTriggeredAbility() { + super(new MayTapOrUntapTargetEffect(), false); + this.addTarget(new TargetNonlandPermanent()); + } + + private StingingLionfishTriggeredAbility(StingingLionfishTriggeredAbility ability) { + super(ability); + } + + @Override + public StingingLionfishTriggeredAbility copy() { + return new StingingLionfishTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (game.getActivePlayerId().equals(this.getControllerId()) // ignore controller turn + || !super.checkTrigger(event, game)) { + return false; + } + + if (!game.getOpponents(this.getControllerId()).contains(game.getActivePlayerId())) { + return false; + } + + SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class); + if (watcher == null) { + return false; + } + + List spells = watcher.getSpellsCastThisTurn(event.getPlayerId()); + return spells != null && spells.size() == 1; + } + + @Override + public String getRule() { + return "Whenever you cast your first spell during each opponent's turn, you mat tap or untap target permanent."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 752d77acb6..6cfd08ea77 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -93,6 +93,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Setessan Petitioner", 199, Rarity.UNCOMMON, mage.cards.s.SetessanPetitioner.class)); cards.add(new SetCardInfo("Sphinx Mindbreaker", 290, Rarity.RARE, mage.cards.s.SphinxMindbreaker.class)); cards.add(new SetCardInfo("Staggering Insight", 228, Rarity.UNCOMMON, mage.cards.s.StaggeringInsight.class)); + cards.add(new SetCardInfo("Stinging Lionfish", 69, Rarity.UNCOMMON, mage.cards.s.StingingLionfish.class)); cards.add(new SetCardInfo("Storm's Wrath", 157, Rarity.RARE, mage.cards.s.StormsWrath.class)); cards.add(new SetCardInfo("Swamp", 252, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Sweet Oblivion", 70, Rarity.UNCOMMON, mage.cards.s.SweetOblivion.class));