phase won't end if players are allowed to have priority and there are sim-stack entries to be added

This commit is contained in:
Maxmtg
2014-01-31 23:59:54 +00:00
parent 7cf1a52405
commit 070fd7695a

View File

@@ -1006,7 +1006,18 @@ public class PhaseHandler implements java.io.Serializable {
if( DEBUG_PHASES ) if( DEBUG_PHASES )
System.out.println(String.format("%s %s: %s passes priority to %s", playerTurn, phase, pPlayerPriority, nextPlayer)); System.out.println(String.format("%s %s: %s passes priority to %s", playerTurn, phase, pPlayerPriority, nextPlayer));
if (getFirstPriority() == nextPlayer) { if (getFirstPriority() == nextPlayer) {
if (game.getStack().isEmpty()) {
if (game.getStack().hasSimultaneousStackEntries() && givePriorityToPlayer)
{
Player ap = nextPlayer;
Player nap = game.getNextPlayerAfter(ap);
game.getStack().chooseOrderOfSimultaneousStackEntry(ap);
do {
game.getStack().chooseOrderOfSimultaneousStackEntry(nap);
nap = game.getNextPlayerAfter(nap);
} while( nap != ap);
// All have passed, but there's something waiting to be added to stack. After that and give them priority again
} else if (game.getStack().isEmpty()) {
this.setPriority(this.getPlayerTurn()); // this needs to be set early as we exit the phase this.setPriority(this.getPlayerTurn()); // this needs to be set early as we exit the phase
// end phase // end phase
@@ -1014,11 +1025,9 @@ public class PhaseHandler implements java.io.Serializable {
onPhaseEnd(); onPhaseEnd();
advanceToNextPhase(); advanceToNextPhase();
onPhaseBegin(); onPhaseBegin();
} } else if (!game.getStack().hasSimultaneousStackEntries())
else if (!game.getStack().hasSimultaneousStackEntries()) {
game.getStack().resolveStack(); game.getStack().resolveStack();
} }
}
else { else {
// pass the priority to other player // pass the priority to other player
this.pPlayerPriority = nextPlayer; this.pPlayerPriority = nextPlayer;