[LTR] Implement Isildur's Fateful Strike

This commit is contained in:
theelk801 2023-06-09 18:11:50 -04:00
parent ad9d8ec2df
commit 164d96352d
3 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.common.LegendarySpellAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class IsildursFatefulStrike extends CardImpl {
public IsildursFatefulStrike(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}{B}");
this.supertype.add(SuperType.LEGENDARY);
// (You may cast a legendary instant only if you control a legendary creature or planeswalker.)
this.addAbility(new LegendarySpellAbility());
// Destroy target creature. If its controller has more than four cards in hand, they exile cards from their hand equal to the difference.
this.getSpellAbility().addEffect(new IsildursFatefulStrikeEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private IsildursFatefulStrike(final IsildursFatefulStrike card) {
super(card);
}
@Override
public IsildursFatefulStrike copy() {
return new IsildursFatefulStrike(this);
}
}
class IsildursFatefulStrikeEffect extends OneShotEffect {
IsildursFatefulStrikeEffect() {
super(Outcome.Benefit);
staticText = "destroy target creature. If its controller has more than four cards in hand, " +
"they exile cards from their hand equal to the difference";
}
private IsildursFatefulStrikeEffect(final IsildursFatefulStrikeEffect effect) {
super(effect);
}
@Override
public IsildursFatefulStrikeEffect copy() {
return new IsildursFatefulStrikeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
permanent.destroy(source, game);
Player player = game.getPlayer(permanent.getControllerId());
if (player == null || player.getHand().size() <= 4) {
return true;
}
TargetCard target = new TargetCardInHand(player.getHand().size() - 4, StaticFilters.FILTER_CARD);
player.choose(outcome, player.getHand(), target, source, game);
player.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game);
return true;
}
}

View file

@ -80,6 +80,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Horn of Gondor", 240, Rarity.RARE, mage.cards.h.HornOfGondor.class));
cards.add(new SetCardInfo("Horses of the Bruinen", 55, Rarity.UNCOMMON, mage.cards.h.HorsesOfTheBruinen.class));
cards.add(new SetCardInfo("Ioreth of the Healing House", 56, Rarity.UNCOMMON, mage.cards.i.IorethOfTheHealingHouse.class));
cards.add(new SetCardInfo("Isildur's Fateful Strike", 91, Rarity.RARE, mage.cards.i.IsildursFatefulStrike.class));
cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Knight of the Keep", 291, Rarity.COMMON, mage.cards.k.KnightOfTheKeep.class));
cards.add(new SetCardInfo("Knights of Dol Amroth", 59, Rarity.COMMON, mage.cards.k.KnightsOfDolAmroth.class));

View file

@ -5,6 +5,7 @@ import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.LegendarySpellAbility;
import mage.abilities.common.SagaAbility;
import mage.abilities.common.WerewolfBackTriggeredAbility;
import mage.abilities.common.WerewolfFrontTriggeredAbility;
@ -1736,6 +1737,11 @@ public class VerifyCardDataTest {
fail(card, "abilities", "the back face of a double-faced card should be nightCard = true");
}
// special check: legendary spells need to have legendary spell ability
if (card.isLegendary() && !card.isPermanent() && !card.getAbilities().containsClass(LegendarySpellAbility.class)) {
fail(card, "abilities", "legendary nonpermanent cards need to have LegendarySpellAbility");
}
if (card.getAbilities().containsClass(MutateAbility.class)) {
fail(card, "abilities", "mutate cards aren't implemented and shouldn't be available");
}