diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-17 10:43:05 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-17 10:43:05 +0200 |
commit | 0c84007ab76062e7289ac9122ef3a02de9c9490e (patch) | |
tree | d262d187e6faa6b298d5ba490d2dbc06cc798c69 /core/src/ch/asynk | |
parent | 7173149e8d977647726271573a45e5089c29e377 (diff) | |
download | RustAndDust-0c84007ab76062e7289ac9122ef3a02de9c9490e.zip RustAndDust-0c84007ab76062e7289ac9122ef3a02de9c9490e.tar.gz |
Player: add turn and apSpent attributes
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Player.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Player.java b/core/src/ch/asynk/tankontank/game/Player.java index b164d2d..2dbc1b6 100644 --- a/core/src/ch/asynk/tankontank/game/Player.java +++ b/core/src/ch/asynk/tankontank/game/Player.java @@ -26,6 +26,8 @@ public class Player implements Drawable, Disposable private Army army; private Image flag; private Msg status; + private int turn; + private int apSpent; private int actionPoints; private ArrayList<Pawn> units; private ArrayList<Pawn> casualties; @@ -34,6 +36,7 @@ public class Player implements Drawable, Disposable public Player(final TankOnTank game, Army army, BitmapFont font, TextureAtlas atlas, String name, int size) { this.army = army; + this.turn = 0; this.actionPoints = 0; this.flag = new Image(atlas.findRegion(name)); this.units = new ArrayList<Pawn>(size); @@ -73,29 +76,27 @@ public class Player implements Drawable, Disposable public boolean apExhausted() { - return (actionPoints <= 0); + return (apSpent == actionPoints); } public void burnDownOneAp() { - actionPoints -= 1; + apSpent += 1; updateInfo(); - System.err.println("1 AP burned " + toString()); - if (actionPoints < 0) System.err.println("ERROR: AP < 0, damn that's very wrong, please report"); + if (apSpent > actionPoints) System.err.println("ERROR: spent too much AP, please report"); } public void turnEnd() { - System.err.println("TurnEnd " + toString()); } public void turnStart() { + turn += 1; for (Pawn pawn : units) pawn.reset(); computeActionPoints(); updateInfo(); - System.err.println("TurnStart " + toString()); } public int d6() @@ -111,11 +112,12 @@ public class Player implements Drawable, Disposable if (d6() > 3) this.actionPoints += 1; } + apSpent = 0; } private void updateInfo() { - status.write("AP: " + actionPoints, flag.getX(), (flag.getY() - 40), 0, 10); + status.write("Turn: " + turn + " AP: " + (apSpent + 1), flag.getX(), (flag.getY() - 40), 0, 10); } public boolean isEnemy(Pawn pawn) |