summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-17 16:47:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-17 16:47:36 +0100
commit62b676bc73b68a340b8497c1936a69af060ff305 (patch)
tree06edcaa71651d151dee2174cd5b40703622ebfc4 /core/src/ch/asynk/tankontank/game
parentcd44e92ec822b4bf4cb75ed00f4bfe426c00f280 (diff)
downloadRustAndDust-62b676bc73b68a340b8497c1936a69af060ff305.zip
RustAndDust-62b676bc73b68a340b8497c1936a69af060ff305.tar.gz
Tile,Hex: replace int defenseFor(Pawn, Pawn, Board.PawnCollection) with int defense()
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java32
1 files changed, 2 insertions, 30 deletions
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);
}
}