diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-10 22:24:56 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-05-10 22:24:56 +0200 |
commit | d08c876b0137a340ae749f32d8736220a65c1f6d (patch) | |
tree | ce4be1c38b1013a0cbae23dc24a674a420c04a14 | |
parent | Update gradle wrapper to 3.5 (diff) | |
download | seven-wonders-d08c876b0137a340ae749f32d8736220a65c1f6d.tar.gz seven-wonders-d08c876b0137a340ae749f32d8736220a65c1f6d.tar.bz2 seven-wonders-d08c876b0137a340ae749f32d8736220a65c1f6d.zip |
Add time limit setting
3 files changed, 21 insertions, 0 deletions
diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/Game.java b/backend/src/main/java/org/luxons/sevenwonders/game/Game.java index 24cde764..45f12be0 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/Game.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/Game.java @@ -59,6 +59,10 @@ public class Game { return id; } + public Settings getSettings() { + return settings; + } + private void startNewAge() { table.increaseCurrentAge(); hands = decks.deal(table.getCurrentAge(), table.getNbPlayers()); diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java b/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java index 63ef3522..7d292594 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/Settings.java @@ -11,6 +11,8 @@ public class Settings { private final Random random; + private final int timeLimitInSeconds; + private final int nbPlayers; private final int initialGold; @@ -36,6 +38,7 @@ public class Settings { public Settings(int nbPlayers, CustomizableSettings customSettings) { long seed = customSettings.getRandomSeedForTests(); this.random = seed > 0 ? new Random(seed) : new Random(); + this.timeLimitInSeconds = customSettings.getTimeLimitInSeconds(); this.nbPlayers = nbPlayers; this.initialGold = customSettings.getInitialGold(); this.discardedCardGold = customSettings.getDiscardedCardGold(); @@ -50,6 +53,10 @@ public class Settings { return random; } + public int getTimeLimitInSeconds() { + return timeLimitInSeconds; + } + public int getNbPlayers() { return nbPlayers; } diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java b/backend/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java index c270a2af..ee6a7714 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/api/CustomizableSettings.java @@ -9,6 +9,8 @@ public class CustomizableSettings { private long randomSeedForTests = -1; + private int timeLimitInSeconds = 45; + private WonderSidePickMethod wonderSidePickMethod = WonderSidePickMethod.EACH_RANDOM; private int initialGold = 3; @@ -37,6 +39,14 @@ public class CustomizableSettings { this.randomSeedForTests = randomSeedForTests; } + public int getTimeLimitInSeconds() { + return timeLimitInSeconds; + } + + public void setTimeLimitInSeconds(int timeLimitInSeconds) { + this.timeLimitInSeconds = timeLimitInSeconds; + } + public int getInitialGold() { return initialGold; } |