[WOE] Implement Faerie Slumber Party (#10949)

This commit is contained in:
Susucre 2023-08-31 01:16:08 +02:00 committed by GitHub
parent 2a5dd4103c
commit 2d9599fbbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 89 additions and 0 deletions

View file

@ -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<UUID> 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;
}
}

View file

@ -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));