Add: Partial Implementation Of The toString Method And Test in Player.java And PlayerTest.java II.

This commit is contained in:
GabrieleRadice
2026-04-12 19:38:04 +02:00
parent c18d00ab0a
commit adfdf755a6
2 changed files with 20 additions and 2 deletions
@@ -226,14 +226,21 @@ public class Player {
// TODO tostring usr + food + prestige \n tab foreach(characters.cards + spazio)
@Override
public String toString() {
return this.getUserName() + ":\n\tFood: " + this.getFoodValue()
String toPrint = "";
toPrint = this.getUserName() + ":\n\tFood: " + this.getFoodValue()
+ "\n\tPrestige: " + this.getPrestigeValue()
+ "\n\tArtists: " + this.artists.toString()
+ "\n\tBuilders: " + this.builders.toString()
+ "\n\tGatherers: " + this.gatherers.toString()
+ "\n\tShamans: " + this.shamans.toString()
+ "\n\tHunters: " + this.hunters.toString()
+ "\n\tBuildings:" + this.buildingCards.toString().indent(1);
+ "\n\tBuildings: \n";
for (BuildingCard buildingCard : this.buildingCards) {
toPrint += buildingCard.toString().indent(8);
toPrint += toPrint.replaceAll("\\n$", "") + "]";
}
return toPrint;
}
// endregion functions
}