* Wrench Mind - Fixed a bug that locked the UI while discarding.

This commit is contained in:
LevelX2 2014-04-12 23:27:16 +02:00
parent bc0bd754dd
commit 1155cf2049
3 changed files with 16 additions and 16 deletions

View file

@ -78,7 +78,7 @@ class EidolonOfTheGreatRevelTriggeredAbility extends TriggeredAbilityImpl<Eidolo
public EidolonOfTheGreatRevelTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"));
}

View file

@ -30,6 +30,7 @@ package mage.sets.mirrodin;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
@ -40,6 +41,7 @@ import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetDiscard;
/**
*
@ -88,17 +90,17 @@ class WrenchMindEffect extends OneShotEffect<WrenchMindEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
Target target = new TargetCardInHand(new FilterArtifactCard());
target.setRequired(true);
if (target.canChoose(source.getSourceId(), targetPlayer.getId(), game)
&& targetPlayer.chooseUse(outcome, "Discard an artifact?", game)
&& targetPlayer.chooseTarget(outcome, target, source, game)) {
return targetPlayer.discard(targetPlayer.getHand().get(target.getFirstTarget(), game), source, game);
} else {
targetPlayer.discard(Math.min(targetPlayer.getHand().size(), 2), source, game);
}
return true;
if (targetPlayer != null && !targetPlayer.getHand().isEmpty()) {
TargetDiscard target = new TargetDiscard(targetPlayer.getId());
targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game);
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
if (card != null) {
targetPlayer.discard(card, source, game);
if (!card.getCardType().contains(CardType.ARTIFACT) && !targetPlayer.getHand().isEmpty()) {
targetPlayer.discard(1, source, game);
}
return true;
}
}
return false;
}

View file

@ -532,16 +532,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
@Override
public void discardToMax(Game game) {
int cardsStart = hand.size();
if (cardsStart > this.maxHandSize) {
if (hand.size() > this.maxHandSize) {
game.informPlayers(new StringBuilder(getName()).append(" discards down to ").append(this.maxHandSize).append(this.maxHandSize == 1?" hand card":" hand cards").toString());
while (hand.size() > this.maxHandSize) {
TargetDiscard target = new TargetDiscard(playerId);
target.setTargetName(new StringBuilder(" card to discard (").append(hand.size() - this.maxHandSize).append(" in total)").toString());
choose(Outcome.Discard, target, null, game);
discard(hand.get(target.getFirstTarget(), game), null, game);
}
int discarded =cardsStart - hand.size();
game.informPlayers(new StringBuilder(getName()).append(" discards ").append(discarded).append(discarded == 1?" card":" cards").append(" (cleanup)").toString());
}
}