From d08c876b0137a340ae749f32d8736220a65c1f6d Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Wed, 10 May 2017 22:24:56 +0200 Subject: Add time limit setting --- backend/src/main/java/org/luxons/sevenwonders/game/Game.java | 4 ++++ .../src/main/java/org/luxons/sevenwonders/game/Settings.java | 7 +++++++ .../org/luxons/sevenwonders/game/api/CustomizableSettings.java | 10 ++++++++++ 3 files changed, 21 insertions(+) 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; } -- cgit