Simplified Ethereal Valkyrie

This commit is contained in:
Alex Vasile 2022-08-12 23:20:03 -04:00
parent 65122676e5
commit 3cf9be30cf

View file

@ -5,6 +5,7 @@ import mage.MageInt;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -46,8 +47,7 @@ public final class EtherealValkyrie extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Whenever Ethereal Valkyrie enters the battlefield or attacks, draw a card, then exile a card from your hand face down. It becomes foretold. Its foretell cost is its mana cost reduced by {2}. // Whenever Ethereal Valkyrie enters the battlefield or attacks, draw a card, then exile a card from your hand face down. It becomes foretold. Its foretell cost is its mana cost reduced by {2}.
this.addAbility(new EtherealValkyrieTriggeredAbility(new EtherealValkyrieEffect())); this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new EtherealValkyrieEffect()));
} }
private EtherealValkyrie(final EtherealValkyrie card) { private EtherealValkyrie(final EtherealValkyrie card) {
@ -60,52 +60,16 @@ public final class EtherealValkyrie extends CardImpl {
} }
} }
class EtherealValkyrieTriggeredAbility extends TriggeredAbilityImpl {
EtherealValkyrieTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
setTriggerPhrase("Whenever {this} enters the battlefield or attacks, ");
}
EtherealValkyrieTriggeredAbility(final EtherealValkyrieTriggeredAbility ability) {
super(ability);
}
@Override
public EtherealValkyrieTriggeredAbility copy() {
return new EtherealValkyrieTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent p = game.getPermanent(event.getSourceId());
Permanent pETB = game.getPermanent(event.getTargetId());
if (p != null
&& p.getId() == sourceId) {
return true;
}
if (pETB != null
&& pETB.getId() == sourceId) {
return true;
}
return false;
}
}
class EtherealValkyrieEffect extends OneShotEffect { class EtherealValkyrieEffect extends OneShotEffect {
public EtherealValkyrieEffect() { public EtherealValkyrieEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
this.staticText = "draw a card, then exile a card from your hand face down. It becomes foretold. Its foretell cost is its mana cost reduced by {2}"; this.staticText = "draw a card, then exile a card from your hand face down. " +
"It becomes foretold. " +
"Its foretell cost is its mana cost reduced by {2}";
} }
public EtherealValkyrieEffect(final EtherealValkyrieEffect effect) { private EtherealValkyrieEffect(final EtherealValkyrieEffect effect) {
super(effect); super(effect);
} }
@ -117,14 +81,21 @@ class EtherealValkyrieEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller == null) {
return false;
}
controller.drawCards(1, source, game); controller.drawCards(1, source, game);
TargetCardInHand targetCard = new TargetCardInHand(new FilterCard("card to exile face down. It becomes foretold.")); TargetCardInHand targetCard = new TargetCardInHand(new FilterCard("card to exile face down. It becomes foretold."));
if (controller.chooseTarget(Outcome.Benefit, targetCard, source, game)) { if (!controller.chooseTarget(Outcome.Benefit, targetCard, source, game)) {
return false;
}
Card exileCard = game.getCard(targetCard.getFirstTarget()); Card exileCard = game.getCard(targetCard.getFirstTarget());
if (exileCard == null) { if (exileCard == null) {
return false; return false;
} }
// process Split, MDFC, and Adventure cards first // process Split, MDFC, and Adventure cards first
// note that 'Foretell Cost' refers to the main card (left) and 'Foretell Split Cost' refers to the (right) card if it exists // note that 'Foretell Cost' refers to the main card (left) and 'Foretell Split Cost' refers to the (right) card if it exists
ForetellAbility foretellAbility = null; ForetellAbility foretellAbility = null;
@ -183,10 +154,7 @@ class EtherealValkyrieEffect extends OneShotEffect {
ContinuousEffect effect = foretellAbility.new ForetellAddCostEffect(new MageObjectReference(exileCard, game)); ContinuousEffect effect = foretellAbility.new ForetellAddCostEffect(new MageObjectReference(exileCard, game));
game.addEffect(effect, copiedSource); game.addEffect(effect, copiedSource);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FORETOLD, exileCard.getId(), null, null)); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FORETOLD, exileCard.getId(), null, null));
}
return true; return true;
} }
}
}
return false;
}
} }