* Helm of Obedience - Fixed that card movement to graveyard was not handled correct. It was not checked, if card was really moved to graveyard (fixes #1004).

This commit is contained in:
LevelX2 2015-06-02 22:50:57 +02:00
parent 78961ad511
commit bb28394f71
4 changed files with 108 additions and 31 deletions

View file

@ -2900,6 +2900,8 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean moveCardsToGraveyardWithInfo(List<Card> allCards, Ability source, Game game, Zone fromZone) {
boolean result = true;
UUID sourceId = source == null ? null : source.getSourceId();
while (!allCards.isEmpty()) {
// identify cards from one owner
Cards cards = new CardsImpl();
@ -2914,7 +2916,7 @@ public abstract class PlayerImpl implements Player, Serializable {
cards.add(card);
}
}
// move cards ot graveyard in order the owner decides
// move cards to graveyard in order the owner decides
if (!cards.isEmpty()) {
Player choosingPlayer = this;
if (ownerId != this.getId()) {
@ -2936,22 +2938,21 @@ public abstract class PlayerImpl implements Player, Serializable {
Card card = cards.get(targetObjectId, game);
cards.remove(targetObjectId);
if (card != null) {
choosingPlayer.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, fromZone);
result &= choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone);
}
target.clearChosen();
}
if (cards.size() == 1) {
choosingPlayer.moveCardToGraveyardWithInfo(cards.getCards(game).iterator().next(), source == null ? null : source.getSourceId(), game, fromZone);
result &= choosingPlayer.moveCardToGraveyardWithInfo(cards.getCards(game).iterator().next(), sourceId, game, fromZone);
}
} else {
for (Card card : cards.getCards(game)) {
choosingPlayer.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, fromZone);
result &= choosingPlayer.moveCardToGraveyardWithInfo(card, sourceId, game, fromZone);
}
}
}
}
}
return true;
return result;
}
@Override

View file

@ -68,9 +68,9 @@ public class PlayerLostLifeWatcher extends Watcher {
if (playerId != null) {
Integer amount = amountOfLifeLostThisTurn.get(playerId);
if (amount == null) {
amount = Integer.valueOf(event.getAmount());
amount = event.getAmount();
} else {
amount = Integer.valueOf(amount + event.getAmount());
amount = amount + event.getAmount();
}
amountOfLifeLostThisTurn.put(playerId, amount);
}
@ -80,7 +80,7 @@ public class PlayerLostLifeWatcher extends Watcher {
public int getLiveLost(UUID playerId) {
Integer amount = amountOfLifeLostThisTurn.get(playerId);
if (amount != null) {
return amount.intValue();
return amount;
}
return 0;
}
@ -88,7 +88,7 @@ public class PlayerLostLifeWatcher extends Watcher {
public int getLiveLostLastTurn(UUID playerId) {
Integer amount = amountOfLifeLostLastTurn.get(playerId);
if (amount != null) {
return amount.intValue();
return amount;
}
return 0;
}