Fixed: No Drawable Logic

This commit is contained in:
rubenpirreram
2026-05-01 18:01:45 +02:00
parent ca930df0ba
commit 39e06886a3
@@ -318,6 +318,44 @@ public class Game implements Serializable {
return true; return true;
} }
public boolean SkipUpperDrawing(Player player) {
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
{
return false;
}
if(!player.equals(currentState.getCurrentPlayer()))
{
return false;
}
if(currentState.getNUpper() <1)
return false;
if(hasDrawableUp())
return false;
currentState.UpperDrawn();
if((currentState.getNLower() ==0 ||( !hasDrawableDown() && getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(getUpperListBuilding().isEmpty())))
nextPlayerSetup();
return true;
}
public boolean SkipLowerDrawing(Player player) {
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
{
return false;
}
if(!player.equals(currentState.getCurrentPlayer()))
{
return false;
}
if(currentState.getNUpper() <1)
return false;
if(hasDrawableDown())
return false;
currentState.LowerDrawn();
if((currentState.getNLower() ==0 ||( getLowerListBuilding().isEmpty())) && ((currentState.getNUpper() ==0)||(!hasDrawableUp()&&getUpperListBuilding().isEmpty())))
nextPlayerSetup();
return true;
}
/** /**
* Attempts to draw the lower tribe card at the specified index for the specified player. * Attempts to draw the lower tribe card at the specified index for the specified player.
* The operation succeeds only if the index is valid, the game stage is {@code RESOLVING_ACTIONS}, * The operation succeeds only if the index is valid, the game stage is {@code RESOLVING_ACTIONS},
@@ -569,7 +607,7 @@ public class Game implements Serializable {
for (Slot s : slotMap.keySet()) { for (Slot s : slotMap.keySet()) {
if (slotMap.get(s) != null) { if (slotMap.get(s) != null) {
currentState.PlayerUpdate(slotMap.get(s), s); currentState.PlayerUpdate(slotMap.get(s), s);
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().size()==0)) && ((currentState.getNUpper() ==0)||(!hasDrawableUp() && getUpperListBuilding().size()==0))))
break; break;
else else
{ {
@@ -587,7 +625,7 @@ public class Game implements Serializable {
for (Slot s : slotMap.keySet()) { for (Slot s : slotMap.keySet()) {
if (slotMap.get(s) != null) { if (slotMap.get(s) != null) {
currentState.PlayerUpdate(slotMap.get(s), s); currentState.PlayerUpdate(slotMap.get(s), s);
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().size()==0)) && ((currentState.getNUpper() ==0)||( !hasDrawableUp() && getUpperListBuilding().size()==0))) {
orderLogicCard.push(currentState.getCurrentPlayer()); orderLogicCard.push(currentState.getCurrentPlayer());
slotMap.put(currentState.getSlot(), null); slotMap.put(currentState.getSlot(), null);
@@ -661,7 +699,14 @@ public class Game implements Serializable {
} }
} }
private boolean hasDrawableUp()
{
return getUpperListTribeCards().stream().filter(x-> !x.IsEventCard()).count()==0;
}
private boolean hasDrawableDown()
{
return getLowerListTribeCards().stream().filter(x-> !x.IsEventCard()).count()==0;
}
/** /**
* Resolves all pending event cards if the current game stage is {@code RESOLVING_EVENT}. * Resolves all pending event cards if the current game stage is {@code RESOLVING_EVENT}.
* All pending events are activated on the player list. * All pending events are activated on the player list.