state: Cleaned up isPhaseOver

This commit is contained in:
Nathan Woodburn 2023-04-26 18:06:37 +10:00
parent 8db5652ec6
commit 1ad2f6d3f3
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -396,20 +396,10 @@ public class State {
/**
* is the phase over?
* Defaults to simple mode
*/
public boolean isPhaseOver() {
boolean resourcesLeft = false;
for (Resource r : resources) {
if (!r.isClaimed() && r.getType() != 'S') resourcesLeft = true;
}
boolean moveLeft = false;
for (Player player : players) {
if (player.canPlay(this)) moveLeft = true;
}
return !resourcesLeft || !moveLeft;
return isPhaseOver(true);
}
/**
@ -423,7 +413,15 @@ public class State {
}
boolean moveLeft = false;
if (getCurrentPlayer().canPlay(this)) moveLeft = true;
if (simple) {
if (getCurrentPlayer().canPlay(this)) moveLeft = true;
}
else
{
for (Player player : players) {
if (player.canPlay(this)) moveLeft = true;
}
}
return !resourcesLeft || !moveLeft;