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/GameState.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index ece12ed..4c30235 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, directedPos1, blastedCells1); 211 Sq<Player.LifeState> lifeStates1 = GameState.nextLifeState(player0, 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());
@@ -336,15 +336,12 @@ public final class GameState {
336 /** 336 /**
337 * Applies damages and generate a new LifeState sequence. 337 * Applies damages and generate a new LifeState sequence.
338 * 338 *
339 * @param player0 the Player 339 * @param player0 the Player
340 * @param directedPositions1 the DirectedPosition sequence 340 * @param blastedCells1 the Set of blasted Cell-s
341 * @param blastedCells1 the Set of blasted Cell-s
342 * @return the next LifeState sequence 341 * @return the next LifeState sequence
343 */ 342 */
344 private static Sq<Player.LifeState> nextLifeState(Player player0, Sq<Player.DirectedPosition> directedPositions1, 343 private static Sq<Player.LifeState> nextLifeState(Player player0, Set<Cell> blastedCells1) {
345 Set<Cell> blastedCells1) { 344 Cell currentCell = player0.position().containingCell();
346
347 Cell currentCell = directedPositions1.head().position().containingCell();
348 345
349 if (player0.isVulnerable() && blastedCells1.contains(currentCell)) 346 if (player0.isVulnerable() && blastedCells1.contains(currentCell))
350 return player0.statesForNextLife(); 347 return player0.statesForNextLife();