From a6597c692b48b7a985a4440741fd1a8a61f667d8 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 5 May 2023 19:55:16 -0400 Subject: [PATCH] [MAT] Implement Nashi, Moon's Legacy --- .../src/mage/cards/n/NashiMoonsLegacy.java | 101 ++++++++++++++++++ .../sets/MarchOfTheMachineTheAftermath.java | 1 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NashiMoonsLegacy.java diff --git a/Mage.Sets/src/mage/cards/n/NashiMoonsLegacy.java b/Mage.Sets/src/mage/cards/n/NashiMoonsLegacy.java new file mode 100644 index 0000000000..caa931f0a6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NashiMoonsLegacy.java @@ -0,0 +1,101 @@ +package mage.cards.n; + +import mage.ApprovingObject; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.abilities.keyword.WardAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NashiMoonsLegacy extends CardImpl { + + private static final FilterCard filter = new FilterCard("legendary or Rat card from your graveyard"); + + static { + filter.add(Predicates.or( + SuperType.LEGENDARY.getPredicate(), + SubType.RAT.getPredicate() + )); + } + + public NashiMoonsLegacy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.RAT); + this.subtype.add(SubType.SHAMAN); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Menace + this.addAbility(new MenaceAbility()); + + // Ward {1} + this.addAbility(new WardAbility(new ManaCostsImpl<>("{1}"), false)); + + // Whenever Nashi, Moon's Legacy attacks, exile up to one target legendary or Rat card from your graveyard and copy it. You may cast the copy. + Ability ability = new AttacksTriggeredAbility(new NashiMoonsLegacyEffect()); + ability.addTarget(new TargetCardInYourGraveyard(0, 1, filter)); + this.addAbility(ability); + } + + private NashiMoonsLegacy(final NashiMoonsLegacy card) { + super(card); + } + + @Override + public NashiMoonsLegacy copy() { + return new NashiMoonsLegacy(this); + } +} + +class NashiMoonsLegacyEffect extends OneShotEffect { + + NashiMoonsLegacyEffect() { + super(Outcome.Benefit); + staticText = "exile up to one target legendary or Rat card from your graveyard and copy it. You may cast the copy"; + } + + private NashiMoonsLegacyEffect(final NashiMoonsLegacyEffect effect) { + super(effect); + } + + @Override + public NashiMoonsLegacyEffect copy() { + return new NashiMoonsLegacyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Card card = game.getCard(getTargetPointer().getFirst(game, source)); + if (player == null || card == null) { + return false; + } + player.moveCards(card, Zone.EXILED, source, game); + Card copiedCard = game.copyCard(card, source, player.getId()); + game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE); + player.cast( + player.chooseAbilityForCast(copiedCard, game, false), + game, false, new ApprovingObject(source, game) + ); + game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java index b0afd700d5..6c85ae9463 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachineTheAftermath.java @@ -41,6 +41,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet { cards.add(new SetCardInfo("Markov Baron", 14, Rarity.UNCOMMON, mage.cards.m.MarkovBaron.class)); cards.add(new SetCardInfo("Metropolis Reformer", 4, Rarity.RARE, mage.cards.m.MetropolisReformer.class)); cards.add(new SetCardInfo("Narset, Enlightened Exile", 38, Rarity.MYTHIC, mage.cards.n.NarsetEnlightenedExile.class)); + cards.add(new SetCardInfo("Nashi, Moon's Legacy", 0039, Rarity.RARE, mage.cards.n.NashiMoonsLegacy.class)); cards.add(new SetCardInfo("Nissa, Resurgent Animist", 22, Rarity.MYTHIC, mage.cards.n.NissaResurgentAnimist.class)); cards.add(new SetCardInfo("Niv-Mizzet, Supreme", 40, Rarity.RARE, mage.cards.n.NivMizzetSupreme.class)); cards.add(new SetCardInfo("Open the Way", 23, Rarity.RARE, mage.cards.o.OpenTheWay.class));