summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-17 16:30:32 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-17 16:30:32 +0100
commitcd44e92ec822b4bf4cb75ed00f4bfe426c00f280 (patch)
treed0677055095276ba76d9976b289cca14347f91d3 /core/src
parentc627381b64f2395cbef72c9225e3828d5e7693ec (diff)
downloadRustAndDust-cd44e92ec822b4bf4cb75ed00f4bfe426c00f280.zip
RustAndDust-cd44e92ec822b4bf4cb75ed00f4bfe426c00f280.tar.gz
Unit: use isA(...)
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index c3d613e..4c71e2e 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -7,6 +7,7 @@ import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.Tile;
import ch.asynk.tankontank.engine.HeadedPawn;
import ch.asynk.tankontank.engine.Orientation;
+import ch.asynk.tankontank.game.Hex.Terrain;
import ch.asynk.tankontank.TankOnTank;
@@ -130,7 +131,7 @@ public class Unit extends HeadedPawn
@Override
public int getEngagementRangeFrom(Tile tile)
{
- if ((type != UnitType.INFANTRY) && (((Hex) tile).terrain == Hex.Terrain.HILLS))
+ if (!isA(UnitType.INFANTRY) && tile.isA(Terrain.HILLS))
return rng + 1;
return rng;
}
@@ -150,7 +151,7 @@ public class Unit extends HeadedPawn
@Override
public int getDefense(Tile tile)
{
- if (!isHardTarget() && (tile.isA(Hex.Terrain.HILLS) || tile.isA(Hex.Terrain.WOODS) || tile.isA(Hex.Terrain.TOWN)))
+ if (!isHardTarget() && (tile.isA(Terrain.HILLS) || tile.isA(Terrain.WOODS) || tile.isA(Terrain.TOWN)))
return cdef;
return def;
@@ -177,7 +178,7 @@ public class Unit extends HeadedPawn
@Override
public boolean isHq()
{
- return (type == UnitType.HARD_TARGET_HQ);
+ return isA(UnitType.HARD_TARGET_HQ);
}
@Override
@@ -192,7 +193,7 @@ public class Unit extends HeadedPawn
@Override
public boolean isHardTarget()
{
- return ((type == UnitType.HARD_TARGET) || (type == UnitType.HARD_TARGET_HQ) || (type == UnitType.ARTILLERY));
+ return (isA(UnitType.HARD_TARGET) || isA(UnitType.HARD_TARGET_HQ) || isA(UnitType.ARTILLERY));
}
@Override
@@ -219,7 +220,7 @@ public class Unit extends HeadedPawn
@Override
public boolean canAssistEngagementWithoutLos()
{
- return (type == UnitType.ARTILLERY);
+ return isA(UnitType.ARTILLERY);
}
@Override