From eedeb5c3251854d7472799dcd0a075f50e039daa Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 21 May 2025 10:33:34 -0400 Subject: [PATCH] [FIC] Implement Snort --- Mage.Sets/src/mage/cards/s/Snort.java | 98 +++++++++++++++++++ .../src/mage/sets/FinalFantasyCommander.java | 2 + 2 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/Snort.java diff --git a/Mage.Sets/src/mage/cards/s/Snort.java b/Mage.Sets/src/mage/cards/s/Snort.java new file mode 100644 index 00000000000..e615353e662 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/Snort.java @@ -0,0 +1,98 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Snort extends CardImpl { + + public Snort(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}"); + + // Each player may discard their hand and draw five cards. Then Snort deals 5 damage to each opponent who discarded their hand this way. + this.getSpellAbility().addEffect(new SnortEffect()); + + // Flashback {5}{R} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{5}{R}"))); + } + + private Snort(final Snort card) { + super(card); + } + + @Override + public Snort copy() { + return new Snort(this); + } +} + +class SnortEffect extends OneShotEffect { + + SnortEffect() { + super(Outcome.Benefit); + staticText = "each player may discard their hand and draw five cards. " + + "Then {this} deals 5 damage to each opponent who discarded their hand this way"; + } + + private SnortEffect(final SnortEffect effect) { + super(effect); + } + + @Override + public SnortEffect copy() { + return new SnortEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Set toDiscard = new HashSet<>(); + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } else if (player.chooseUse( + Outcome.DrawCard, + source.isControlledBy(playerId) + ? "Discard your hand and draw five cards?" + : "Discard your hand, draw five cards, and be dealt 5 damage?", + source, game + )) { + game.informPlayers(player.getLogName() + " chooses to discard and draw five"); + toDiscard.add(playerId); + } else { + game.informPlayers(player.getLogName() + " chooses not to discard"); + } + } + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Optional.ofNullable(playerId) + .filter(toDiscard::contains) + .map(game::getPlayer) + .ifPresent(player -> { + player.discard(player.getHand(), false, source, game); + player.drawCards(5, source, game); + }); + } + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Optional.ofNullable(playerId) + .filter(toDiscard::contains) + .map(game::getPlayer) + .ifPresent(player -> player.damage(5, source, game)); + } + return !toDiscard.isEmpty(); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index 810d12df9b6..b99c6de6953 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -284,6 +284,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Skycloud Expanse", 423, Rarity.RARE, mage.cards.s.SkycloudExpanse.class)); cards.add(new SetCardInfo("Slayers' Stronghold", 424, Rarity.RARE, mage.cards.s.SlayersStronghold.class)); cards.add(new SetCardInfo("Smoldering Marsh", 425, Rarity.RARE, mage.cards.s.SmolderingMarsh.class)); + cards.add(new SetCardInfo("Snort", 120, Rarity.RARE, mage.cards.s.Snort.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Snort", 58, Rarity.RARE, mage.cards.s.Snort.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Snuff Out", 285, Rarity.COMMON, mage.cards.s.SnuffOut.class)); cards.add(new SetCardInfo("Sol Ring", 356, Rarity.UNCOMMON, mage.cards.s.SolRing.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Sol Ring", 357, Rarity.UNCOMMON, mage.cards.s.SolRing.class, NON_FULL_USE_VARIOUS));