From 7475bb0f0ca63706b2fe06efe432a97ccfc8fd1c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 11 Jan 2021 21:07:59 -0500 Subject: [PATCH] [KHM] Implemented Run Ashore --- Mage.Sets/src/mage/cards/r/RunAshore.java | 75 +++++++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RunAshore.java diff --git a/Mage.Sets/src/mage/cards/r/RunAshore.java b/Mage.Sets/src/mage/cards/r/RunAshore.java new file mode 100644 index 00000000000..fac88b0e3f4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RunAshore.java @@ -0,0 +1,75 @@ +package mage.cards.r; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetNonlandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RunAshore extends CardImpl { + + public RunAshore(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{U}{U}"); + + // Choose one or both — + // • The owner of target nonland permanent puts it on the top or bottom of their library. + this.getSpellAbility().addEffect(new RunAshoreEffect()); + this.getSpellAbility().addTarget(new TargetNonlandPermanent()); + + // • Return target nonland permanent to its owner's hand. + Mode mode = new Mode(new ReturnToHandTargetEffect()); + mode.addTarget(new TargetNonlandPermanent()); + this.getSpellAbility().addMode(mode); + } + + private RunAshore(final RunAshore card) { + super(card); + } + + @Override + public RunAshore copy() { + return new RunAshore(this); + } +} + +class RunAshoreEffect extends OneShotEffect { + + RunAshoreEffect() { + super(Outcome.Benefit); + staticText = "The owner of target nonland permanent puts it on the top or bottom of their library."; + } + + private RunAshoreEffect(final RunAshoreEffect effect) { + super(effect); + } + + @Override + public RunAshoreEffect copy() { + return new RunAshoreEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(game.getOwnerId(source.getFirstTarget())); + if (player == null) { + return false; + } + if (player.chooseUse(Outcome.Detriment, "Put the targeted object on the top or bottom of your library?", + "", "Top", "Bottom", source, game)) { + return new PutOnLibraryTargetEffect(true).apply(game, source); + } + return new PutOnLibraryTargetEffect(false).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 9dc6c1392d6..cfa979beb2d 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -115,6 +115,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Replicating Ring", 244, Rarity.UNCOMMON, mage.cards.r.ReplicatingRing.class)); cards.add(new SetCardInfo("Rimewood Falls", 266, Rarity.COMMON, mage.cards.r.RimewoodFalls.class)); cards.add(new SetCardInfo("Roots of Wisdom", 190, Rarity.COMMON, mage.cards.r.RootsOfWisdom.class)); + cards.add(new SetCardInfo("Run Ashore", 74, Rarity.COMMON, mage.cards.r.RunAshore.class)); cards.add(new SetCardInfo("Sarulf's Packmate", 192, Rarity.COMMON, mage.cards.s.SarulfsPackmate.class)); cards.add(new SetCardInfo("Sarulf, Realm Eater", 228, Rarity.RARE, mage.cards.s.SarulfRealmEater.class)); cards.add(new SetCardInfo("Saw It Coming", 76, Rarity.UNCOMMON, mage.cards.s.SawItComing.class));