mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
Fixed game error on attack order disconnects
This commit is contained in:
parent
b6e87ddcb8
commit
ae5bc90915
1 changed files with 14 additions and 7 deletions
|
@ -663,15 +663,15 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
}
|
||||
|
||||
public void pickAttackerOrder(UUID playerId, Game game) {
|
||||
if (attackers.isEmpty()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (attackers.isEmpty() || player == null) {
|
||||
return;
|
||||
}
|
||||
Player player = game.getPlayer(playerId);
|
||||
List<UUID> attackerList = new ArrayList<>(attackers);
|
||||
attackerOrder.clear();
|
||||
List<UUID> newAttackerOrder = new ArrayList<>();
|
||||
while (true) {
|
||||
if (attackerList.size() == 1) {
|
||||
attackerOrder.add(attackerList.get(0));
|
||||
newAttackerOrder.add(attackerList.get(0));
|
||||
break;
|
||||
} else {
|
||||
List<Permanent> attackerPerms = new ArrayList<>();
|
||||
|
@ -682,12 +682,19 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
if (attackerId == null) {
|
||||
break;
|
||||
}
|
||||
attackerOrder.add(attackerId);
|
||||
newAttackerOrder.add(attackerId);
|
||||
attackerList.remove(attackerId);
|
||||
}
|
||||
}
|
||||
if (!game.isSimulation() && attackerOrder.size() > 1) {
|
||||
logDamageAssignmentOrder("Creatures blocked by ", blockers, attackerOrder, game);
|
||||
if (newAttackerOrder.size() == attackerOrder.size()) {
|
||||
attackerOrder.clear();
|
||||
attackerOrder.addAll(newAttackerOrder);
|
||||
|
||||
if (!game.isSimulation() && attackerOrder.size() > 1) {
|
||||
logDamageAssignmentOrder("Creatures blocked by ", blockers, attackerOrder, game);
|
||||
}
|
||||
} else {
|
||||
game.informPlayers(player.getLogName() + " try to skip choose attacker order");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue