@@ -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 += "\t\t]";
|
||||
return toPrint;
|
||||
}
|
||||
// endregion functions
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.polimi.ingsw.gc14.Model;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.*;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
@@ -192,4 +193,16 @@ class PlayerTest {
|
||||
Player p = new Player("");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void tostring() {
|
||||
Player p = new Player("test_usr");
|
||||
p.addPrestige(15);
|
||||
p.addFood(7);
|
||||
p.artists.add(new Artist(1));
|
||||
p.artists.add(new Artist(2));
|
||||
p.buildingCards.add(new BuildingCard(1,2, 5));
|
||||
p.buildingCards.add(new BuildingCard(2,3, 6));
|
||||
System.out.println(p.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user