Fix: small changes to Board
This commit is contained in:
@@ -74,7 +74,7 @@ public class Board {
|
|||||||
tribeDeck=getTribeDeck(nTotem);
|
tribeDeck=getTribeDeck(nTotem);
|
||||||
era=1;
|
era=1;
|
||||||
|
|
||||||
for(int i=0;i<nTotem+2;i++)
|
for(int i=0;i<nTotem+1;i++)
|
||||||
{
|
{
|
||||||
TribeCard tempCard = tribeDeck.remove();
|
TribeCard tempCard = tribeDeck.remove();
|
||||||
if(tempCard.IsEventCard())
|
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();
|
TribeCard tempCard = tribeDeck.remove();
|
||||||
upperListTribe.add(tempCard);
|
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));
|
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) {
|
public boolean removeUpperTribeCard(TribeCard tribeCard) {
|
||||||
return upperListTribe.remove(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) {
|
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) {
|
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) {
|
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
|
* - Populate the upper tribe row
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// TODO chiedere a che serve il secondo for a ruben
|
|
||||||
public int nextRound() {
|
public int nextRound() {
|
||||||
lowerListTribe.clear();
|
lowerListTribe.clear();
|
||||||
lowerListTribe.addAll(upperListTribe);
|
lowerListTribe.addAll(upperListTribe);
|
||||||
@@ -174,24 +195,23 @@ public class Board {
|
|||||||
}
|
}
|
||||||
upperListTribe.add(tempCard);
|
upperListTribe.add(tempCard);
|
||||||
}
|
}
|
||||||
for(int i=upperListTribe.size();i<nTotem+5;i++)
|
|
||||||
{
|
|
||||||
TribeCard tempCard = tribeDeck.remove();
|
|
||||||
upperListTribe.add(tempCard);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return era;
|
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() {
|
private void nextEra() {
|
||||||
era=era+1;
|
era=era+1;
|
||||||
lowerListBuilding.clear();
|
lowerListBuilding.clear();
|
||||||
lowerListBuilding.addAll(upperListBuilding);
|
lowerListBuilding.addAll(upperListBuilding);
|
||||||
upperListBuilding.clear();
|
upperListBuilding.clear();
|
||||||
|
|
||||||
List<BuildingCard> buildingCards=DecksCreator.loadBuildingDeckByEra(era);
|
ArrayList<BuildingCard> buildingCards= new ArrayList<>(DecksCreator.loadBuildingDeckByEra(era));
|
||||||
Collections.shuffle(buildingCards);
|
Collections.shuffle(buildingCards);
|
||||||
if(era==2)
|
if(era==2)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user