diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hex.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index ef5b641..b586515 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -131,7 +131,7 @@ public class Hex extends Tile break; } - System.err.println(" def:" + def); + System.err.println(" >= " + def); return def; } } diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 2519ab0..6f20db8 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -257,10 +257,9 @@ public abstract class Map extends Board clearPointVector(possibleTargets); } - public boolean attackPawn(Pawn pawn, GridPoint2 from, GridPoint2 to, int dice) + public boolean attackPawn(Pawn pawn, Pawn target, GridPoint2 from, GridPoint2 to, int dice) { Hex hex = getHex(to.x, to.y); - Pawn target = hex.getTopPawn(); int activatedUnits = activatedPawns.size(); @@ -270,8 +269,15 @@ public abstract class Map extends Board } else if (dice == 12) { success = true; } else { - // TODO : flank attack - success = (dice + activatedUnits >= hex.defenseFor(target, activatedPawns)); + int flankAttacks = 0; + for (Pawn assist : activatedPawns) { + if (assist.isFlankAttack()) { + flankAttacks = 1; + break; + } + } + System.err.print(" + " + activatedUnits + " + " + flankAttacks); + success = ((dice + activatedUnits + flankAttacks) >= hex.defenseFor(target, activatedPawns)); } // TODO : free move for infantry |