- Fixed Zur's Weirdling.

This commit is contained in:
Jeff 2017-03-13 17:14:47 -05:00
parent 66362aa797
commit 15a2b3444e

View file

@ -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;
@ -95,35 +96,8 @@ 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;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
@ -132,7 +106,40 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
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;
}
}