From 034205b3e60d68bd451547e86630108f509d207b Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Fri, 15 Apr 2016 12:37:48 +0200 Subject: Revert "Apply damages according to current position instead of future position" This reverts commit 64498b20f7865a373fdad3ab6c3b61202208ae41. --- src/ch/epfl/xblast/server/GameState.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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 { Sq directedPos1 = GameState.moveAhead(player0, updatedPath, board1, bombedCells1); // 3. Apply damages and generate a new LifeState Sequence - Sq lifeStates1 = GameState.nextLifeState(player0, blastedCells1); + Sq lifeStates1 = GameState.nextLifeState(player0, directedPos1, blastedCells1); // 4. Create the new player given the new parameters Player p1 = new Player(player0.id(), lifeStates1, directedPos1, player0.maxBombs(), player0.bombRange()); @@ -333,12 +333,15 @@ public final class GameState { /** * Applies damages and generate a new LifeState sequence. * - * @param player0 the Player - * @param blastedCells1 the Set of blasted Cell-s + * @param player0 the Player + * @param directedPositions1 the DirectedPosition sequence + * @param blastedCells1 the Set of blasted Cell-s * @return the next LifeState sequence */ - private static Sq nextLifeState(Player player0, Set blastedCells1) { - Cell currentCell = player0.position().containingCell(); + private static Sq nextLifeState(Player player0, Sq directedPositions1, + Set blastedCells1) { + + Cell currentCell = directedPositions1.head().position().containingCell(); if (player0.isVulnerable() && blastedCells1.contains(currentCell)) return player0.statesForNextLife(); -- cgit v1.2.3