diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-05 16:41:08 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-05 16:41:08 +0100 |
commit | cc3af93a06f86b60f6f7265f7fca10b46b3fdd7e (patch) | |
tree | ccecefcd5276524b01b3d78a84130da0e082bf4f /core | |
parent | 6edb6023b2bf9ce6087a2a55281b93e9c515aa7e (diff) | |
download | RustAndDust-cc3af93a06f86b60f6f7265f7fca10b46b3fdd7e.zip RustAndDust-cc3af93a06f86b60f6f7265f7fca10b46b3fdd7e.tar.gz |
Pawn: enter/rotate/move/attack -> move() and attack()
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 26 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateMove.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateRotate.java | 2 |
6 files changed, 18 insertions, 27 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 9300d73..e765ab0 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -444,7 +444,7 @@ public abstract class Board implements Disposable seq.addAnimation(whenDone); addAnimation(seq); - pawn.move(possiblePaths.pathCost(0)); + pawn.move(); } protected void rotatePawn(final Pawn pawn, Orientation o, RunnableAnimation whenDone) @@ -457,7 +457,7 @@ public abstract class Board implements Disposable seq.addAnimation(whenDone); addAnimation(seq); - pawn.rotate(o); + pawn.move(); } protected void revertLastPawnMove(final Pawn pawn, RunnableAnimation whenDone) diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 3d0b341..d5ed8fe 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -117,10 +117,8 @@ public abstract class Pawn implements Moveable, Disposable public abstract boolean canAttack(Pawn other); public abstract boolean canAssistAttackWithoutLos(); - public abstract void enter(int cost); - public abstract void move(int cost); - public abstract void rotate(Orientation o); - public abstract void attack(Pawn target); + public abstract void move(); + public abstract void attack(); public abstract void revertLastMove(); diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 6e6d959..cbd84aa 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -274,7 +274,7 @@ public abstract class Map extends Board breakPawns.clear(); for (Pawn p : activatedPawns) { - p.attack(target); + p.attack(); if (p.isA(Unit.UnitType.INFANTRY)) breakPawns.add(p); } diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 9bfff7a..1bccde9 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -198,29 +198,21 @@ public class Unit extends HeadedPawn } @Override - public void rotate(Orientation o) + public void move() { - hasMoved = true; - } + System.err.println(move.toString()); + if (move.cost > mpLeft) System.err.println("ERROR: Movement point exceeded: " + move.cost + "/" + mpLeft + " please report"); - @Override - public void enter(int cost) - { - if (cost > mp) System.err.println("ERROR: Movement point exceeded: " + cost + "/" + mp + " please report"); - mpLeft -= cost; - } - - @Override - public void move(int cost) - { - hasMoved = true; - if (cost > mp) System.err.println("ERROR: Movement point exceeded: " + cost + "/" + mp + " please report"); - mpLeft = 0; + if (!move.entryMove) { + hasMoved = true; + } + mpLeft -= move.cost; } @Override - public void attack(Pawn target) + public void attack() { + System.err.println(attack.toString()); hasFired = true; } diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index b3ba2d6..f96678a 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -91,8 +91,9 @@ public class StateMove extends StateCommon { hideAssists(); // be sure that the hq is activated - if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) - selectedUnit.move(0); + if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) { + selectedUnit.move(); + } super.done(); } diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index 3e72a2b..2b63535 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -84,7 +84,7 @@ public class StateRotate extends StateCommon { doRotation(o); if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) - selectedUnit.move(0); + selectedUnit.move(); super.done(); } |