From 2d9599fbbd1b1b8a92607b40bdc891bdd40becbc Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Thu, 31 Aug 2023 01:16:08 +0200 Subject: [PATCH] [WOE] Implement Faerie Slumber Party (#10949) --- .../src/mage/cards/f/FaerieSlumberParty.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/WildsOfEldraine.java | 1 + 2 files changed, 89 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FaerieSlumberParty.java diff --git a/Mage.Sets/src/mage/cards/f/FaerieSlumberParty.java b/Mage.Sets/src/mage/cards/f/FaerieSlumberParty.java new file mode 100644 index 00000000000..54b3ff08450 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FaerieSlumberParty.java @@ -0,0 +1,88 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect; +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.Permanent; +import mage.game.permanent.token.FaerieBlockFliersToken; +import mage.game.permanent.token.Token; + +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +/** + * + * @author Susucr + */ +public final class FaerieSlumberParty extends CardImpl { + + public FaerieSlumberParty(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}"); + + // Return all creatures to their owners' hands. For each opponent who controlled a creature returned this way, you create two 1/1 blue Faerie creature tokens with flying and "This creature can block only creatures with flying." + this.getSpellAbility().addEffect(new FaerieSlumberPartyEffect()); + } + + private FaerieSlumberParty(final FaerieSlumberParty card) { + super(card); + } + + @Override + public FaerieSlumberParty copy() { + return new FaerieSlumberParty(this); + } +} + +class FaerieSlumberPartyEffect extends OneShotEffect { + + FaerieSlumberPartyEffect() { + super(Outcome.Benefit); + this.staticText = "Return all creatures to their owners' hands. For each opponent who controlled a creature " + + "returned this way, you create two 1/1 blue Faerie creature tokens with flying and " + + "\"This creature can block only creatures with flying.\""; + } + + private FaerieSlumberPartyEffect(final FaerieSlumberPartyEffect effect) { + super(effect); + } + + @Override + public FaerieSlumberPartyEffect copy() { + return new FaerieSlumberPartyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Set opponents = game.getOpponents(source.getControllerId()); + int count = game.getBattlefield() + .getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game) + .stream() + .filter(Objects::nonNull) + .map(Permanent::getControllerId) + .distinct() + .filter(opponents::contains) + .mapToInt(id -> 1) + .sum(); + + if(!new ReturnToHandFromBattlefieldAllEffect(StaticFilters.FILTER_PERMANENT_CREATURE) + .apply(game, source)) { + return false; + } + + if(count > 0) { + Token token = new FaerieBlockFliersToken(); + token.putOntoBattlefield(2 * count, game, source, source.getControllerId()); + } + + return true; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraine.java b/Mage.Sets/src/mage/sets/WildsOfEldraine.java index 201b3ec1a8a..6ed327e8e6b 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraine.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraine.java @@ -90,6 +90,7 @@ public final class WildsOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Extraordinary Journey", 48, Rarity.RARE, mage.cards.e.ExtraordinaryJourney.class)); cards.add(new SetCardInfo("Faerie Dreamthief", 89, Rarity.UNCOMMON, mage.cards.f.FaerieDreamthief.class)); cards.add(new SetCardInfo("Faerie Fencing", 90, Rarity.UNCOMMON, mage.cards.f.FaerieFencing.class)); + cards.add(new SetCardInfo("Faerie Slumber Party", 371, Rarity.RARE, mage.cards.f.FaerieSlumberParty.class)); cards.add(new SetCardInfo("Farsight Ritual", 49, Rarity.RARE, mage.cards.f.FarsightRitual.class)); cards.add(new SetCardInfo("Faunsbane Troll", 203, Rarity.RARE, mage.cards.f.FaunsbaneTroll.class)); cards.add(new SetCardInfo("Feed the Cauldron", 91, Rarity.COMMON, mage.cards.f.FeedTheCauldron.class));