diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-09 16:59:10 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-09 16:59:10 +0100 |
commit | 0eb5c308137c6a64a09d4d67f26c8454c3a682be (patch) | |
tree | fa8796ae8662aae0b0ea02de1627c203e5596713 /core/src/ch/asynk/rustanddust/game/battles | |
parent | 287f4591ce83aaaec4ab7e5bcca61964a1403dcc (diff) | |
download | RustAndDust-0eb5c308137c6a64a09d4d67f26c8454c3a682be.zip RustAndDust-0eb5c308137c6a64a09d4d67f26c8454c3a682be.tar.gz |
Player,BattleCommon: AP computation goes into Battle
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/battles')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index e84961f..0cd753e 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -33,6 +33,22 @@ public abstract class BattleCommon implements Battle public abstract Player getWinner(); + private int d6() + { + return random.nextInt(6) + 1; + } + + protected int getActionPoints() + { + int aps = 2; + if (d6() > 2) { + aps += 1; + if (d6() > 3) + aps += 1; + } + return aps; + } + public BattleCommon(Factory factory) { this.factory = factory; @@ -93,7 +109,7 @@ public abstract class BattleCommon implements Battle return true; } else { currentPlayer = getNextPlayer(); - currentPlayer.turnStart(); + currentPlayer.turnStart(getActionPoints()); return false; } } |