[KHM] Implemented Run Ashore

This commit is contained in:
Evan Kranzler 2021-01-11 21:07:59 -05:00
parent 28d727a8af
commit 7475bb0f0c
2 changed files with 76 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));