From f467bba780e4a7cdba8aaf60053f3fb5439d59b9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Sep 2020 18:55:49 -0400 Subject: [PATCH] [ZNR] Implemented Nissa of Shadowed Boughs --- .../mage/cards/n/NissaOfShadowedBoughs.java | 160 ++++++++++++++++++ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + 2 files changed, 161 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NissaOfShadowedBoughs.java diff --git a/Mage.Sets/src/mage/cards/n/NissaOfShadowedBoughs.java b/Mage.Sets/src/mage/cards/n/NissaOfShadowedBoughs.java new file mode 100644 index 0000000000..5751c96eb8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NissaOfShadowedBoughs.java @@ -0,0 +1,160 @@ +package mage.cards.n; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.LandfallAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.custom.CreatureToken; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +import static mage.constants.Outcome.Benefit; + +/** + * @author TheElk801 + */ +public final class NissaOfShadowedBoughs extends CardImpl { + + public NissaOfShadowedBoughs(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.NISSA); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); + + // Landfall — Whenever a land enters the battlefield under your control, put a loyalty counter on Nissa of Shadowed Boughs. + this.addAbility(new LandfallAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance()))); + + // +1: Untap target land you control. You may have it become a 3/3 Elemental creature with haste and menace until end of turn. It's still a land. + Ability ability = new LoyaltyAbility(new UntapTargetEffect(), 1); + ability.addEffect(new NissaOfShadowedBoughsLandEffect()); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND)); + + // −5: You may put a creature card with converted mana cost less than or equal to the number of lands you control onto the battlefield from your hand or graveyard with two +1/+1 counters on it. + this.addAbility(new LoyaltyAbility(new NissaOfShadowedBoughsCreatureEffect(), -5)); + } + + private NissaOfShadowedBoughs(final NissaOfShadowedBoughs card) { + super(card); + } + + @Override + public NissaOfShadowedBoughs copy() { + return new NissaOfShadowedBoughs(this); + } +} + +class NissaOfShadowedBoughsLandEffect extends OneShotEffect { + + NissaOfShadowedBoughsLandEffect() { + super(Benefit); + staticText = "You may have it become a 3/3 Elemental creature with haste and menace until end of turn. It's still a land."; + } + + private NissaOfShadowedBoughsLandEffect(final NissaOfShadowedBoughsLandEffect effect) { + super(effect); + } + + @Override + public NissaOfShadowedBoughsLandEffect copy() { + return new NissaOfShadowedBoughsLandEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || !player.chooseUse( + Outcome.BecomeCreature, "Have it become a creature?", source, game + )) { + return false; + } + game.addEffect(new BecomesCreatureTargetEffect( + new CreatureToken(3, 3, "", SubType.ELEMENTAL) + .withAbility(HasteAbility.getInstance()) + .withAbility(new MenaceAbility()), + false, true, Duration.EndOfTurn + ), source); + return true; + } +} + +class NissaOfShadowedBoughsCreatureEffect extends OneShotEffect { + + NissaOfShadowedBoughsCreatureEffect() { + super(Outcome.Benefit); + staticText = "You may put a creature card with converted mana cost less than or equal to " + + "the number of lands you control onto the battlefield from your hand or graveyard " + + "with two +1/+1 counters on it."; + } + + private NissaOfShadowedBoughsCreatureEffect(final NissaOfShadowedBoughsCreatureEffect effect) { + super(effect); + } + + @Override + public NissaOfShadowedBoughsCreatureEffect copy() { + return new NissaOfShadowedBoughsCreatureEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int lands = game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, + source.getSourceId(), source.getControllerId(), game + ); + FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + lands + " or less"); + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, lands + 1)); + int inHand = player.getHand().count(filter, game); + int inGrave = player.getGraveyard().count(filter, game); + if (inHand < 1 && inGrave < 1) { + return false; + } + TargetCard target; + if (inHand < 1 || (inGrave > 0 && !player.chooseUse( + outcome, "Put a card from your hand or graveyard?", + null, "Hand", "Graveyard", source, game + ))) { + target = new TargetCardInYourGraveyard(0, 1, filter, true); + player.choose(outcome, player.getGraveyard(), target, game); + } else { + target = new TargetCardInHand(0, 1, filter); + player.choose(outcome, player.getHand(), target, game); + } + Card card = game.getCard(target.getFirstTarget()); + if (card == null) { + return false; + } + player.moveCards(card, Zone.BATTLEFIELD, source, game); + Permanent permanent = game.getPermanent(card.getId()); + if (permanent != null) { + permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 2b13cdb26a..e08f1b165e 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -271,6 +271,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Nimana Skitter-Sneak", 116, Rarity.COMMON, mage.cards.n.NimanaSkitterSneak.class)); cards.add(new SetCardInfo("Nimana Skydancer", 117, Rarity.COMMON, mage.cards.n.NimanaSkydancer.class)); cards.add(new SetCardInfo("Nimble Trapfinder", 72, Rarity.RARE, mage.cards.n.NimbleTrapfinder.class)); + cards.add(new SetCardInfo("Nissa of Shadowed Boughs", 231, Rarity.MYTHIC, mage.cards.n.NissaOfShadowedBoughs.class)); cards.add(new SetCardInfo("Nissa's Zendikon", 197, Rarity.COMMON, mage.cards.n.NissasZendikon.class)); cards.add(new SetCardInfo("Nullpriest of Oblivion", 118, Rarity.RARE, mage.cards.n.NullpriestOfOblivion.class)); cards.add(new SetCardInfo("Oblivion's Hunger", 119, Rarity.COMMON, mage.cards.o.OblivionsHunger.class));