2024-04-29 21:06:04 +02:00
|
|
|
package domain;
|
|
|
|
|
|
|
|
public class Player {
|
|
|
|
int playerNumber;
|
|
|
|
String name;
|
|
|
|
String color;
|
|
|
|
int score;
|
2024-05-04 21:06:05 +02:00
|
|
|
Sheet sheet;
|
2024-04-29 21:06:04 +02:00
|
|
|
|
2024-05-06 22:55:58 +02:00
|
|
|
public Player(int playerNumber, String name, String color, int score, String gamemode) {
|
2024-04-29 21:06:04 +02:00
|
|
|
this.playerNumber = playerNumber;
|
|
|
|
this.name = name;
|
|
|
|
this.color = color;
|
|
|
|
this.score = score;
|
2024-05-04 21:06:05 +02:00
|
|
|
this.sheet = new Sheet();
|
2024-05-06 22:55:58 +02:00
|
|
|
|
|
|
|
if (gamemode.equals("default")){
|
|
|
|
this.sheet = new Sheet();
|
|
|
|
}
|
|
|
|
else if (gamemode.equals("starwars")){
|
|
|
|
this.sheet = new StarwarsSheet();
|
|
|
|
}
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|
2024-04-29 21:17:51 +02:00
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
|
|
|
|
public void newSheet(){
|
|
|
|
this.sheet = new Sheet();
|
|
|
|
}
|
|
|
|
|
2024-05-06 17:19:11 +02:00
|
|
|
public Sheet getSheet(){
|
|
|
|
return this.sheet;
|
|
|
|
}
|
2024-05-04 21:06:05 +02:00
|
|
|
|
2024-05-06 22:55:58 +02:00
|
|
|
|
|
|
|
public void setScore(int score){
|
|
|
|
this.score = score;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getScore(){
|
|
|
|
return this.score;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getName(){
|
|
|
|
return this.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-29 21:17:51 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
String ANSI_RESET = "\u001B[0m";
|
|
|
|
String coloredName = String.format(this.color + this.name + ANSI_RESET);
|
2024-05-04 21:06:05 +02:00
|
|
|
return String.format("%s", coloredName);
|
2024-04-29 21:17:51 +02:00
|
|
|
}
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|