fix cards INVENTORS iconValue
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
@@ -89,15 +89,10 @@ class GameTest {
|
||||
ActionResult result = game.resolveCardAction(p, false, cdown.getCardId());
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user