summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-20 10:22:22 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-20 10:22:22 +0200
commit6a85509a168d7dff26424f0d8022ae33624cbaf7 (patch)
tree5363fcb197e4ef76f7520af32372706458df2de6 /core/src/ch/asynk/tankontank/game
parentc5fef55dfb3452c86e3c7a3c54f09263ce3c7cff (diff)
downloadRustAndDust-6a85509a168d7dff26424f0d8022ae33624cbaf7.zip
RustAndDust-6a85509a168d7dff26424f0d8022ae33624cbaf7.tar.gz
Pawn,Unit: add boolean isHardTarget() this fixes canMove/Rotate/Attack
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index f047de4..822472a 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -127,6 +127,12 @@ public class Unit extends HeadedPawn
}
@Override
+ public boolean isHardTarget()
+ {
+ return ((type == UnitType.HARD_TARGET) || (type == UnitType.HARD_TARGET_HQ));
+ }
+
+ @Override
public boolean isHqOf(Pawn other)
{
if ((id == UnitId.GE_PANZER_IV_HQ) && (((Unit)other).id == UnitId.GE_PANZER_IV)) return true;
@@ -144,21 +150,21 @@ public class Unit extends HeadedPawn
@Override
public boolean canRotate()
{
- if (type == UnitType.HARD_TARGET) return !hasMoved;
+ if (isHardTarget()) return !hasMoved;
return (!hasMoved && !hasFired);
}
@Override
public boolean canMove()
{
- if (type == UnitType.HARD_TARGET) return !hasMoved;
+ if (isHardTarget()) return !hasMoved;
return (!hasMoved && !hasFired);
}
@Override
public boolean canAttack()
{
- if (type == UnitType.HARD_TARGET) return !hasFired;
+ if (isHardTarget()) return !hasFired;
return (!hasMoved && !hasFired);
}