From 50bd1476ffc4f1f1c004be94af1b6639e1c8ec21 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 26 Apr 2022 22:17:08 -0400 Subject: [PATCH] [NCC] Implemented Spiteful Repossession --- .../mage/cards/s/SpitefulRepossession.java | 75 +++++++++++++++++++ .../src/mage/sets/NewCapennaCommander.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SpitefulRepossession.java diff --git a/Mage.Sets/src/mage/cards/s/SpitefulRepossession.java b/Mage.Sets/src/mage/cards/s/SpitefulRepossession.java new file mode 100644 index 0000000000..6876ddaee6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SpitefulRepossession.java @@ -0,0 +1,75 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SpitefulRepossession extends CardImpl { + + public SpitefulRepossession(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}"); + + // Spiteful Repossession deals damage to each opponent who controls more lands than you equal to the difference. Then create a number of Treasure tokens equal to the damage dealt this way. + this.getSpellAbility().addEffect(new SpitefulRepossessionEffect()); + } + + private SpitefulRepossession(final SpitefulRepossession card) { + super(card); + } + + @Override + public SpitefulRepossession copy() { + return new SpitefulRepossession(this); + } +} + +class SpitefulRepossessionEffect extends OneShotEffect { + + SpitefulRepossessionEffect() { + super(Outcome.Benefit); + staticText = "{this} deals damage to each opponent who controls more lands than you equal to the difference. " + + "Then create a number of Treasure tokens equal to the damage dealt this way"; + } + + private SpitefulRepossessionEffect(final SpitefulRepossessionEffect effect) { + super(effect); + } + + @Override + public SpitefulRepossessionEffect copy() { + return new SpitefulRepossessionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int controlledLands = game.getBattlefield().count(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), source, game); + int damageDealt = 0; + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + int lands = game.getBattlefield().count(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, opponentId, source, game); + if (lands <= controlledLands) { + continue; + } + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + damageDealt += opponent.damage(lands - controlledLands, source, game); + } + } + if (damageDealt > 0) { + new TreasureToken().putOntoBattlefield(damageDealt, game, source); + } + return true; + + } +} diff --git a/Mage.Sets/src/mage/sets/NewCapennaCommander.java b/Mage.Sets/src/mage/sets/NewCapennaCommander.java index 8dc0054b3b..ec4442051f 100644 --- a/Mage.Sets/src/mage/sets/NewCapennaCommander.java +++ b/Mage.Sets/src/mage/sets/NewCapennaCommander.java @@ -258,6 +258,7 @@ public final class NewCapennaCommander extends ExpansionSet { cards.add(new SetCardInfo("Solemn Simulacrum", 380, Rarity.RARE, mage.cards.s.SolemnSimulacrum.class)); cards.add(new SetCardInfo("Spellbinding Soprano", 53, Rarity.RARE, mage.cards.s.SpellbindingSoprano.class)); cards.add(new SetCardInfo("Spinerock Knoll", 429, Rarity.RARE, mage.cards.s.SpinerockKnoll.class)); + cards.add(new SetCardInfo("Spiteful Repossession", 90, Rarity.RARE, mage.cards.s.SpitefulRepossession.class)); cards.add(new SetCardInfo("Squee, the Immortal", 275, Rarity.RARE, mage.cards.s.SqueeTheImmortal.class)); cards.add(new SetCardInfo("Stalking Vengeance", 276, Rarity.RARE, mage.cards.s.StalkingVengeance.class)); cards.add(new SetCardInfo("Steelbane Hydra", 313, Rarity.RARE, mage.cards.s.SteelbaneHydra.class));