summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:28:13 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:28:13 +0100
commitbcd434d698bc03697b259356b09ee3c8628cd191 (patch)
tree968f07fd0175f7fcb6b6f439fe0bf2a8d9303d1b /core/src
parentb3caf0b8cdd7f16857dd2d0e29ce4f519e924692 (diff)
downloadRustAndDust-bcd434d698bc03697b259356b09ee3c8628cd191.zip
RustAndDust-bcd434d698bc03697b259356b09ee3c8628cd191.tar.gz
Pawn.Attack: .reset() and .toString()
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java21
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java1
2 files changed, 20 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 79a382d..00978b2 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -27,11 +27,24 @@ public abstract class Pawn implements Moveable, Disposable
public class Attack
{
- int distance;
Pawn target;
+ int distance;
boolean isClear;
boolean isFlank;
public String calculus;
+
+ public String toString()
+ {
+ return "attack : " + target + " distance:" + distance + " clear:" + isClear + " flank:" + isFlank + " " + calculus;
+ }
+
+ public void reset()
+ {
+ target = null;
+ distance = 0;;
+ isClear = false;
+ isFlank = false;
+ }
}
private static final float MOVE_TIME = 0.4f;
@@ -69,7 +82,6 @@ public abstract class Pawn implements Moveable, Disposable
public abstract void rotate(Orientation o);
public abstract void attack(Pawn target);
- public abstract void reset();
public abstract void revertLastMove();
protected Pawn()
@@ -101,6 +113,11 @@ public abstract class Pawn implements Moveable, Disposable
image.dispose();
}
+ public void reset()
+ {
+ attack.reset();
+ }
+
public boolean isEnemy(Faction other)
{
return faction.isEnemy(other);
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index e604a3b..9bfff7a 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -227,6 +227,7 @@ public class Unit extends HeadedPawn
@Override
public void reset()
{
+ super.reset();
mpLeft = mp;
hasFired = false;
hasMoved = false;