Fix: Game Init
This commit is contained in:
@@ -232,6 +232,16 @@ public class Game implements Serializable {
|
||||
orderLogicCard=new Order5(playersList);
|
||||
break;
|
||||
}
|
||||
for(Player player : playersList)
|
||||
{
|
||||
switch(orderLogicCard.getPosition(player.getUserName()))
|
||||
{
|
||||
case 0: player.addFood(2); break;
|
||||
case 1,2: player.addFood(3); break;
|
||||
case 3,4: player.addFood(4); break;
|
||||
}
|
||||
|
||||
}
|
||||
currentState.PlayerUpdate(orderLogicCard.pull(),null);
|
||||
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
|
||||
}
|
||||
@@ -264,6 +274,10 @@ public class Game implements Serializable {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(slotPlayerEntry.getKey().getSlotId()=='A')
|
||||
{
|
||||
player.addFood(3);
|
||||
}
|
||||
slotMap.put(slotPlayerEntry.getKey(),player);
|
||||
nextPlayerSetup();
|
||||
return true;
|
||||
@@ -288,7 +302,7 @@ public class Game implements Serializable {
|
||||
public boolean DrawUpperTribeCardByIndex(Player player,int cardIndex) {
|
||||
if( cardIndex<0 || cardIndex >=board.upperListTribe.size())
|
||||
return false;
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -324,7 +338,7 @@ public class Game implements Serializable {
|
||||
* @return {@code true} if the skip succeeds, {@code false} otherwise.
|
||||
*/
|
||||
public boolean SkipUpperDrawing(Player player) {
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -355,7 +369,7 @@ public class Game implements Serializable {
|
||||
* @return {@code true} if the skip succeeds, {@code false} otherwise.
|
||||
*/
|
||||
public boolean SkipLowerDrawing(Player player) {
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -389,7 +403,7 @@ public class Game implements Serializable {
|
||||
public boolean DrawLowerTribeCardByIndex(Player player, int cardIndex) {
|
||||
if( cardIndex<0 || cardIndex >=board.lowerListTribe.size())
|
||||
return false;
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -430,7 +444,7 @@ public class Game implements Serializable {
|
||||
public boolean DrawUpperBuildingCardByIndex(Player player,int cardIndex) {
|
||||
if( cardIndex<0 || cardIndex >=board.upperListBuilding.size())
|
||||
return false;
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -469,7 +483,7 @@ public class Game implements Serializable {
|
||||
public boolean DrawLowerBuildingCardByIndex(Player player,int cardIndex) {
|
||||
if( cardIndex<0 || cardIndex >=board.lowerListBuilding.size())
|
||||
return false;
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_ACTIONS)
|
||||
if(currentState.getGameStage()!= GameStages.RES_ACTIONS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -514,7 +528,7 @@ public class Game implements Serializable {
|
||||
* @return {@code true} if the operation succeeds, {@code false} otherwise.
|
||||
*/
|
||||
public boolean PickOptionalTribeCardByIndex(Player player,int cardIndex) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
@@ -549,7 +563,7 @@ public class Game implements Serializable {
|
||||
* @return {@code true} if the operation succeeds, {@code false} otherwise.
|
||||
*/
|
||||
public boolean PickOptionalBuildingCard(Player player, int cardIndex) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
@@ -581,7 +595,7 @@ public class Game implements Serializable {
|
||||
* @return {@code true} if the operation succeeds, {@code false} otherwise.
|
||||
*/
|
||||
public boolean NoOptionalCard(Player player) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
if(currentState.getGameStage() != GameStages.OPT_CARD_E){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
@@ -620,7 +634,7 @@ public class Game implements Serializable {
|
||||
currentState.PlayerUpdate(tempPlayer, null);
|
||||
return;
|
||||
}
|
||||
currentState.GameStageUpdate(GameStages.RESOLVING_ACTIONS);
|
||||
currentState.GameStageUpdate(GameStages.RES_ACTIONS);
|
||||
for (Slot s : slotMap.keySet()) {
|
||||
if (slotMap.get(s) != null) {
|
||||
currentState.PlayerUpdate(slotMap.get(s), s);
|
||||
@@ -636,7 +650,7 @@ public class Game implements Serializable {
|
||||
return;
|
||||
|
||||
}
|
||||
if(GameStages.RESOLVING_ACTIONS==currentState.getGameStage()) {
|
||||
if(GameStages.RES_ACTIONS ==currentState.getGameStage()) {
|
||||
orderLogicCard.push(currentState.getCurrentPlayer());
|
||||
slotMap.put(currentState.getSlot(), null);
|
||||
for (Slot s : slotMap.keySet()) {
|
||||
@@ -655,7 +669,7 @@ public class Game implements Serializable {
|
||||
}
|
||||
if(slotMap.values().stream().allMatch(v -> v == null))
|
||||
{
|
||||
currentState.GameStageUpdate(GameStages.OPTIONAL_CARD_EFFECT);
|
||||
currentState.GameStageUpdate(GameStages.OPT_CARD_E);
|
||||
HashMap<Player,Integer> optional=new LinkedHashMap<>();
|
||||
for (Player p : orderLogicCard.players) {
|
||||
int tempCount=(int)p.buildingCards.stream().filter(x->x.getEffectId()==12).count();
|
||||
@@ -676,7 +690,7 @@ public class Game implements Serializable {
|
||||
return;
|
||||
}
|
||||
|
||||
currentState.GameStageUpdate(GameStages.RESOLVING_EVENT);
|
||||
currentState.GameStageUpdate(GameStages.RES_EVENT);
|
||||
|
||||
if (currentState.getRound() < 10) {
|
||||
nextRound();
|
||||
@@ -691,7 +705,7 @@ public class Game implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
if (GameStages.OPTIONAL_CARD_EFFECT == currentState.getGameStage()) {
|
||||
if (GameStages.OPT_CARD_E == currentState.getGameStage()) {
|
||||
Player optionalPlayer = OptionalCardQueue.poll();
|
||||
|
||||
if (optionalPlayer != null) {
|
||||
@@ -699,7 +713,7 @@ public class Game implements Serializable {
|
||||
return;
|
||||
}
|
||||
|
||||
currentState.GameStageUpdate(GameStages.RESOLVING_EVENT);
|
||||
currentState.GameStageUpdate(GameStages.RES_EVENT);
|
||||
|
||||
if (currentState.getRound() < 10) {
|
||||
nextRound();
|
||||
@@ -748,7 +762,7 @@ public class Game implements Serializable {
|
||||
*/
|
||||
private void EventResolution() {
|
||||
|
||||
if(currentState.getGameStage()!= GameStages.RESOLVING_EVENT)
|
||||
if(currentState.getGameStage()!= GameStages.RES_EVENT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user