aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-04-15 12:37:48 +0200
committerPacien TRAN-GIRARD2016-04-15 12:37:48 +0200
commit034205b3e60d68bd451547e86630108f509d207b (patch)
treefa31f6d9da6065b3a9044973eaadf71c9bc9d2f3 /src
parentaaad994749b1096aa77e18ff32717fa4061270d8 (diff)
downloadxblast-034205b3e60d68bd451547e86630108f509d207b.tar.gz
Revert "Apply damages according to current position instead of future position"
This reverts commit 64498b20f7865a373fdad3ab6c3b61202208ae41.
Diffstat (limited to 'src')
-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();