[MAT] Implement Cosmic Rebirth

This commit is contained in:
theelk801 2023-05-03 09:56:43 -04:00
parent 0de3fb0cb6
commit 35a887d8e8
2 changed files with 74 additions and 0 deletions

View file

@ -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("<br>"));
}
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
);
}
}

View file

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