Fixed: next player setup logic
This commit is contained in:
@@ -391,10 +391,6 @@ public class Game implements Serializable {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(slotPlayerEntry.getKey().getSlotId()=='A')
|
||||
{
|
||||
player.addFood(3);
|
||||
}
|
||||
slotMap.put(slotPlayerEntry.getKey(),player);
|
||||
nextPlayerSetup();
|
||||
return true;
|
||||
@@ -437,7 +433,7 @@ public class Game implements Serializable {
|
||||
tempCard.insert(player);
|
||||
board.removeUpperTribeCard(tempCard);
|
||||
currentState.UpperDrawn();
|
||||
if((currentState.getNLower() ==0 ||( getLowerListTribeCards().size()==0 && getLowerListBuilding().size()==0)) && ((currentState.getNUpper() ==0)||( getUpperListTribeCards().size()==0 && getUpperListBuilding().size()==0)))
|
||||
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
|
||||
nextPlayerSetup();
|
||||
return true;
|
||||
}
|
||||
@@ -508,7 +504,7 @@ public class Game implements Serializable {
|
||||
tempCard.insert(player);
|
||||
board.removeLowerTribeCard(tempCard);
|
||||
currentState.LowerDrawn();
|
||||
if((currentState.getNLower() ==0 ||( getLowerListTribeCards().size()==0 && getLowerListBuilding().size()==0)) && ((currentState.getNUpper() ==0)||( getUpperListTribeCards().size()==0 && getUpperListBuilding().size()==0)))
|
||||
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
|
||||
nextPlayerSetup();
|
||||
return true;
|
||||
|
||||
@@ -547,7 +543,7 @@ public class Game implements Serializable {
|
||||
}
|
||||
else
|
||||
return false;
|
||||
if((currentState.getNLower() ==0 ||( getLowerListTribeCards().size()==0 && getLowerListBuilding().size()==0)) && ((currentState.getNUpper() ==0)||( getUpperListTribeCards().size()==0 && getUpperListBuilding().size()==0)))
|
||||
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
|
||||
nextPlayerSetup();
|
||||
|
||||
return true;
|
||||
@@ -587,7 +583,7 @@ public class Game implements Serializable {
|
||||
}
|
||||
else
|
||||
return false;
|
||||
if((currentState.getNLower() ==0 ||( getLowerListTribeCards().size()==0 && getLowerListBuilding().size()==0)) && ((currentState.getNUpper() ==0)||( getUpperListTribeCards().size()==0 && getUpperListBuilding().size()==0)))
|
||||
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().isEmpty())))
|
||||
nextPlayerSetup();
|
||||
|
||||
return true;
|
||||
@@ -728,15 +724,20 @@ public class Game implements Serializable {
|
||||
currentState.GameStageUpdate(GameStages.RES_ACTIONS);
|
||||
|
||||
boolean anyAssigned = false;
|
||||
for (Slot s : slotMap.keySet()) {
|
||||
if (slotMap.get(s) != null) {
|
||||
currentState.PlayerUpdate(slotMap.get(s), s);
|
||||
|
||||
for (Map.Entry<Slot,Player> entry : slotMap.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
if(entry.getKey().getSlotId()=='A')
|
||||
{
|
||||
entry.getValue().addFood(3);
|
||||
orderLogicCard.push(entry.getValue());
|
||||
entry.setValue(null);
|
||||
continue;
|
||||
}
|
||||
currentState.PlayerUpdate(entry.getValue(), entry.getKey());
|
||||
boolean hasDrawableLower = currentState.getNLower() > 0
|
||||
&& (hasDrawableDown() || !getLowerListBuilding().isEmpty());
|
||||
boolean hasDrawableUpper = currentState.getNUpper() > 0
|
||||
&& (hasDrawableUp() || !getUpperListBuilding().isEmpty());
|
||||
|
||||
if (!hasDrawableLower && !hasDrawableUpper) {
|
||||
// This player has nothing drawable, skip them immediately
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
@@ -757,25 +758,27 @@ public class Game implements Serializable {
|
||||
}
|
||||
|
||||
if (GameStages.RES_ACTIONS == currentState.getGameStage()) {
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
if(!disconnetedPlayers.containsKey(currentState.getCurrentPlayer())|| !disconnetedPlayers.get(currentState.getCurrentPlayer()))
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
slotMap.put(currentState.getSlot(), null);
|
||||
|
||||
for (Slot s : slotMap.keySet()) {
|
||||
if (slotMap.get(s) != null) {
|
||||
currentState.PlayerUpdate(slotMap.get(s), s);
|
||||
if(disconnetedPlayers.containsKey(currentState.getCurrentPlayer())&& disconnetedPlayers.get(currentState.getCurrentPlayer()))
|
||||
for (Map.Entry<Slot,Player> entry : slotMap.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
|
||||
if(disconnetedPlayers.containsKey(entry.getValue())&&disconnetedPlayers.get(currentState.getCurrentPlayer()))
|
||||
{
|
||||
slotMap.put(currentState.getSlot(), null);
|
||||
entry.setValue(null);
|
||||
continue;
|
||||
}
|
||||
currentState.PlayerUpdate(entry.getValue(), entry.getKey());
|
||||
boolean hasDrawableLower = currentState.getNLower() > 0
|
||||
&& (hasDrawableDown() || !getLowerListBuilding().isEmpty());
|
||||
boolean hasDrawableUpper = currentState.getNUpper() > 0
|
||||
&& (hasDrawableUp() || !getUpperListBuilding().isEmpty());
|
||||
if (!hasDrawableLower && !hasDrawableUpper) {
|
||||
// This player also has nothing, skip and continue the loop
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
slotMap.put(currentState.getSlot(), null);
|
||||
orderLogicCard.push(entry.getValue());
|
||||
entry.setValue(null);
|
||||
} else {
|
||||
// Found a player with something to do, stop here
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user