diff options
Diffstat (limited to 'src/main/java/org/luxons')
4 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/Settings.java b/src/main/java/org/luxons/sevenwonders/game/Settings.java index cd847d8a..63ef3522 100644 --- a/src/main/java/org/luxons/sevenwonders/game/Settings.java +++ b/src/main/java/org/luxons/sevenwonders/game/Settings.java @@ -19,6 +19,8 @@ public class Settings { private final int defaultTradingCost; + private final int pointsPer3Gold; + private final WonderSidePickMethod wonderSidePickMethod; private WonderSide lastPickedSide = null; @@ -38,6 +40,7 @@ public class Settings { this.initialGold = customSettings.getInitialGold(); this.discardedCardGold = customSettings.getDiscardedCardGold(); this.defaultTradingCost = customSettings.getDefaultTradingCost(); + this.pointsPer3Gold = customSettings.getPointsPer3Gold(); this.wonderSidePickMethod = customSettings.getWonderSidePickMethod(); this.lostPointsPerDefeat = customSettings.getLostPointsPerDefeat(); this.wonPointsPerVictoryPerAge = customSettings.getWonPointsPerVictoryPerAge(); @@ -63,6 +66,10 @@ public class Settings { return defaultTradingCost; } + public int getPointsPer3Gold() { + return pointsPer3Gold; + } + public WonderSide pickWonderSide() { return lastPickedSide = wonderSidePickMethod.pickSide(getRandom(), lastPickedSide); } diff --git a/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java b/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java index c303c4b6..c270a2af 100644 --- a/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java +++ b/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java @@ -17,6 +17,8 @@ public class CustomizableSettings { private int defaultTradingCost = 2; + private int pointsPer3Gold = 1; + private int lostPointsPerDefeat = 1; private Map<Integer, Integer> wonPointsPerVictoryPerAge = new HashMap<>(); @@ -59,6 +61,14 @@ public class CustomizableSettings { this.defaultTradingCost = defaultTradingCost; } + public int getPointsPer3Gold() { + return pointsPer3Gold; + } + + public void setPointsPer3Gold(int pointsPer3Gold) { + this.pointsPer3Gold = pointsPer3Gold; + } + public WonderSidePickMethod getWonderSidePickMethod() { return wonderSidePickMethod; } diff --git a/src/main/java/org/luxons/sevenwonders/game/boards/Board.java b/src/main/java/org/luxons/sevenwonders/game/boards/Board.java index 23f85af7..85820e8d 100644 --- a/src/main/java/org/luxons/sevenwonders/game/boards/Board.java +++ b/src/main/java/org/luxons/sevenwonders/game/boards/Board.java @@ -39,13 +39,16 @@ public class Board { private int gold; + private int pointsPer3Gold; + public Board(Wonder wonder, Player player, Settings settings) { this.wonder = wonder; this.player = player; this.gold = settings.getInitialGold(); this.tradingRules = new TradingRules(settings.getDefaultTradingCost()); this.military = new Military(settings); - production.addFixedResource(wonder.getInitialResource(), 1); + this.pointsPer3Gold = settings.getPointsPer3Gold(); + this.production.addFixedResource(wonder.getInitialResource(), 1); } public Wonder getWonder() { @@ -130,6 +133,7 @@ public class Board { score.put(ScoreCategory.TRADE, computePointsForCards(table, Color.YELLOW)); score.put(ScoreCategory.GUILD, computePointsForCards(table, Color.PURPLE)); score.put(ScoreCategory.WONDER, wonder.computePoints(table, player.getIndex())); + score.put(ScoreCategory.GOLD, computeGoldPoints()); return score; } @@ -141,6 +145,10 @@ public class Board { .sum(); } + private int computeGoldPoints() { + return gold / 3 * pointsPer3Gold; + } + static class InsufficientFundsException extends RuntimeException { InsufficientFundsException(int current, int required) { super(String.format("Current balance is %d gold, but %d are required", current, required)); diff --git a/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java b/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java index 84d6ee73..54976072 100644 --- a/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java +++ b/src/main/java/org/luxons/sevenwonders/game/scoring/ScoreCategory.java @@ -1,5 +1,5 @@ package org.luxons.sevenwonders.game.scoring; public enum ScoreCategory { - CIVIL, SCIENCE, MILITARY, TRADE, GUILD, WONDER + CIVIL, SCIENCE, MILITARY, TRADE, GUILD, WONDER, GOLD } |