summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-18 11:32:44 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-18 11:32:44 +0100
commit9ed71f01974aefe888e54b7c099852ecd8323bb7 (patch)
treea53fecca5f8ff383ccb7eed94857711a23329a14 /core/src
parent57ba38f91476bf21ff72f387baaaa5577e31156d (diff)
downloadRustAndDust-9ed71f01974aefe888e54b7c099852ecd8323bb7.zip
RustAndDust-9ed71f01974aefe888e54b7c099852ecd8323bb7.tar.gz
Pawn: add int attackDistance(), and use it in Map
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java5
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java5
2 files changed, 7 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 2986002..7e0f9da 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -175,6 +175,11 @@ public abstract class Pawn implements Moveable, Disposable
return (attack.isClear && attack.isFlank);
}
+ public int attackDistance()
+ {
+ return attack.distance;
+ }
+
public Tile getTile()
{
return tile;
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index c19ee62..2ef7749 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -489,9 +489,8 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
if (assist.isA(Unit.UnitType.INFANTRY))
terrainBonus = false;
if (night) {
- int d = distance(assist.getTile(), target.getTile());
- if (d > distance)
- distance = d;
+ if (distance < assist.attackDistance())
+ distance = assist.attackDistance();
}
}