From 35a887d8e805d67f6a86672ccd1c3cc695f1dc6b Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 3 May 2023 09:56:43 -0400 Subject: [PATCH] [MAT] Implement Cosmic Rebirth --- Mage.Sets/src/mage/cards/c/CosmicRebirth.java | 73 +++++++++++++++++++ .../sets/MarchOfTheMachineTheAftermath.java | 1 + 2 files changed, 74 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CosmicRebirth.java diff --git a/Mage.Sets/src/mage/cards/c/CosmicRebirth.java b/Mage.Sets/src/mage/cards/c/CosmicRebirth.java new file mode 100644 index 0000000000..ea7bd4fda1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CosmicRebirth.java @@ -0,0 +1,73 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CosmicRebirth extends CardImpl { + + public CosmicRebirth(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{W}"); + + // Choose target permanent card in your graveyard. If it has mana value 3 or less, you may put it onto the battlefield. If you don't put it onto the battlefield, put it into your hand. + this.getSpellAbility().addEffect(new CosmicRebirthEffect()); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_PERMANENT)); + + // You gain 3 life. + this.getSpellAbility().addEffect(new GainLifeEffect(3).concatBy("
")); + } + + private CosmicRebirth(final CosmicRebirth card) { + super(card); + } + + @Override + public CosmicRebirth copy() { + return new CosmicRebirth(this); + } +} + +class CosmicRebirthEffect extends OneShotEffect { + + CosmicRebirthEffect() { + super(Outcome.Benefit); + staticText = "choose target permanent card in your graveyard. If it has mana value 3 or less, " + + "you may put it onto the battlefield. If you don't put it onto the battlefield, put it into your hand"; + } + + private CosmicRebirthEffect(final CosmicRebirthEffect effect) { + super(effect); + } + + @Override + public CosmicRebirthEffect copy() { + return new CosmicRebirthEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + return player != null && card != null && player.moveCards( + card, card.getManaValue() <= 3 && player.chooseUse( + Outcome.PutCardInPlay, "Put it onto the battlefield or your hand?", + null, "Battlefield", "Hand", source, game + ) ? Zone.BATTLEFIELD : Zone.HAND, source, game + ); + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java index a171c6fa4f..77e0d26d52 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java @@ -23,6 +23,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet { cards.add(new SetCardInfo("Campus Renovation", 27, Rarity.UNCOMMON, mage.cards.c.CampusRenovation.class)); cards.add(new SetCardInfo("Coppercoat Vanguard", 1, Rarity.UNCOMMON, mage.cards.c.CoppercoatVanguard.class)); + cards.add(new SetCardInfo("Cosmic Rebirth", 28, Rarity.UNCOMMON, mage.cards.c.CosmicRebirth.class)); cards.add(new SetCardInfo("Drannith Ruins", 50, Rarity.RARE, mage.cards.d.DrannithRuins.class)); cards.add(new SetCardInfo("Feast of the Victorious Dead", 30, Rarity.UNCOMMON, mage.cards.f.FeastOfTheVictoriousDead.class)); cards.add(new SetCardInfo("Filter Out", 7, Rarity.UNCOMMON, mage.cards.f.FilterOut.class));