aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ch/epfl/xblast/server/GameState.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index e7a053b..107162e 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -208,7 +208,7 @@ public final class GameState {
208 Sq<Player.DirectedPosition> directedPos1 = GameState.moveAhead(player0, updatedPath, board1, bombedCells1); 208 Sq<Player.DirectedPosition> directedPos1 = GameState.moveAhead(player0, updatedPath, board1, bombedCells1);
209 209
210 // 3. Apply damages and generate a new LifeState Sequence 210 // 3. Apply damages and generate a new LifeState Sequence
211 Sq<Player.LifeState> lifeStates1 = GameState.nextLifeState(player0, blastedCells1); 211 Sq<Player.LifeState> lifeStates1 = GameState.nextLifeState(player0, directedPos1, blastedCells1);
212 212
213 // 4. Create the new player given the new parameters 213 // 4. Create the new player given the new parameters
214 Player p1 = new Player(player0.id(), lifeStates1, directedPos1, player0.maxBombs(), player0.bombRange()); 214 Player p1 = new Player(player0.id(), lifeStates1, directedPos1, player0.maxBombs(), player0.bombRange());
@@ -333,12 +333,15 @@ public final class GameState {
333 /** 333 /**
334 * Applies damages and generate a new LifeState sequence. 334 * Applies damages and generate a new LifeState sequence.
335 * 335 *
336 * @param player0 the Player 336 * @param player0 the Player
337 * @param blastedCells1 the Set of blasted Cell-s 337 * @param directedPositions1 the DirectedPosition sequence
338 * @param blastedCells1 the Set of blasted Cell-s
338 * @return the next LifeState sequence 339 * @return the next LifeState sequence
339 */ 340 */
340 private static Sq<Player.LifeState> nextLifeState(Player player0, Set<Cell> blastedCells1) { 341 private static Sq<Player.LifeState> nextLifeState(Player player0, Sq<Player.DirectedPosition> directedPositions1,
341 Cell currentCell = player0.position().containingCell(); 342 Set<Cell> blastedCells1) {
343
344 Cell currentCell = directedPositions1.head().position().containingCell();
342 345
343 if (player0.isVulnerable() && blastedCells1.contains(currentCell)) 346 if (player0.isVulnerable() && blastedCells1.contains(currentCell))
344 return player0.statesForNextLife(); 347 return player0.statesForNextLife();