diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 402a8e0..b1eb382 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -280,6 +280,7 @@ public abstract class Board implements Disposable targets.clear(); while (units.hasNext()) { Pawn target = units.next(); + if (!target.canBeAttacked(pawn)) continue; Tile to = target.getTile(); if (searchBoard.buildAttack(pawn, true, target, from.getCol(), from.getRow(), to.getCol(), to.getRow())) targets.add(target); diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 4d6299f..4439b31 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -62,6 +62,7 @@ public abstract class Pawn implements Moveable, Disposable public abstract boolean canRotate(); public abstract boolean canAttack(); public abstract boolean canAttack(Pawn other); + public abstract boolean canBeAttacked(Pawn other); public abstract boolean canAssistAttackWithoutLos(); public abstract void move(int cost); diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 11ab4e6..f950a1a 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -195,6 +195,12 @@ public class Unit extends HeadedPawn } @Override + public boolean canBeAttacked(Pawn other) + { + return true; + } + + @Override public void rotate(Orientation o) { hasMoved = true; |