From 12f9ad8cdb186015cde22ee4ef7ffb85004be470 Mon Sep 17 00:00:00 2001 From: Grath <1895280+Grath@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:55:31 -0400 Subject: [PATCH] [BLB] Implement Starfall Invocation. (#12807) --- .../src/mage/cards/s/StarfallInvocation.java | 86 +++++++++++++++++++ Mage.Sets/src/mage/sets/Bloomburrow.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StarfallInvocation.java diff --git a/Mage.Sets/src/mage/cards/s/StarfallInvocation.java b/Mage.Sets/src/mage/cards/s/StarfallInvocation.java new file mode 100644 index 00000000000..c0afaf2ef1f --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StarfallInvocation.java @@ -0,0 +1,86 @@ +package mage.cards.s; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.condition.common.GiftWasPromisedCondition; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.GiftAbility; +import mage.cards.*; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author Grath + */ +public final class StarfallInvocation extends CardImpl { + + public StarfallInvocation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{W}{W}"); + + + // Gift a card + this.addAbility(new GiftAbility(this, GiftType.CARD)); + + // Destroy all creatures. If the gift was promised, return a creature card put into your graveyard this way to the battlefield under your control. + this.getSpellAbility().addEffect(new StarfallInvocationEffect()); + } + + private StarfallInvocation(final StarfallInvocation card) { + super(card); + } + + @Override + public StarfallInvocation copy() { + return new StarfallInvocation(this); + } +} + +class StarfallInvocationEffect extends OneShotEffect { + + StarfallInvocationEffect() { + super(Outcome.DestroyPermanent); + staticText = "destroy all creatures. If the gift was promised, return a creature card put into your " + + "graveyard this way to the battlefield under your control"; + } + + private StarfallInvocationEffect(final StarfallInvocationEffect effect) { + super(effect); + } + + @Override + public StarfallInvocationEffect copy() { + return new StarfallInvocationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Cards yourCreatureCards = new CardsImpl(); + + Player controller = game.getPlayer(source.getControllerId()); + + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) { + if (permanent != null && permanent.destroy(source, game, false)) { + if (controller != null && permanent.isOwnedBy(controller.getId())) { + yourCreatureCards.add(permanent); + } + } + } + + if (controller != null && GiftWasPromisedCondition.TRUE.apply(game, source)) { + TargetCard target = new TargetCardInYourGraveyard(); + controller.choose(Outcome.PutCreatureInPlay, yourCreatureCards, target, source, game); + Card targetCard = game.getCard(target.getFirstTarget()); + if (targetCard != null) { + controller.moveCards(targetCard, Zone.BATTLEFIELD, source, game); + } + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index c9792eed2be..d5534f25133 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -229,6 +229,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Splash Lasher", 73, Rarity.UNCOMMON, mage.cards.s.SplashLasher.class)); cards.add(new SetCardInfo("Splash Portal", 74, Rarity.UNCOMMON, mage.cards.s.SplashPortal.class)); cards.add(new SetCardInfo("Star Charter", 33, Rarity.UNCOMMON, mage.cards.s.StarCharter.class)); + cards.add(new SetCardInfo("Starfall Invocation", 34, Rarity.RARE, mage.cards.s.StarfallInvocation.class)); cards.add(new SetCardInfo("Starforged Sword", 249, Rarity.UNCOMMON, mage.cards.s.StarforgedSword.class)); cards.add(new SetCardInfo("Stargaze", 114, Rarity.UNCOMMON, mage.cards.s.Stargaze.class)); cards.add(new SetCardInfo("Starlit Soothsayer", 115, Rarity.COMMON, mage.cards.s.StarlitSoothsayer.class));