Add: endGame Partial, PickOptionalTribeCard, PickOptionalBuildingCard, NoOptionalCard, Fixed Player.java
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
|
||||
@@ -207,13 +208,55 @@ public class Game {
|
||||
//endregion
|
||||
|
||||
//region Optional Card Methods
|
||||
// TODO fare mappa per contare più volte lo stesso player
|
||||
public boolean PickOptionalTribeCard(Player player,TribeCard tribeCard) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
return false;
|
||||
}
|
||||
if(!board.containsUpperTribeCard(tribeCard)){
|
||||
return false;
|
||||
}
|
||||
if(tribeCard.IsEventCard()){
|
||||
return false;
|
||||
}
|
||||
Character tempCard = (Character) tribeCard;
|
||||
tempCard.insert(player);
|
||||
board.removeUpperTribeCard(tempCard);
|
||||
nextPlayerSetup();
|
||||
|
||||
return true;
|
||||
}
|
||||
public boolean PickOptionalBuildingCard(Player player, BuildingCard buildingCard) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
return false;
|
||||
}
|
||||
if(!board.containsUpperBuildingCard(buildingCard)){
|
||||
return false;
|
||||
}
|
||||
if(buildingCard.buy(player)) {
|
||||
board.removeUpperBuildingCard(buildingCard);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
nextPlayerSetup();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean NoOptionalCard(Player player) {
|
||||
if(currentState.getGameStage() != GameStages.OPTIONAL_CARD_EFFECT){
|
||||
return false;
|
||||
}
|
||||
if(!player.equals(currentState.getCurrentPlayer())){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//endregion
|
||||
@@ -305,10 +348,14 @@ public class Game {
|
||||
}
|
||||
private void endGame() {
|
||||
//DO SOMETHING THEN
|
||||
for(Player p : playersList){
|
||||
List<BuildingCard> cards = p.buildingCards.stream().
|
||||
filter(x -> x.getEffectType() == EffectType.FINAL).toList();
|
||||
}
|
||||
currentState.GameStageUpdate(GameStages.ENDED);
|
||||
}
|
||||
|
||||
|
||||
// TODO endGame, optional cards,
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -104,14 +104,5 @@ public class Player {
|
||||
// End constructors
|
||||
|
||||
// Functions
|
||||
// TODO
|
||||
public void Play(Slot slot){
|
||||
|
||||
}
|
||||
|
||||
// TODO
|
||||
public void SlotChoice(){
|
||||
|
||||
}
|
||||
// End functions
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user