Fix: small changes to Board

This commit is contained in:
2026-04-11 16:05:14 +02:00
parent 44f89add0c
commit 60c45d5333
@@ -74,7 +74,7 @@ public class Board {
tribeDeck=getTribeDeck(nTotem);
era=1;
for(int i=0;i<nTotem+2;i++)
for(int i=0;i<nTotem+1;i++)
{
TribeCard tempCard = tribeDeck.remove();
if(tempCard.IsEventCard())
@@ -88,7 +88,7 @@ public class Board {
}
}
for(int i=upperListTribe.size();i<nTotem+5;i++)
for(int i=upperListTribe.size();i<nTotem+4;i++)
{
TribeCard tempCard = tribeDeck.remove();
upperListTribe.add(tempCard);
@@ -135,22 +135,44 @@ public class Board {
return lowerListTribe.stream().filter(TribeCard::IsEventCard).map(x->(EventCard)x).collect(Collectors.toCollection(LinkedList::new));
}
// TODO chiedere a ruben che cazzo sono sti metodi
/**
* Take the selected card from the upper tribe list of the board
*
* @param tribeCard is the card to remove
* @return true if succeed in removing the card
*/
public boolean removeUpperTribeCard(TribeCard tribeCard) {
return upperListTribe.remove(tribeCard);
}
/**
* Take the selected card from the lower tribe list of the board
*
* @param tribeCard is the card to remove
* @return true if succeed in removing the card
*/
public boolean removeLowerTribeCard(TribeCard tribeCard) {
return upperListTribe.remove(tribeCard);
return lowerListTribe.remove(tribeCard);
}
/**
* Take the selected card from the upper building list of the board
*
* @param buildingCard is the card to remove
* @return true if succeed in removing the card
*/
public boolean removeUpperBuildingCard(BuildingCard buildingCard) {
return upperListTribe.remove(buildingCard);
return upperListBuilding.remove(buildingCard);
}
/**
* Take the selected card from the lower building list of the board
*
* @param buildingCard is the card to remove
* @return true if succeed in removing the card
*/
public boolean removeLowerBuildingCard(BuildingCard buildingCard) {
return upperListTribe.remove(buildingCard);
return lowerListBuilding.remove(buildingCard);
}
/**
@@ -160,7 +182,6 @@ public class Board {
* - Populate the upper tribe row
*
*/
// TODO chiedere a che serve il secondo for a ruben
public int nextRound() {
lowerListTribe.clear();
lowerListTribe.addAll(upperListTribe);
@@ -174,24 +195,23 @@ public class Board {
}
upperListTribe.add(tempCard);
}
for(int i=upperListTribe.size();i<nTotem+5;i++)
{
TribeCard tempCard = tribeDeck.remove();
upperListTribe.add(tempCard);
}
return era;
}
// TODO
/**
* Change the era of the game:
* - Increase the era attribute
* - Clear the lower building list and replace it with the upper building list
* - Repopulate the upper building list
*/
private void nextEra() {
era=era+1;
lowerListBuilding.clear();
lowerListBuilding.addAll(upperListBuilding);
upperListBuilding.clear();
List<BuildingCard> buildingCards=DecksCreator.loadBuildingDeckByEra(era);
ArrayList<BuildingCard> buildingCards= new ArrayList<>(DecksCreator.loadBuildingDeckByEra(era));
Collections.shuffle(buildingCards);
if(era==2)
{