summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-01 18:47:25 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-01 18:47:25 +0100
commit76b080ca82d6179f8068139c65083cf052c4f767 (patch)
treeea4260575c0016d98c8db9da258ef25b72a2780d
parent11ee5ac82845d152712766d6190cee7b74990196 (diff)
downloadRustAndDust-76b080ca82d6179f8068139c65083cf052c4f767.zip
RustAndDust-76b080ca82d6179f8068139c65083cf052c4f767.tar.gz
Player: actionPoints -> ap
-rw-r--r--core/src/ch/asynk/rustanddust/game/Factory.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/Player.java29
2 files changed, 17 insertions, 16 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Factory.java b/core/src/ch/asynk/rustanddust/game/Factory.java
index fb780a3..996da3d 100644
--- a/core/src/ch/asynk/rustanddust/game/Factory.java
+++ b/core/src/ch/asynk/rustanddust/game/Factory.java
@@ -108,9 +108,9 @@ public class Factory implements Board.TileBuilder, Disposable
public Player getPlayer(int id, Army army)
{
if (army == Army.US)
- return new Player(game, id, Army.US, 10);
+ return new Player(id, Army.US);
else
- return new Player(game, id, Army.GE, 10);
+ return new Player(id, Army.GE);
}
public Unit getUnit(UnitId id, boolean hq, boolean ace)
diff --git a/core/src/ch/asynk/rustanddust/game/Player.java b/core/src/ch/asynk/rustanddust/game/Player.java
index 1938b55..ca4fc88 100644
--- a/core/src/ch/asynk/rustanddust/game/Player.java
+++ b/core/src/ch/asynk/rustanddust/game/Player.java
@@ -5,11 +5,12 @@ import ch.asynk.rustanddust.RustAndDust;
public class Player
{
private static final float MOVE_TIME = 0.4f;
+ private static final int N = 10;
private int id;
private int turn;
private int apSpent;
- private int actionPoints;
+ private int ap;
public Army army;
public UnitList units;
@@ -22,17 +23,17 @@ public class Player
public int engagementWon;
public int engagementLost;
- public Player(final RustAndDust game, int id, Army army, int n)
+ public Player(int id, Army army)
{
this.id = id;
this.army = army;
- this.units = new UnitList(n);
- this.casualties = new UnitList(n);
- this.reinforcement = new UnitList(n);
- this.withdrawed = new UnitList(n);
+ this.units = new UnitList(N);
+ this.casualties = new UnitList(N);
+ this.reinforcement = new UnitList(N);
+ this.withdrawed = new UnitList(N);
this.turn = 0;
this.apSpent = 0;
- this.actionPoints = 0;
+ this.ap = 0;
this.actionCount = 0;
this.objectivesWon = 0;
this.engagementWon = 0;
@@ -51,7 +52,7 @@ public class Player
public String toString()
{
- return String.format("%s Turn:%d AP:%d units:%d casualties:%d", army, turn, actionPoints, units.size(), casualties.size());
+ return String.format("%s Turn:%d AP:%d/%d units:%d casualties:%d", army, turn, apSpent, ap, units.size(), casualties.size());
}
public String getStats()
@@ -140,7 +141,7 @@ public class Player
public int getAp()
{
- return ((apSpent < actionPoints) ? (apSpent + 1) : apSpent);
+ return ((apSpent < ap) ? (apSpent + 1) : apSpent);
}
public int getTurn()
@@ -150,7 +151,7 @@ public class Player
public boolean apExhausted()
{
- return (apSpent == actionPoints);
+ return (apSpent == ap);
}
public boolean canDoSomething()
@@ -173,13 +174,13 @@ public class Player
{
apSpent += 1;
actionCount += 1;
- RustAndDust.debug("Player", String.format("%d/%d - %d", apSpent, actionPoints, actionCount));
- if (apSpent > actionPoints) RustAndDust.debug("ERROR: spent too much AP, please report");
+ RustAndDust.debug("Player", String.format("%d/%d - %d", apSpent, ap, actionCount));
+ if (apSpent > ap) RustAndDust.debug("ERROR: spent too much AP, please report");
}
public void turnEnd()
{
- apSpent = actionPoints;
+ apSpent = ap;
for (Unit unit : units)
unit.reset();
}
@@ -187,7 +188,7 @@ public class Player
public void turnStart(int aps)
{
if (isDeploymentDone()) {
- actionPoints = aps;
+ ap = aps;
apSpent = 0;
turn += 1;
}