mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- Fixed Zur's Weirdling.
This commit is contained in:
parent
66362aa797
commit
15a2b3444e
1 changed files with 38 additions and 31 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue