aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl')
-rw-r--r--src/ch/epfl/xblast/server/Block.java9
-rw-r--r--src/ch/epfl/xblast/server/GameState.java6
2 files changed, 12 insertions, 3 deletions
diff --git a/src/ch/epfl/xblast/server/Block.java b/src/ch/epfl/xblast/server/Block.java
index 6076297..ca04f31 100644
--- a/src/ch/epfl/xblast/server/Block.java
+++ b/src/ch/epfl/xblast/server/Block.java
@@ -87,6 +87,15 @@ public enum Block {
87 } 87 }
88 88
89 /** 89 /**
90 * Returns T(this block is destructible).
91 *
92 * @return T(this block is destructible)
93 */
94 public boolean isDestructible() {
95 return this != INDESTRUCTIBLE_WALL;
96 }
97
98 /**
90 * Returns T(this block is a bonus). 99 * Returns T(this block is a bonus).
91 * 100 *
92 * @return T(this block is a bonus) 101 * @return T(this block is a bonus)
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index ab6f2a6..f3547dc 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -113,13 +113,13 @@ public final class GameState {
113 private static List<Sq<Cell>> nextBlasts(List<Sq<Cell>> blasts0, Board board0, List<Sq<Sq<Cell>>> explosions0) { 113 private static List<Sq<Cell>> nextBlasts(List<Sq<Cell>> blasts0, Board board0, List<Sq<Sq<Cell>>> explosions0) {
114 return Stream.concat( 114 return Stream.concat(
115 blasts0.stream() 115 blasts0.stream()
116 .filter(b -> !b.tail().isEmpty())
117 .filter(b -> board0.blockAt(b.head()).isFree()) 116 .filter(b -> board0.blockAt(b.head()).isFree())
118 .map(Sq::tail), 117 .map(Sq::tail),
119 explosions0.stream() 118 explosions0.stream()
120 .filter(e -> !e.isEmpty()) 119 .filter(e -> !e.isEmpty())
121 .map(Sq::head) 120 .map(Sq::head))
122 .filter(b -> !b.isEmpty())) 121 .filter(b -> !b.isEmpty())
122 .filter(b -> board0.blockAt(b.head()).isDestructible())
123 .collect(Collectors.toList()); 123 .collect(Collectors.toList());
124 } 124 }
125 125