mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
[MAT] Implement Narset, Enlightened Exile
This commit is contained in:
parent
1cd107cbe9
commit
b5e87050ae
2 changed files with 124 additions and 0 deletions
123
Mage.Sets/src/mage/cards/n/NarsetEnlightenedExile.java
Normal file
123
Mage.Sets/src/mage/cards/n/NarsetEnlightenedExile.java
Normal file
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.n;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.ProwessAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class NarsetEnlightenedExile extends CardImpl {
|
||||
|
||||
private static final FilterCard filter
|
||||
= new FilterNonlandCard("noncreature, nonland card with mana value less than this creature's power");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
filter.add(NarsetEnlightenedExilePredicate.instance);
|
||||
}
|
||||
|
||||
public NarsetEnlightenedExile(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.MONK);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Creatures you control have prowess.
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
new ProwessAbility(), Duration.WhileOnBattlefield,
|
||||
StaticFilters.FILTER_PERMANENT_CREATURES
|
||||
).setText("creatures you control have prowess")));
|
||||
|
||||
// Whenever Narset, Enlightened Exile attacks, exile target noncreature, nonland card with mana value less than Narset's power from a graveyard and copy it. You may cast the copy without paying its mana cost.
|
||||
Ability ability = new AttacksTriggeredAbility(new NarsetEnlightenedExileEffect());
|
||||
ability.addTarget(new TargetCardInGraveyard(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private NarsetEnlightenedExile(final NarsetEnlightenedExile card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NarsetEnlightenedExile copy() {
|
||||
return new NarsetEnlightenedExile(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum NarsetEnlightenedExilePredicate implements ObjectSourcePlayerPredicate<Card> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
return Optional
|
||||
.ofNullable(input.getSource().getSourcePermanentOrLKI(game))
|
||||
.filter(Objects::nonNull)
|
||||
.map(MageObject::getPower)
|
||||
.map(MageInt::getValue)
|
||||
.map(p -> input.getObject().getManaValue() < p)
|
||||
.orElse(false);
|
||||
}
|
||||
}
|
||||
|
||||
class NarsetEnlightenedExileEffect extends OneShotEffect {
|
||||
|
||||
NarsetEnlightenedExileEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile target noncreature, nonland card with mana value less than {this}'s power " +
|
||||
"from a graveyard and copy it. You may cast the copy without paying its mana cost";
|
||||
}
|
||||
|
||||
private NarsetEnlightenedExileEffect(final NarsetEnlightenedExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NarsetEnlightenedExileEffect copy() {
|
||||
return new NarsetEnlightenedExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (player == null || card == null) {
|
||||
return false;
|
||||
}
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
Card copiedCard = game.copyCard(card, source, source.getControllerId());
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE);
|
||||
player.cast(
|
||||
player.chooseAbilityForCast(copiedCard, game, true),
|
||||
game, true, new ApprovingObject(source, game)
|
||||
);
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Leyline Immersion", 21, Rarity.RARE, mage.cards.l.LeylineImmersion.class));
|
||||
cards.add(new SetCardInfo("Markov Baron", 14, Rarity.UNCOMMON, mage.cards.m.MarkovBaron.class));
|
||||
cards.add(new SetCardInfo("Metropolis Reformer", 4, Rarity.RARE, mage.cards.m.MetropolisReformer.class));
|
||||
cards.add(new SetCardInfo("Narset, Enlightened Exile", 38, Rarity.MYTHIC, mage.cards.n.NarsetEnlightenedExile.class));
|
||||
cards.add(new SetCardInfo("Nissa, Resurgent Animist", 22, Rarity.MYTHIC, mage.cards.n.NissaResurgentAnimist.class));
|
||||
cards.add(new SetCardInfo("Niv-Mizzet, Supreme", 40, Rarity.RARE, mage.cards.n.NivMizzetSupreme.class));
|
||||
cards.add(new SetCardInfo("Open the Way", 23, Rarity.RARE, mage.cards.o.OpenTheWay.class));
|
||||
|
|
Loading…
Reference in a new issue