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