* Order of Succession - Fixed multiplayer handling if player already lost or left.

This commit is contained in:
LevelX2 2015-01-30 21:13:08 +01:00
parent e2b4128b2a
commit 5597b412bf

View file

@ -99,7 +99,8 @@ class OrderOfSuccessionEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Map<UUID, UUID> playerCreature = new HashMap<>(); Map<UUID, UUID> playerCreature = new HashMap<>();
boolean left = source.getChoices().get(0).getChoice().equals("Left"); boolean left = source.getChoices().get(0).getChoice().equals("Left");
PlayerList playerList = game.getState().getPlayerList(); PlayerList playerList = game.getState().getPlayerList().copy();
// set playerlist to controller
while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) { while (!playerList.get().equals(source.getControllerId()) && controller.isInGame()) {
playerList.getNext(); playerList.getNext();
} }
@ -112,10 +113,14 @@ class OrderOfSuccessionEffect extends OneShotEffect {
if (nextPlayer == null) { if (nextPlayer == null) {
return false; return false;
} }
// save first next player to check for iteration stop
if (firstNextPlayer == null) { if (firstNextPlayer == null) {
firstNextPlayer = nextPlayer.getId(); firstNextPlayer = nextPlayer.getId();
} }
// if player is in range he chooses an creature to control if (!nextPlayer.isInGame()) {
continue;
}
// if player is in range he chooses a creature to control
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) { if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature controlled by ").append(nextPlayer.getName()).toString()); FilterCreaturePermanent filter = new FilterCreaturePermanent(new StringBuilder("creature controlled by ").append(nextPlayer.getName()).toString());
filter.add(new ControllerIdPredicate(nextPlayer.getId())); filter.add(new ControllerIdPredicate(nextPlayer.getId()));