summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java32
2 files changed, 3 insertions, 31 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index ed861db..8a1e778 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -28,7 +28,7 @@ public abstract class Tile implements Drawable, Disposable, Iterable<Pawn>
private StackedImages overlays;
private ArrayDeque<Pawn> stack;
- public abstract int defenseFor(Pawn pawn, Pawn target, Board.PawnCollection foes);
+ public abstract int defense();
public abstract int costFrom(Pawn pawn, Orientation side);
public abstract boolean isOffMap();
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java
index 0499924..63f4422 100644
--- a/core/src/ch/asynk/tankontank/game/Hex.java
+++ b/core/src/ch/asynk/tankontank/game/Hex.java
@@ -116,36 +116,8 @@ public class Hex extends Tile
}
@Override
- public int defenseFor(Pawn pawn, Pawn target, Board.PawnCollection foes)
+ public int defense()
{
- Unit u = (Unit) target;
- boolean terrainBonus = true;
-
- for (Pawn foe : foes) {
- if (foe.isA(UnitType.INFANTRY))
- terrainBonus = false;
- }
-
- int tdef = 0;
- int def = u.def;
- switch(terrain) {
- case HILLS:
- if (!u.isA(UnitType.HARD_TARGET))
- def = u.cdef;
- break;
- case WOODS:
- case TOWN:
- if (!u.isA(UnitType.HARD_TARGET))
- def = u.cdef;
- if (terrainBonus)
- tdef = 1;
- break;
- default:
- def = ((Unit) target).def;
- break;
- }
-
- pawn.engagement.calculus += " >= " + def + " + " + tdef;
- return (def + tdef);
+ return (isA(Terrain.TOWN) ? 1 : 0);
}
}