From 520528293ab53d6385d7255c2b23c8a6f38ab70e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 12 Sep 2021 13:51:47 -0400 Subject: [PATCH] [MID] Implemented Seize the Storm --- Mage.Sets/src/mage/cards/s/SeizeTheStorm.java | 80 +++++++++++++++++++ .../src/mage/sets/InnistradMidnightHunt.java | 1 + .../permanent/token/SeizeTheStormToken.java | 43 ++++++++++ 3 files changed, 124 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SeizeTheStorm.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/SeizeTheStormToken.java diff --git a/Mage.Sets/src/mage/cards/s/SeizeTheStorm.java b/Mage.Sets/src/mage/cards/s/SeizeTheStorm.java new file mode 100644 index 00000000000..420f316c59c --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SeizeTheStorm.java @@ -0,0 +1,80 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.SeizeTheStormToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SeizeTheStorm extends CardImpl { + + private static final Hint hint = new ValueHint( + "Spells in your graveyard and flashback cards in exile", SeizeTheStormValue.instance + ); + + public SeizeTheStorm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}"); + + // Create a red Elemental creature token with trample and "This creature's power and toughness are each equal to the number of instant and sorcery cards in your graveyard, plus the number of cards with flashback you own in exile." + this.getSpellAbility().addEffect(new CreateTokenEffect( + new SeizeTheStormToken(SeizeTheStormValue.instance, hint) + )); + this.getSpellAbility().addHint(hint); + + // Flashback {6}{R} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{6}{R}"))); + } + + private SeizeTheStorm(final SeizeTheStorm card) { + super(card); + } + + @Override + public SeizeTheStorm copy() { + return new SeizeTheStorm(this); + } +} + +enum SeizeTheStormValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + return player.getGraveyard().count( + StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game + ) + game.getExile() + .getAllCards(game, sourceAbility.getControllerId()) + .stream() + .filter(card -> card.getAbilities(game).containsClass(FlashbackAbility.class)) + .mapToInt(x -> 1).sum(); + } + + @Override + public SeizeTheStormValue copy() { + return this; + } + + @Override + public String getMessage() { + return "instant and sorcery cards in your graveyard, plus the number of cards with flashback you own in exile"; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index 9c796002846..24241a9e772 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -246,6 +246,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Seafaring Werewolf", 80, Rarity.RARE, mage.cards.s.SeafaringWerewolf.class)); cards.add(new SetCardInfo("Seasoned Cathar", 2, Rarity.UNCOMMON, mage.cards.s.SeasonedCathar.class)); cards.add(new SetCardInfo("Secrets of the Key", 73, Rarity.COMMON, mage.cards.s.SecretsOfTheKey.class)); + cards.add(new SetCardInfo("Seize the Storm", 158, Rarity.UNCOMMON, mage.cards.s.SeizeTheStorm.class)); cards.add(new SetCardInfo("Shadowbeast Sighting", 198, Rarity.COMMON, mage.cards.s.ShadowbeastSighting.class)); cards.add(new SetCardInfo("Shady Traveler", 120, Rarity.COMMON, mage.cards.s.ShadyTraveler.class)); cards.add(new SetCardInfo("Shipwreck Marsh", 267, Rarity.RARE, mage.cards.s.ShipwreckMarsh.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/SeizeTheStormToken.java b/Mage/src/main/java/mage/game/permanent/token/SeizeTheStormToken.java new file mode 100644 index 00000000000..35004de4eef --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/SeizeTheStormToken.java @@ -0,0 +1,43 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class SeizeTheStormToken extends TokenImpl { + + public SeizeTheStormToken(DynamicValue xValue, Hint hint) { + super("Elemental", "red Elemental creature token with trample and " + + "\"This creature's power and toughness are each equal to the number of instant " + + "and sorcery cards in your graveyard, plus the number of cards with flashback you own in exile.\""); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add(SubType.ELEMENTAL); + power = new MageInt(0); + toughness = new MageInt(0); + this.addAbility(TrampleAbility.getInstance()); + this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect( + xValue, Duration.WhileOnBattlefield + ).setText("this creature's power and toughness are each equal to the number of " + + "instant and sorcery cards in your graveyard, plus the number of cards with flashback you own in exile") + ).addHint(hint)); + } + + private SeizeTheStormToken(final SeizeTheStormToken token) { + super(token); + } + + @Override + public SeizeTheStormToken copy() { + return new SeizeTheStormToken(this); + } +}