From 7e86626f1d19cb4c8434559a69ae893ed473e02c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 12 Apr 2020 17:21:25 -0400 Subject: [PATCH] Implemented Shark Typhoon --- Mage.Sets/src/mage/cards/s/SharkTyphoon.java | 114 ++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + .../mage/game/permanent/token/SharkToken.java | 31 +++++ 3 files changed, 146 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SharkTyphoon.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/SharkToken.java diff --git a/Mage.Sets/src/mage/cards/s/SharkTyphoon.java b/Mage.Sets/src/mage/cards/s/SharkTyphoon.java new file mode 100644 index 0000000000..7d5ed59942 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SharkTyphoon.java @@ -0,0 +1,114 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.common.ZoneChangeTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.token.SharkToken; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SharkTyphoon extends CardImpl { + + public SharkTyphoon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{U}"); + + // Whenever you cast a noncreature spell, create an X/X blue Shark creature token with flying, where X is that spell's converted mana cost. + this.addAbility(new SpellCastControllerTriggeredAbility( + new SharkTyphoonCastEffect(), StaticFilters.FILTER_SPELL_A_NON_CREATURE, true + )); + + // Cycling {X}{1}{U} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{X}{1}{U}"))); + + // When you cycle Shark Typhoon, create an X/X blue Shark creature token with flying. + this.addAbility(new SharkTyphoonTriggeredAbility()); + } + + private SharkTyphoon(final SharkTyphoon card) { + super(card); + } + + @Override + public SharkTyphoon copy() { + return new SharkTyphoon(this); + } +} + +class SharkTyphoonCastEffect extends OneShotEffect { + + SharkTyphoonCastEffect() { + super(Outcome.Benefit); + staticText = "create an X/X blue Shark creature token with flying, where X is that spell's converted mana cost"; + } + + private SharkTyphoonCastEffect(final SharkTyphoonCastEffect effect) { + super(effect); + } + + @Override + public SharkTyphoonCastEffect copy() { + return new SharkTyphoonCastEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getSpell(targetPointer.getFirst(game, source)); + int xValue = 0; + if (spell != null) { + xValue = spell.getConvertedManaCost(); + } + return new SharkToken(xValue).putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } +} + +class SharkTyphoonTriggeredAbility extends ZoneChangeTriggeredAbility { + + SharkTyphoonTriggeredAbility() { + super(Zone.ALL, null, "When you cycle {this}, ", false); + } + + private SharkTyphoonTriggeredAbility(SharkTyphoonTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!event.getSourceId().equals(this.getSourceId())) { + return false; + } + StackObject object = game.getStack().getStackObject(event.getSourceId()); + if (object == null || !(object.getStackAbility() instanceof CyclingAbility)) { + return false; + } + this.getEffects().clear(); + this.addEffect(new CreateTokenEffect(new SharkToken(object.getManaCost().getX()))); + return true; + } + + @Override + public SharkTyphoonTriggeredAbility copy() { + return new SharkTyphoonTriggeredAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index 5009f9afa8..5d511c0fb5 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -259,6 +259,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Scoured Barrens", 254, Rarity.COMMON, mage.cards.s.ScouredBarrens.class)); cards.add(new SetCardInfo("Sea-Dasher Octopus", 66, Rarity.RARE, mage.cards.s.SeaDasherOctopus.class)); cards.add(new SetCardInfo("Serrated Scorpion", 99, Rarity.COMMON, mage.cards.s.SerratedScorpion.class)); + cards.add(new SetCardInfo("Shark Typhoon", 67, Rarity.RARE, mage.cards.s.SharkTyphoon.class)); cards.add(new SetCardInfo("Shredded Sails", 136, Rarity.COMMON, mage.cards.s.ShreddedSails.class)); cards.add(new SetCardInfo("Skull Prophet", 206, Rarity.UNCOMMON, mage.cards.s.SkullProphet.class)); cards.add(new SetCardInfo("Skycat Sovereign", 207, Rarity.RARE, mage.cards.s.SkycatSovereign.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/SharkToken.java b/Mage/src/main/java/mage/game/permanent/token/SharkToken.java new file mode 100644 index 0000000000..d5c6f6e818 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/SharkToken.java @@ -0,0 +1,31 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class SharkToken extends TokenImpl { + + public SharkToken(int xValue) { + super("Shark", "X/X blue Shark creature token with flying"); + cardType.add(CardType.CREATURE); + color.setBlue(true); + subtype.add(SubType.SHARK); + power = new MageInt(xValue); + toughness = new MageInt(xValue); + addAbility(FlyingAbility.getInstance()); + } + + private SharkToken(final SharkToken token) { + super(token); + } + + @Override + public SharkToken copy() { + return new SharkToken(this); + } +}