From b28bef8f62be0857dcbc52a7f92ceb8b16f669bb Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 13 Apr 2019 12:56:33 -0400 Subject: [PATCH] Implemented Nissa, Who Shakes the World --- .../mage/cards/n/NissaWhoShakesTheWorld.java | 149 ++++++++++++++++++ Mage.Sets/src/mage/sets/WarOfTheSpark.java | 1 + .../emblems/ElspethKnightErrantEmblem.java | 3 +- .../emblems/NissaWhoShakesTheWorldEmblem.java | 28 ++++ 4 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java create mode 100644 Mage/src/main/java/mage/game/command/emblems/NissaWhoShakesTheWorldEmblem.java diff --git a/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java b/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java new file mode 100644 index 00000000000..4156d5ea052 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NissaWhoShakesTheWorld.java @@ -0,0 +1,149 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.effects.mana.BasicManaEffect; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.mana.TriggeredManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.command.emblems.NissaWhoShakesTheWorldEmblem; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.TokenImpl; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NissaWhoShakesTheWorld extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledLandPermanent("noncreature land you control"); + private static final FilterCard filter2 = new FilterCard("Forest cards"); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + filter2.add(new SubtypePredicate(SubType.FOREST)); + } + + public NissaWhoShakesTheWorld(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{G}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.NISSA); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); + + // Whenever you tap a Forest for mana, add an additional {G}. + this.addAbility(new NissaWhoShakesTheWorldTriggeredAbility()); + + // +1: Put three +1/+1 counters on up to one target noncreature land you control. Untap it. It becomes a 0/0 Elemental creature with vigilance and haste that's still a land. + Ability ability = new LoyaltyAbility(new AddCountersTargetEffect( + CounterType.P1P1.createInstance(3) + ), 1); + ability.addEffect(new UntapTargetEffect().setText("Untap it.")); + ability.addEffect(new BecomesCreatureTargetEffect( + new NissaWhoShakesTheWorldToken(), false, true, Duration.Custom + ).setText("It becomes a 0/0 Elemental creature with vigilance and haste that's still a land.")); + ability.addTarget(new TargetPermanent(0, 1, filter, false)); + this.addAbility(ability); + + // -8: You get an emblem with "Lands you control have indestructible." Search your library for any number of Forest cards, put them onto the battlefield tapped, then shuffle your library. + ability = new LoyaltyAbility(new GetEmblemEffect(new NissaWhoShakesTheWorldEmblem()), -8); + ability.addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary( + 0, Integer.MAX_VALUE, filter2 + ), true)); + this.addAbility(ability); + } + + private NissaWhoShakesTheWorld(final NissaWhoShakesTheWorld card) { + super(card); + } + + @Override + public NissaWhoShakesTheWorld copy() { + return new NissaWhoShakesTheWorld(this); + } +} + +class NissaWhoShakesTheWorldTriggeredAbility extends TriggeredManaAbility { + + private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent("Forest"); + + static { + filter.add(new SubtypePredicate(SubType.FOREST)); + } + + NissaWhoShakesTheWorldTriggeredAbility() { + super(Zone.BATTLEFIELD, new BasicManaEffect(Mana.GreenMana(1)), false); + this.usesStack = false; + } + + private NissaWhoShakesTheWorldTriggeredAbility(final NissaWhoShakesTheWorldTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent land = game.getPermanent(event.getTargetId()); + return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); + } + + @Override + public NissaWhoShakesTheWorldTriggeredAbility copy() { + return new NissaWhoShakesTheWorldTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever you tap a Forest for mana, add an additional {G}."; + } +} + +class NissaWhoShakesTheWorldToken extends TokenImpl { + + NissaWhoShakesTheWorldToken() { + super("", "0/0 Elemental creature with vigilance and haste that's still a land."); + this.cardType.add(CardType.CREATURE); + this.subtype.add(SubType.ELEMENTAL); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + this.addAbility(HasteAbility.getInstance()); + this.addAbility(VigilanceAbility.getInstance()); + } + + private NissaWhoShakesTheWorldToken(final NissaWhoShakesTheWorldToken token) { + super(token); + } + + public NissaWhoShakesTheWorldToken copy() { + return new NissaWhoShakesTheWorldToken(this); + } +} diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 91df13df271..3abfc88546a 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -139,6 +139,7 @@ public final class WarOfTheSpark extends ExpansionSet { cards.add(new SetCardInfo("Nahiri, Storm of Stone", 233, Rarity.UNCOMMON, mage.cards.n.NahiriStormOfStone.class)); cards.add(new SetCardInfo("Neheb, Dreadhorde Champion", 140, Rarity.RARE, mage.cards.n.NehebDreadhordeChampion.class)); cards.add(new SetCardInfo("Nissa's Triumph", 170, Rarity.UNCOMMON, mage.cards.n.NissasTriumph.class)); + cards.add(new SetCardInfo("Nissa, Who Shakes the World", 169, Rarity.RARE, mage.cards.n.NissaWhoShakesTheWorld.class)); cards.add(new SetCardInfo("Niv-Mizzet Reborn", 208, Rarity.MYTHIC, mage.cards.n.NivMizzetReborn.class)); cards.add(new SetCardInfo("No Escape", 63, Rarity.COMMON, mage.cards.n.NoEscape.class)); cards.add(new SetCardInfo("Ob Nixilis's Cruelty", 101, Rarity.COMMON, mage.cards.o.ObNixilissCruelty.class)); diff --git a/Mage/src/main/java/mage/game/command/emblems/ElspethKnightErrantEmblem.java b/Mage/src/main/java/mage/game/command/emblems/ElspethKnightErrantEmblem.java index 17899691812..b6b292b238a 100644 --- a/Mage/src/main/java/mage/game/command/emblems/ElspethKnightErrantEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/ElspethKnightErrantEmblem.java @@ -14,7 +14,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.command.Emblem; /** - * * @author spjspj */ public final class ElspethKnightErrantEmblem extends Emblem { @@ -28,7 +27,7 @@ public final class ElspethKnightErrantEmblem extends Emblem { new CardTypePredicate(CardType.ENCHANTMENT), new CardTypePredicate(CardType.LAND))); Effect effect = new GainAbilityAllEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, filter, false); - effect.setText("Artifacts, creatures, enchantments, and lands you control are indestructible"); + effect.setText("Artifacts, creatures, enchantments, and lands you control have indestructible"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, effect)); this.setExpansionSetCodeForImage("MMA"); } diff --git a/Mage/src/main/java/mage/game/command/emblems/NissaWhoShakesTheWorldEmblem.java b/Mage/src/main/java/mage/game/command/emblems/NissaWhoShakesTheWorldEmblem.java new file mode 100644 index 00000000000..e00b2a24804 --- /dev/null +++ b/Mage/src/main/java/mage/game/command/emblems/NissaWhoShakesTheWorldEmblem.java @@ -0,0 +1,28 @@ + +package mage.game.command.emblems; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.command.Emblem; + +/** + * @author TheElk801 + */ +public final class NissaWhoShakesTheWorldEmblem extends Emblem { + + public NissaWhoShakesTheWorldEmblem() { + this.setName("Emblem Nissa"); + this.getAbilities().add(new SimpleStaticAbility( + Zone.COMMAND, + new GainAbilityAllEffect( + IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield, + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, false + ) + )); + this.setExpansionSetCodeForImage("WAR"); + } +}