summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-05-02 17:54:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-05-02 17:54:22 +0200
commite3069eb0cf7ea8d8ebec6fbe312c5c2af37ea050 (patch)
tree553bb46987046943ab4918b5433e241f6da52696 /core/src/ch/asynk/rustanddust
parente8924d2e7bf6c93d0d2f0c5f2d9fa72b6b9a0f95 (diff)
downloadRustAndDust-e3069eb0cf7ea8d8ebec6fbe312c5c2af37ea050.zip
RustAndDust-e3069eb0cf7ea8d8ebec6fbe312c5c2af37ea050.tar.gz
Pawn,Unit: add spendMovementPoints(int) and getSpentMovementPoints()
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/Pawn.java1
-rw-r--r--core/src/ch/asynk/rustanddust/game/Unit.java13
2 files changed, 13 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Pawn.java b/core/src/ch/asynk/rustanddust/engine/Pawn.java
index 56e73f4..fc0323f 100644
--- a/core/src/ch/asynk/rustanddust/engine/Pawn.java
+++ b/core/src/ch/asynk/rustanddust/engine/Pawn.java
@@ -42,6 +42,7 @@ public abstract class Pawn implements Moveable, Disposable
protected Attack attack;
protected Move move;
+ public abstract int getSpentMovementPoints();
public abstract int getMovementPoints();
public abstract int getRoadMarchBonus();
public abstract int getAngleOfAttack();
diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java
index a55c7b3..7a9f2e2 100644
--- a/core/src/ch/asynk/rustanddust/game/Unit.java
+++ b/core/src/ch/asynk/rustanddust/game/Unit.java
@@ -132,6 +132,17 @@ public class Unit extends HeadedPawn
return ace;
}
+ public void spendMovementPoints(int n)
+ {
+ mpLeft -= n;
+ }
+
+ @Override
+ public int getSpentMovementPoints()
+ {
+ return (mp - mpLeft);
+ }
+
@Override
public int getMovementPoints()
{
@@ -307,7 +318,7 @@ public class Unit extends HeadedPawn
if ((cost > 0) && move.isFinal())
setMoved();
- mpLeft -= cost;
+ spendMovementPoints(cost);
}
@Override