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

@@ -69,10 +69,11 @@ public class DeckGridAppFX extends Application {
public void start(Stage primaryStage) {
List<Player> players = new ArrayList<>();
//players.add(new Player("Yellow", TotemColor.YELLOW));
players.add(new Player("Yellow", TotemColor.YELLOW));
players.add(new Player("Blue", TotemColor.BLUE));
//players.add(new Player("Purple", TotemColor.PURPLE));
players.add(new Player("Red", TotemColor.RED));
//players.add(new Player("Purple", TotemColor.PURPLE));
//players.add(new Player("Green", TotemColor.GREEN));
Game game = new Game(players);

View File

@@ -35,7 +35,7 @@ public class EventsSolver {
public static List<Integer> sustainment(EventCard event, List<Player> players){
if(event.getEvent() != Event.SUSTAINMENT){throw new EventsManagerException("Not a sustainment card");}
//if(event.getEvent() != Event.SUSTAINMENT){throw new EventsManagerException("Not a sustainment card");}
List<Integer> result = new ArrayList<>();
for(Player p: players){

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

View File

@@ -622,9 +622,11 @@ public class Game {
}
private void resolveOneEvent(EventCard event) {
logger.info(">>"+gameBoard.getTurnTile());
notify( GameState.EVENT_RESOLUTION, event.toString());
logger.info("EVENT Resolving: " + event.getEvent() + " (Era " + event.getEra() + ")");
EventsSolver.solveEvents(Collections.singletonList(event), players);
logger.info("<<"+gameBoard.getTurnTile());
}
private void startNewRound() {

View File

@@ -15,13 +15,13 @@ public class GameUtils {
public static String formatCard(Card c) {
if (c instanceof EventCard e) {
return "(E "+e.getCardId() + " " + e.getEvent()+ " Era" +e.getEra() +")";
return "(E "+e.getCardId() + " " + e.getEvent()+ " - " +e.getEra() +")";
}
if (c instanceof CharacterCard cc) {
return "(C "+cc.getCardId() + " " +cc.getCharacterType() + " Era" +cc.getEra() + ")";
return "(C "+cc.getCardId() + " " +cc.getCharacterType() + " - " +cc.getEra() + ")";
}
if (c instanceof BuildingCard b) {
return "(B "+b.getCardId() + " Era" +b.getEra() + ")";
return "(B "+b.getCardId() + " - " +b.getEra() + ")";
}
return "(#" + c.getCardId() + " UNKNOWN)";
}

View File

@@ -16,13 +16,13 @@ C;15;0;I;ARTIST;0;0
C;16;0;I;ARTIST;0;0
C;17;3;I;ARTIST;0;0
C;18;4;I;ARTIST;0;0
C;19;0;I;INVENTOR;8;0
C;20;0;I;INVENTOR;0;0
C;21;0;I;INVENTOR;1;0
C;22;0;I;INVENTOR;9;0
C;19;0;I;INVENTOR;1;0
C;20;0;I;INVENTOR;2;0
C;21;0;I;INVENTOR;3;0
C;22;0;I;INVENTOR;4;0
C;23;4;I;INVENTOR;5;0
C;24;4;I;INVENTOR;7;0
C;25;4;I;INVENTOR;4;0
C;24;4;I;INVENTOR;6;0
C;25;4;I;INVENTOR;7;0
C;26;5;I;SHAMAN;2;0
C;27;0;I;SHAMAN;2;0
C;28;0;I;SHAMAN;1;0
@@ -45,12 +45,12 @@ C;44;3;II;ARTIST;0;0
C;45;0;II;ARTIST;0;0
C;46;0;II;ARTIST;0;0
C;47;0;II;ARTIST;0;0
C;48;0;II;INVENTOR;0;0
C;49;4;II;INVENTOR;0;0
C;50;0;II;INVENTOR;0;0
C;51;0;II;INVENTOR;0;0
C;52;0;II;INVENTOR;0;0
C;53;0;II;INVENTOR;0;0
C;48;0;II;INVENTOR;8;0
C;49;4;II;INVENTOR;9;0
C;50;0;II;INVENTOR;5;0
C;51;0;II;INVENTOR;6;0
C;52;0;II;INVENTOR;7;0
C;53;0;II;INVENTOR;1;0
C;54;0;II;SHAMAN;2;0
C;55;0;II;SHAMAN;2;0
C;56;5;II;SHAMAN;1;0
@@ -70,13 +70,13 @@ C;69;5;III;ARTIST;0;0
C;70;0;III;ARTIST;0;0
C;71;0;III;ARTIST;0;0
C;72;0;III;ARTIST;0;0
C;73;4;III;INVENTOR;0;0
C;74;3;III;INVENTOR;0;0
C;75;3;III;INVENTOR;0;0
C;76;0;III;INVENTOR;0;0
C;77;0;III;INVENTOR;0;0
C;78;0;III;INVENTOR;0;0
C;79;0;III;INVENTOR;0;0
C;73;4;III;INVENTOR;10;0
C;74;3;III;INVENTOR;2;0
C;75;3;III;INVENTOR;3;0
C;76;0;III;INVENTOR;8;0
C;77;0;III;INVENTOR;9;0
C;78;0;III;INVENTOR;10;0
C;79;0;III;INVENTOR;4;0
C;80;3;III;SHAMAN;2;0
C;81;0;III;SHAMAN;3;0
C;82;0;III;SHAMAN;2;0
1 C 1 0 I HUNTER 1 0
16 C 16 0 I ARTIST 0 0
17 C 17 3 I ARTIST 0 0
18 C 18 4 I ARTIST 0 0
19 C 19 0 I INVENTOR 8 1 0
20 C 20 0 I INVENTOR 0 2 0
21 C 21 0 I INVENTOR 1 3 0
22 C 22 0 I INVENTOR 9 4 0
23 C 23 4 I INVENTOR 5 0
24 C 24 4 I INVENTOR 7 6 0
25 C 25 4 I INVENTOR 4 7 0
26 C 26 5 I SHAMAN 2 0
27 C 27 0 I SHAMAN 2 0
28 C 28 0 I SHAMAN 1 0
45 C 45 0 II ARTIST 0 0
46 C 46 0 II ARTIST 0 0
47 C 47 0 II ARTIST 0 0
48 C 48 0 II INVENTOR 0 8 0
49 C 49 4 II INVENTOR 0 9 0
50 C 50 0 II INVENTOR 0 5 0
51 C 51 0 II INVENTOR 0 6 0
52 C 52 0 II INVENTOR 0 7 0
53 C 53 0 II INVENTOR 0 1 0
54 C 54 0 II SHAMAN 2 0
55 C 55 0 II SHAMAN 2 0
56 C 56 5 II SHAMAN 1 0
70 C 70 0 III ARTIST 0 0
71 C 71 0 III ARTIST 0 0
72 C 72 0 III ARTIST 0 0
73 C 73 4 III INVENTOR 0 10 0
74 C 74 3 III INVENTOR 0 2 0
75 C 75 3 III INVENTOR 0 3 0
76 C 76 0 III INVENTOR 0 8 0
77 C 77 0 III INVENTOR 0 9 0
78 C 78 0 III INVENTOR 0 10 0
79 C 79 0 III INVENTOR 0 4 0
80 C 80 3 III SHAMAN 2 0
81 C 81 0 III SHAMAN 3 0
82 C 82 0 III SHAMAN 2 0