diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 09:58:38 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 09:58:38 +0200 |
commit | 37f772c26cd927d5ee903e46b2c35f71feeec142 (patch) | |
tree | 278fa8f6e366a8679e269dc45e2fb43a93097d9a /core | |
parent | 15b3b7ddcdb60750df1c1874137565732e07b110 (diff) | |
download | RustAndDust-37f772c26cd927d5ee903e46b2c35f71feeec142.zip RustAndDust-37f772c26cd927d5ee903e46b2c35f71feeec142.tar.gz |
Player: add int d6(), fix setActionPoints()
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Player.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index 5a73b30..adc2f05 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -34,7 +34,7 @@ public class Player implements Drawable, Disposable this.units = new ArrayList<Pawn>(size); this.losses = new ArrayList<Pawn>(size); this.reinforcement = new ArrayList<Pawn>(size); - setActionPoints(); + this.actionPoints = 0; } public String toString() @@ -83,9 +83,19 @@ public class Player implements Drawable, Disposable System.err.println("TurnStart " + toString()); } + public int d6() + { + return rand.nextInt(6) + 1; + } + private void setActionPoints() { - this.actionPoints = 2 + rand.nextInt(3); + this.actionPoints = 2; + if (d6() > 2) { + this.actionPoints += 1; + if (d6() > 3) + this.actionPoints += 1; + } } public boolean isEnemy(Pawn pawn) |