summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/Pawn.java1
-rw-r--r--core/src/ch/asynk/rustanddust/game/Unit.java13
-rw-r--r--core/test/ch/asynk/rustanddust/Helpers.java1
3 files changed, 14 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
diff --git a/core/test/ch/asynk/rustanddust/Helpers.java b/core/test/ch/asynk/rustanddust/Helpers.java
index bc5b4d6..c5164cd 100644
--- a/core/test/ch/asynk/rustanddust/Helpers.java
+++ b/core/test/ch/asynk/rustanddust/Helpers.java
@@ -12,6 +12,7 @@ public class Helpers
{
public static class FakePawn extends HeadedPawn
{
+ @Override public int getSpentMovementPoints() { return 0; }
@Override public int getMovementPoints() { return 3; }
@Override public int getRoadMarchBonus() { return 1; }
@Override public int getFlankSides() { return orientation.getBackSides(); }