From 48a5dff33d0c7ad211fe5de51bb08f633d41b087 Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Sun, 3 Sep 2023 04:48:53 +0100 Subject: [PATCH] [WOC] Implement Songbirds' Blessing --- .../src/mage/cards/s/SongbirdsBlessing.java | 100 ++++++++++++++++++ .../mage/sets/WildsOfEldraineCommander.java | 2 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SongbirdsBlessing.java diff --git a/Mage.Sets/src/mage/cards/s/SongbirdsBlessing.java b/Mage.Sets/src/mage/cards/s/SongbirdsBlessing.java new file mode 100644 index 00000000000..00ea7b63330 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SongbirdsBlessing.java @@ -0,0 +1,100 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.AttacksAttachedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.*; +import mage.constants.*; +import mage.game.Game; +import mage.players.Library; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class SongbirdsBlessing extends CardImpl { + + public SongbirdsBlessing(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget); + this.addAbility(ability); + + // Whenever enchanted creature attacks, reveal cards from the top of your library until you reveal an Aura card. You may put that card onto the battlefield. + // If you don't, put it into your hand. Put the rest on the bottom of your library in a random order. + this.addAbility(new AttacksAttachedTriggeredAbility(new SongbirdsBlessingEffect(), AttachmentType.AURA, false)); + } + + private SongbirdsBlessing(final SongbirdsBlessing card) { + super(card); + } + + @Override + public SongbirdsBlessing copy() { + return new SongbirdsBlessing(this); + } +} + +class SongbirdsBlessingEffect extends OneShotEffect { + + SongbirdsBlessingEffect() { + super(Outcome.Benefit); + staticText = "reveal cards from the top of your library until you reveal an Aura card. You may put that card onto the battlefield. " + + "If you don't, put it into your hand. Put the rest on the bottom of your library in a random order."; + } + + private SongbirdsBlessingEffect(final SongbirdsBlessingEffect effect) { + super(effect); + } + + @Override + public SongbirdsBlessingEffect copy() { + return new SongbirdsBlessingEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Library library = player.getLibrary(); + if (!library.hasCards()) { + return true; + } + Cards cards = new CardsImpl(); + Card aura = null; + for (Card card : library.getCards(game)) { + cards.add(card); + if (card.hasSubtype(SubType.AURA, game)) { + aura = card; + break; + } + } + + player.revealCards(source, cards, game); + if (aura != null) { + if (player.chooseUse(outcome, "Put " + aura.getIdName() + " onto the battlefield?", source, game)) { + player.moveCards(aura, Zone.BATTLEFIELD, source, game); + } else { + player.moveCards(aura, Zone.HAND, source, game); + } + } + cards.remove(aura); + if (!cards.isEmpty()) { + player.putCardsOnBottomOfLibrary(cards, game, source, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java b/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java index ff4ec1fcb47..d28843c7d96 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraineCommander.java @@ -123,6 +123,8 @@ public final class WildsOfEldraineCommander extends ExpansionSet { cards.add(new SetCardInfo("Snake Umbra", 133, Rarity.UNCOMMON, mage.cards.s.SnakeUmbra.class)); cards.add(new SetCardInfo("Snap", 110, Rarity.COMMON, mage.cards.s.Snap.class)); cards.add(new SetCardInfo("Sol Ring", 149, Rarity.UNCOMMON, mage.cards.s.SolRing.class)); + cards.add(new SetCardInfo("Songbirds' Blessing", 7, Rarity.RARE, mage.cards.s.SongbirdsBlessing.class)); + cards.add(new SetCardInfo("Songbirds' Blessing", 43, Rarity.RARE, mage.cards.s.SongbirdsBlessing.class)); cards.add(new SetCardInfo("Sower of Temptation", 111, Rarity.RARE, mage.cards.s.SowerOfTemptation.class)); cards.add(new SetCardInfo("Spectral Steel", 75, Rarity.UNCOMMON, mage.cards.s.SpectralSteel.class)); cards.add(new SetCardInfo("Starfield Mystic", 76, Rarity.RARE, mage.cards.s.StarfieldMystic.class));