fix cards INVENTORS iconValue

This commit is contained in:
2026-04-13 21:35:44 +02:00
parent 188989bb8e
commit 9a662a27a7
7 changed files with 45 additions and 58 deletions

View File

@@ -45,35 +45,27 @@ public class Tribe {
// Metodo per ottenere lo sconto in cibo in base a quanti gatherer abbiamo nella tribù
public int gathererDiscount() {
int discount = 0;
for (CharacterCard c : characters) {
if (c.getCharacterType() == CharacterType.GATHERER) {
discount += 3; // i gatherers prendono sempre 3 cibi
}
}
return discount;
long gatherers = characters.stream()
.filter(c -> c.getCharacterType() == CharacterType.GATHERER)
.count();
return (int) gatherers * 3;
}
// Metodo per ottenere lo sconto totale sugli edifici grazie ai builder nella tribù
public int buildersDiscount() {
int discount = 0;
for (CharacterCard c : characters) {
if (c.getCharacterType() == CharacterType.BUILDER) {
discount += c.getIconValue(); // con getIconValue intendo lo sconto del costruttore
}
}
return discount;
return characters.stream()
.filter(c -> c.getCharacterType() == CharacterType.BUILDER)
.mapToInt(CharacterCard::getIconValue)
.sum();
}
// Metodo che conta quante stelle degli sciamani abbiamo in totale nella tribù
public int shamansIcons() {
int totalIcons = 0;
for (CharacterCard c : characters) {
if (c.getCharacterType() == CharacterType.SHAMAN) {
totalIcons += c.getIconValue();
}
}
return totalIcons;
return characters.stream()
.filter(c -> c.getCharacterType() == CharacterType.SHAMAN)
.mapToInt(CharacterCard::getIconValue)
.sum();
}
// Metodo che restituisce il numero di artisti nella tribù
@@ -88,13 +80,10 @@ public class Tribe {
// Metodo universale per contare le carte di un certo tipo all'interno della tribù
public int countCharactersByType(CharacterType typeToCount) {
int count = 0;
for (CharacterCard c : characters) {
if (c.getCharacterType() == typeToCount) {
count++;
}
}
return count;
long count = characters.stream()
.filter(c -> c.getCharacterType() == typeToCount)
.count();
return (int) count;
}
// Metodo che ritorna il numero totale di cibi ottenuti dopo aver pescato il cacciatore col cosciotto