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)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user