[KHM] Implemented Return Upon the Tide

This commit is contained in:
Evan Kranzler 2021-01-17 10:39:00 -05:00
parent 01f7306d4b
commit 62b7bb553f
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ElfToken;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ReturnUponTheTide extends CardImpl {
public ReturnUponTheTide(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
// Return target creature card from your graveyard to the battlefield. If it's an Elf, create two 1/1 green Elf Warrior creature tokens.
this.getSpellAbility().addEffect(new ReturnUponTheTideEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
// Foretell {3}{B}
this.addAbility(new ForetellAbility(this, "{3}{B}"));
}
private ReturnUponTheTide(final ReturnUponTheTide card) {
super(card);
}
@Override
public ReturnUponTheTide copy() {
return new ReturnUponTheTide(this);
}
}
class ReturnUponTheTideEffect extends OneShotEffect {
ReturnUponTheTideEffect() {
super(Outcome.Benefit);
staticText = "Return target creature card from your graveyard to the battlefield. " +
"If it's an Elf, create two 1/1 green Elf Warrior creature tokens.";
}
private ReturnUponTheTideEffect(final ReturnUponTheTideEffect effect) {
super(effect);
}
@Override
public ReturnUponTheTideEffect copy() {
return new ReturnUponTheTideEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getFirstTarget());
if (player == null || card == null) {
return false;
}
player.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
if (permanent.hasSubtype(SubType.ELF, game)) {
new ElfToken().putOntoBattlefield(2, game, source, player.getId());
}
return true;
}
}

View file

@ -210,6 +210,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Reckless Crew", 148, Rarity.RARE, mage.cards.r.RecklessCrew.class));
cards.add(new SetCardInfo("Renegade Reaper", 386, Rarity.UNCOMMON, mage.cards.r.RenegadeReaper.class));
cards.add(new SetCardInfo("Replicating Ring", 244, Rarity.UNCOMMON, mage.cards.r.ReplicatingRing.class));
cards.add(new SetCardInfo("Return Upon the Tide", 106, Rarity.UNCOMMON, mage.cards.r.ReturnUponTheTide.class));
cards.add(new SetCardInfo("Revitalize", 23, Rarity.COMMON, mage.cards.r.Revitalize.class));
cards.add(new SetCardInfo("Rimewood Falls", 266, Rarity.COMMON, mage.cards.r.RimewoodFalls.class));
cards.add(new SetCardInfo("Rise of the Dread Marn", 107, Rarity.RARE, mage.cards.r.RiseOfTheDreadMarn.class));