diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 17:05:16 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 17:05:16 +0200 |
commit | 93f26e987f40b32749c716f447259f446c0b4816 (patch) | |
tree | f6935385f7f060b242720eeabeccf18f3006848a /core/src/ch/asynk/tankontank/game | |
parent | b6b7853f387b6cf0d052cc99bfddd22793bbec2c (diff) | |
download | RustAndDust-93f26e987f40b32749c716f447259f446c0b4816.zip RustAndDust-93f26e987f40b32749c716f447259f446c0b4816.tar.gz |
Pawn: add isFlankAttack()
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 7f9e7ae..2519ab0 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -183,33 +183,30 @@ public abstract class Map extends Board public int buildPossibleMoves(Pawn pawn, GridPoint2 hex) { - buildPossibleMovesFrom(pawn, hex, possibleMoves); - return possibleMoves.size(); + return buildPossibleMovesFrom(pawn, hex, possibleMoves); } public int buildPossibleTargets(Pawn pawn, GridPoint2 hex) { - buildPossibleTargetsFrom(pawn, hex, possibleTargets); - return possibleTargets.size(); + return buildPossibleTargetsFrom(pawn, hex, possibleTargets); } public int buildMoveAssists(Pawn pawn, GridPoint2 hex) { - if (pawn.isHq()) { - buildMoveAssists(pawn, hex, moveAssists); - } else { + if (!pawn.isHq()) { moveAssists.clear(); + return 0; } - return moveAssists.size(); + return buildMoveAssists(pawn, hex, moveAssists); } - public int buildAttackAssists(Pawn pawn, GridPoint2 hex, Iterator<Pawn> units) + public int buildAttack(Pawn pawn, Pawn target, GridPoint2 hex, Iterator<Pawn> units) { - buildAttackAssists(pawn, hex, units, attackAssists); + int s = buildAttack(pawn, target, hex, units, attackAssists); activatedPawns.add(pawn); for (GridPoint2 p : attackAssists) activablePawns.add(getTopPawnAt(p)); - return attackAssists.size(); + return s; } public boolean toggleAttackAssist(Pawn pawn) |