Fixed that if a player leaves a multiplayer game during combat, his creatures are removed from combat (fixes #275).

This commit is contained in:
LevelX2 2013-07-25 15:43:28 +02:00
parent 9a04fb57cb
commit 1d6ee80e4c
2 changed files with 8 additions and 2 deletions

View file

@ -1645,6 +1645,10 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
attachedTo.removeAttachment(perm.getId(), this);
}
}
// check if it's a creature and must be removed from combat
if (perm.getCardType().contains(CardType.CREATURE) && this.getCombat() != null) {
this.getCombat().removeFromCombat(perm.getId(), this);
}
it.remove();
}
}

View file

@ -73,12 +73,14 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
public boolean hasFirstOrDoubleStrike(Game game) {
for (UUID permId: attackers) {
if (hasFirstOrDoubleStrike(game.getPermanent(permId))) {
Permanent attacker = game.getPermanent(permId);
if (attacker != null && hasFirstOrDoubleStrike(attacker)) {
return true;
}
}
for (UUID permId: blockers) {
if (hasFirstOrDoubleStrike(game.getPermanent(permId))) {
Permanent blocker = game.getPermanent(permId);
if (blocker != null && hasFirstOrDoubleStrike(blocker)) {
return true;
}
}