From 1a57e0f7877d67878e5ae41f3e14cef8a702b619 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 25 May 2019 17:10:54 -0400 Subject: [PATCH] Implemented Fallen Shinobi --- Mage.Sets/src/mage/cards/f/FallenShinobi.java | 123 ++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons.java | 1 + 2 files changed, 124 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FallenShinobi.java diff --git a/Mage.Sets/src/mage/cards/f/FallenShinobi.java b/Mage.Sets/src/mage/cards/f/FallenShinobi.java new file mode 100644 index 0000000000..bc6cf45403 --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FallenShinobi.java @@ -0,0 +1,123 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.NinjutsuAbility; +import mage.cards.*; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FallenShinobi extends CardImpl { + + public FallenShinobi(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}"); + + this.subtype.add(SubType.ZOMBIE); + this.subtype.add(SubType.NINJA); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Ninjutsu {2}{U}{B} + this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{2}{U}{B}"))); + + // Whenever Fallen Shinobi deals combat damage to a player, that player exiles the top two cards of their library. Until end of turn, you may play those cards without paying their mana cost. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( + new FallenShinobiEffect(), false, true + )); + } + + private FallenShinobi(final FallenShinobi card) { + super(card); + } + + @Override + public FallenShinobi copy() { + return new FallenShinobi(this); + } +} + +class FallenShinobiEffect extends OneShotEffect { + + FallenShinobiEffect() { + super(Outcome.Benefit); + staticText = "that player exiles the top two cards of their library. " + + "Until end of turn, you may play those cards without paying their mana cost."; + } + + private FallenShinobiEffect(final FallenShinobiEffect effect) { + super(effect); + } + + @Override + public FallenShinobiEffect copy() { + return new FallenShinobiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2)); + player.moveCards(cards, Zone.EXILED, source, game); + for (Card card : cards.getCards(game)) { + ContinuousEffect effect = new UrzaLordHighArtificerFromExileEffect(); + effect.setTargetPointer(new FixedTarget(card, game)); + game.addEffect(effect, source); + } + return true; + } +} + +class UrzaLordHighArtificerFromExileEffect extends AsThoughEffectImpl { + + UrzaLordHighArtificerFromExileEffect() { + super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit); + staticText = "you may play that card without paying its mana cost"; + } + + private UrzaLordHighArtificerFromExileEffect(final UrzaLordHighArtificerFromExileEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public UrzaLordHighArtificerFromExileEffect copy() { + return new UrzaLordHighArtificerFromExileEffect(this); + } + + @Override + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (!affectedControllerId.equals(source.getControllerId()) + || !getTargetPointer().getTargets(game, source).contains(objectId)) { + return false; + } + Card card = game.getCard(objectId); + if (card == null || card.isLand() || card.getSpellAbility().getCosts() == null) { + return true; + } + Player player = game.getPlayer(affectedControllerId); + if (player == null) { + return false; + } + player.setCastSourceIdWithAlternateMana(objectId, null, card.getSpellAbility().getCosts()); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index 82da5e001e..8556e44793 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -49,6 +49,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Etchings of the Chosen", 198, Rarity.UNCOMMON, mage.cards.e.EtchingsOfTheChosen.class)); cards.add(new SetCardInfo("Exclude", 48, Rarity.UNCOMMON, mage.cards.e.Exclude.class)); cards.add(new SetCardInfo("Fact or Fiction", 50, Rarity.UNCOMMON, mage.cards.f.FactOrFiction.class)); + cards.add(new SetCardInfo("Fallen Shinobi", 199, Rarity.RARE, mage.cards.f.FallenShinobi.class)); cards.add(new SetCardInfo("Farmstead Gleaner", 222, Rarity.UNCOMMON, mage.cards.f.FarmsteadGleaner.class)); cards.add(new SetCardInfo("Feaster of Fools", 90, Rarity.UNCOMMON, mage.cards.f.FeasterOfFools.class)); cards.add(new SetCardInfo("Fiery Islet", 238, Rarity.RARE, mage.cards.f.FieryIslet.class));