From 15a2b3444ef0e00b69f73c81b913f8929a0e7cac Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 13 Mar 2017 17:14:47 -0500 Subject: [PATCH] - Fixed Zur's Weirdling. --- Mage.Sets/src/mage/cards/z/ZursWeirding.java | 69 +++++++++++--------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/Mage.Sets/src/mage/cards/z/ZursWeirding.java b/Mage.Sets/src/mage/cards/z/ZursWeirding.java index 4026213b23..bbb7870811 100644 --- a/Mage.Sets/src/mage/cards/z/ZursWeirding.java +++ b/Mage.Sets/src/mage/cards/z/ZursWeirding.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.PayLifeCost; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.PlayWithHandRevealedEffect; import mage.cards.Card; @@ -53,7 +54,7 @@ import mage.players.Player; public class ZursWeirding extends CardImpl { public ZursWeirding(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); // Players play with their hands revealed. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayWithHandRevealedEffect(TargetController.ANY))); @@ -95,34 +96,7 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Player player = game.getPlayer(event.getTargetId()); - MageObject sourceObject = source.getSourceObject(game); - if (player != null && sourceObject != null) { - Card card = player.getLibrary().getFromTop(game); - if (card != null) { - // reveals it instead - player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); - - // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard - String message = "Pay 2 life to put " + card.getLogName() + " into graveyard?"; - for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { - if (playerId.equals(player.getId())) { - continue; - } - Player otherPlayer = game.getPlayer(playerId); - if (otherPlayer.canPayLifeCost() - && otherPlayer.getLife() >= 2 - && otherPlayer.chooseUse(Outcome.Benefit, message, source, game)) { - otherPlayer.loseLife(2, game, false); - player.moveCards(card, Zone.GRAVEYARD, source, game); - break; - } - } - - } - return true; - } - return false; + return true; } @Override @@ -132,7 +106,40 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return true; - } + boolean paid = false; + Player player = game.getPlayer(event.getTargetId()); + MageObject sourceObject = source.getSourceObject(game); + if (player != null + && sourceObject != null) { + Card card = player.getLibrary().getFromTop(game); + if (card != null) { + // Reveals it instead + player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum() + '|' + game.getPhase().getType() + ')', new CardsImpl(card), game); + // Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard + String message = "Pay 2 life to put " + card.getLogName() + " into " + player.getLogName() + " graveyard?"; + + for (UUID playerId : game.getState().getPlayersInRange(player.getId(), game)) { + if (playerId.equals(player.getId())) { + continue; + } + Player otherPlayer = game.getPlayer(playerId); + if (otherPlayer.canPayLifeCost() + && otherPlayer.getLife() >= 2) { + PayLifeCost lifeCost = new PayLifeCost(2); + while (otherPlayer.canRespond() + && !paid + && otherPlayer.chooseUse(Outcome.Benefit, message, source, game)) { + paid = lifeCost.pay(source, game, source.getSourceId(), otherPlayer.getId(), false, null); + } + if (paid) { + player.moveCards(card, Zone.GRAVEYARD, source, game); + return true; + } + } + } + } + } + return false; + } }