summaryrefslogtreecommitdiff
path: root/src/main/java/org/luxons/sevenwonders
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/luxons/sevenwonders')
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/boards/Military.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/boards/Military.java b/src/main/java/org/luxons/sevenwonders/game/boards/Military.java
index 08559336..fb93fa96 100644
--- a/src/main/java/org/luxons/sevenwonders/game/boards/Military.java
+++ b/src/main/java/org/luxons/sevenwonders/game/boards/Military.java
@@ -33,7 +33,10 @@ public class Military {
}
public void victory(int age) {
- int wonPoints = settings.getWonPointsPerVictoryPerAge().get(age);
+ Integer wonPoints = settings.getWonPointsPerVictoryPerAge().get(age);
+ if (wonPoints == null) {
+ throw new UnknownAgeException(age);
+ }
totalPoints += wonPoints;
}
@@ -42,4 +45,10 @@ public class Military {
totalPoints -= lostPoints;
nbDefeatTokens++;
}
+
+ static final class UnknownAgeException extends IllegalArgumentException {
+ UnknownAgeException(int unknownAge) {
+ super(String.valueOf(unknownAge));
+ }
+ }
}
bgstack15