From 37f772c26cd927d5ee903e46b2c35f71feeec142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 13 Oct 2014 09:58:38 +0200 Subject: Player: add int d6(), fix setActionPoints() --- core/src/ch/asynk/tankontank/game/Player.java | 14 ++++++++++++-- 1 file 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(size); this.losses = new ArrayList(size); this.reinforcement = new ArrayList(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) -- cgit v1.1-2-g2b99