[BLB] Implement Starfall Invocation. (#12807)

This commit is contained in:
Grath 2024-09-05 22:55:31 -04:00 committed by GitHub
parent c2f4e7ba08
commit 12f9ad8cdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 87 additions and 0 deletions

View file

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

View file

@ -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 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("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("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("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("Stargaze", 114, Rarity.UNCOMMON, mage.cards.s.Stargaze.class));
cards.add(new SetCardInfo("Starlit Soothsayer", 115, Rarity.COMMON, mage.cards.s.StarlitSoothsayer.class)); cards.add(new SetCardInfo("Starlit Soothsayer", 115, Rarity.COMMON, mage.cards.s.StarlitSoothsayer.class));