* Wrexial, the Risen Deep - Fixed a problem that prevented selecting the card from graveyard.

This commit is contained in:
LevelX2 2016-12-18 14:59:47 +01:00
parent 9ea22d0af1
commit 69b27f594a

View file

@ -62,7 +62,7 @@ import mage.target.common.TargetCardInGraveyard;
public class WrexialTheRisenDeep extends CardImpl { public class WrexialTheRisenDeep extends CardImpl {
public WrexialTheRisenDeep(UUID ownerId, CardSetInfo setInfo) { public WrexialTheRisenDeep(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}{B}");
this.supertype.add("Legendary"); this.supertype.add("Legendary");
this.subtype.add("Kraken"); this.subtype.add("Kraken");
@ -90,8 +90,6 @@ public class WrexialTheRisenDeep extends CardImpl {
class WrexialEffect extends OneShotEffect { class WrexialEffect extends OneShotEffect {
static final private FilterCard filter = new FilterCard("target instant or sorcery card from damaged player's graveyard");
public WrexialEffect() { public WrexialEffect() {
super(Outcome.PlayForFree); super(Outcome.PlayForFree);
staticText = "you may cast target instant or sorcery card from that player's graveyard without paying its mana cost. If that card would be put into a graveyard this turn, exile it instead"; staticText = "you may cast target instant or sorcery card from that player's graveyard without paying its mana cost. If that card would be put into a graveyard this turn, exile it instead";
@ -108,24 +106,27 @@ class WrexialEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (controller != null) {
Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
if (damagedPlayer == null) {
return false;
}
FilterCard filter = new FilterCard("target instant or sorcery card from " + damagedPlayer.getName() + "'s graveyard");
filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
filter.add(new OwnerIdPredicate(damagedPlayer.getId())); Target target = new TargetCardInGraveyard(filter);
filter.add(Predicates.or( if (controller.chooseTarget(Outcome.PlayForFree, target, source, game)) {
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
Target target = new TargetCardInGraveyard(filter);
if (you != null) {
if (you.chooseTarget(Outcome.PlayForFree, target, source, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {
you.cast(card.getSpellAbility(), game, true); controller.cast(card.getSpellAbility(), game, true);
game.addEffect(new WrexialReplacementEffect(card.getId()), source); game.addEffect(new WrexialReplacementEffect(card.getId()), source);
} }
} }
return true;
} }
return false; return false;
} }