Files
Progetto-ingegneria-del-sof…/src/main/java/it/polimi/ingsw/gc14/Model/Player.java
T
2026-03-15 15:57:26 +01:00

109 lines
2.4 KiB
Java

package it.polimi.ingsw.gc14.Model;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
import java.util.ArrayList;
import static java.lang.Math.abs;
public class Player {
// Getters
private String UserName;
public String getUserName() {
return UserName;
}
private ArrayList <Character> CharacterCards;
public ArrayList <TribeCard> getCharacterCards() {
return CharacterCards.clone();
}
private ArrayList <BuildingCard> BuildingCards;
public ArrayList <BuildingCard> getBuildingCards() {
return BuildingCards;
}
private int FoodValue;
public int getFoodValue() {
return FoodValue;
}
private int PrestigeValue;
public int getPrestigeValue() {
return PrestigeValue;
}
/* TODO
* private Game game;
* public Game getGame(){
* return Game;
* }
*/
// End getters
// Setters
public void setUserName(String UserName) throws IllegalArgumentException{
int max_len = 32;
if(UserName.length() > max_len || UserName.length() == 0){
throw new IllegalArgumentException();
}
this.UserName = UserName;
}
public void setTribeCards(ArrayList <TribeCard> TribeCards){
this.TribeCards = TribeCards;
}
public void setBuildingCards(ArrayList <BuildingCard> BuildingCards){
this.BuildingCards = BuildingCards;
}
public void addFood(int Value){
this.FoodValue += Value;
}
// TODO, chiedere prof (throws IllegalArgument)
public Boolean removeFood(int Value){
// Value = abs(Value); chiedere prof
if(Value > this.FoodValue){
return false;
}
this.FoodValue -= Value;
return true;
}
public void addPrestige(int Value){
this.PrestigeValue += Value;
}
public void removePrestige(int Value){
this.PrestigeValue -= Value;
}
// End setters
// Constructors
public Player(String UserName){
this.UserName = UserName;
this.TribeCards = new ArrayList<TribeCard>();
this.BuildingCards = new ArrayList<BuildingCard>();
this.FoodValue = 0;
this.PrestigeValue = 0;
}
// End constructors
// Functions
// TODO
public void Play(Slot slot){
}
// TODO
public void SlotChoice(){
}
// End functions
}