Fix:Board

This commit is contained in:
rubenpirreram
2026-05-02 16:38:30 +02:00
parent 670b4fcf84
commit 482921eb86
@@ -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 */ /** 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; public List<BuildingCard> lowerListBuilding;
private final ArrayList<List<BuildingCard>> buildingCardsAllEras;
/** Number of players */ /** Number of players */
private int nTotem; private int nTotem;
@@ -88,6 +90,7 @@ public class Board implements Serializable {
tribeDeck=generateTribeDeck(nTotem); tribeDeck=generateTribeDeck(nTotem);
era=1; era=1;
for(int i=0;i<nTotem+1;i++) for(int i=0;i<nTotem+1;i++)
{ {
TribeCard tempCard = tribeDeck.remove(); TribeCard tempCard = tribeDeck.remove();
@@ -110,12 +113,43 @@ public class Board implements Serializable {
ArrayList<BuildingCard> buildingDeck = new ArrayList<>(DecksCreator.loadBuildingDeckByEra(1)); ArrayList<BuildingCard> buildingDeck = new ArrayList<>(DecksCreator.loadBuildingDeckByEra(1));
Collections.shuffle(buildingDeck); Collections.shuffle(buildingDeck);
buildingCardsAllEras= new ArrayList<>();
if(nTotem==2) if(nTotem==2)
{
buildingCardsAllEras.set(0, new ArrayList<>(buildingDeck.subList(0, 1)));
upperListBuilding = new ArrayList<>(buildingDeck.subList(0,1)); upperListBuilding = new ArrayList<>(buildingDeck.subList(0,1));
}
else else
{
buildingCardsAllEras.set(0, new ArrayList<>(buildingDeck.subList(0, 2)));
upperListBuilding = 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. * 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. * In the end, two special events (Sustenance and ShamanicRitual) are added.
@@ -230,27 +264,11 @@ public class Board implements Serializable {
Collections.shuffle(buildingCards); Collections.shuffle(buildingCards);
if(era==2) if(era==2)
{ {
if(nTotem<=3) upperListBuilding.addAll(buildingCardsAllEras.get(1));
{
upperListBuilding.addAll(buildingCards.subList(0,2));
} }
else else
{ {
upperListBuilding.addAll( buildingCards.subList(0,3)); upperListBuilding.addAll(buildingCardsAllEras.get(2));
}
}
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));
}
} }
} }
} }