Fix:Board
This commit is contained in:
@@ -41,6 +41,8 @@ public class Board implements Serializable {
|
||||
/** Contains all the building cards of the upper list. When a new era starts, the old era's buildings are moved from the upper to the lower list */
|
||||
public List<BuildingCard> lowerListBuilding;
|
||||
|
||||
|
||||
private final ArrayList<List<BuildingCard>> buildingCardsAllEras;
|
||||
/** Number of players */
|
||||
private int nTotem;
|
||||
|
||||
@@ -88,6 +90,7 @@ public class Board implements Serializable {
|
||||
tribeDeck=generateTribeDeck(nTotem);
|
||||
era=1;
|
||||
|
||||
|
||||
for(int i=0;i<nTotem+1;i++)
|
||||
{
|
||||
TribeCard tempCard = tribeDeck.remove();
|
||||
@@ -110,12 +113,43 @@ public class Board implements Serializable {
|
||||
|
||||
ArrayList<BuildingCard> buildingDeck = new ArrayList<>(DecksCreator.loadBuildingDeckByEra(1));
|
||||
Collections.shuffle(buildingDeck);
|
||||
buildingCardsAllEras= new ArrayList<>();
|
||||
if(nTotem==2)
|
||||
{
|
||||
buildingCardsAllEras.set(0, new ArrayList<>(buildingDeck.subList(0, 1)));
|
||||
upperListBuilding = new ArrayList<>(buildingDeck.subList(0,1));
|
||||
}
|
||||
else
|
||||
{
|
||||
buildingCardsAllEras.set(0, new ArrayList<>(buildingDeck.subList(0, 2)));
|
||||
upperListBuilding = new ArrayList<>(buildingDeck.subList(0,2));
|
||||
}
|
||||
|
||||
buildingDeck=new ArrayList<>(DecksCreator.loadBuildingDeckByEra(2));
|
||||
Collections.shuffle(buildingDeck);
|
||||
if(nTotem<=3)
|
||||
{
|
||||
buildingCardsAllEras.set(1, new ArrayList<BuildingCard>(buildingDeck.subList(0, 2)));
|
||||
}
|
||||
else
|
||||
{
|
||||
buildingCardsAllEras.set(1, new ArrayList<BuildingCard>(buildingDeck.subList(0, 3)));
|
||||
}
|
||||
buildingDeck=new ArrayList<>(DecksCreator.loadBuildingDeckByEra(3));
|
||||
Collections.shuffle(buildingDeck);
|
||||
if(nTotem==2)
|
||||
{
|
||||
buildingCardsAllEras.set(2, new ArrayList<BuildingCard>(buildingDeck.subList(0, 3)));
|
||||
}else if(nTotem==5)
|
||||
{
|
||||
buildingCardsAllEras.set(2, new ArrayList<BuildingCard>(buildingDeck.subList(0, 5)));
|
||||
}
|
||||
else {
|
||||
buildingCardsAllEras.set(2, new ArrayList<BuildingCard>(buildingDeck.subList(0, 4)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tribeDeck. Loads the cards from each era, shuffle them, and then combine them in the final deck.
|
||||
* In the end, two special events (Sustenance and ShamanicRitual) are added.
|
||||
@@ -230,27 +264,11 @@ public class Board implements Serializable {
|
||||
Collections.shuffle(buildingCards);
|
||||
if(era==2)
|
||||
{
|
||||
if(nTotem<=3)
|
||||
{
|
||||
upperListBuilding.addAll(buildingCards.subList(0,2));
|
||||
upperListBuilding.addAll(buildingCardsAllEras.get(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
upperListBuilding.addAll( buildingCards.subList(0,3));
|
||||
}
|
||||
}
|
||||
else // Era 3
|
||||
{
|
||||
if(nTotem==2)
|
||||
{
|
||||
upperListBuilding.addAll( buildingCards.subList(0,3));
|
||||
}else if(nTotem==5)
|
||||
{
|
||||
upperListBuilding.addAll( buildingCards.subList(0,5));
|
||||
}
|
||||
else {
|
||||
upperListBuilding.addAll(buildingCards.subList(0,4));
|
||||
}
|
||||
upperListBuilding.addAll(buildingCardsAllEras.get(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user