From c50045ae937aa9284d7051ec5d0fe74b79a3e626 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 14 Jan 2018 19:07:12 +0100 Subject: Make garbage blocks non-traversable Signed-off-by: pacien --- src/main/java/fr/umlv/java/wallj/board/BoardValidator.java | 3 ++- src/main/java/fr/umlv/java/wallj/model/BlockType.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/fr/umlv') diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java b/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java index e238955..e95446b 100644 --- a/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java +++ b/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java @@ -91,7 +91,8 @@ public class BoardValidator { .filter(blockEntry -> blockEntry.getValue().mustBeReachable()) .allMatch(blockEntry -> blockEntry.getKey().neighbors().stream() .filter(neighbor -> inBoard(dim, neighbor)) - .anyMatch(neighbor -> b.getBlockTypeAt(neighbor).isTraversable())); + .anyMatch(neighbor -> b.getBlockTypeAt(neighbor).isTraversable() || + b.getBlockTypeAt(neighbor).isMovableByExplosion())); } /** diff --git a/src/main/java/fr/umlv/java/wallj/model/BlockType.java b/src/main/java/fr/umlv/java/wallj/model/BlockType.java index 9051715..9c5d4f5 100644 --- a/src/main/java/fr/umlv/java/wallj/model/BlockType.java +++ b/src/main/java/fr/umlv/java/wallj/model/BlockType.java @@ -10,7 +10,7 @@ public enum BlockType { FREE(false, true, true, false), WALL(true, false, false, false), TRASH(true, true, false, false), - GARBAGE(false, true, true, true), + GARBAGE(false, true, false, true), ROBOT(false, false, true, false), BOMB(false, false, true, false); -- cgit v1.2.3