diff options
-rw-r--r-- | src/ch/epfl/xblast/server/Board.java | 6 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/GameState.java | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java index bff3ea8..79259b5 100644 --- a/src/ch/epfl/xblast/server/Board.java +++ b/src/ch/epfl/xblast/server/Board.java | |||
@@ -16,6 +16,11 @@ import java.util.List; | |||
16 | */ | 16 | */ |
17 | public final class Board { | 17 | public final class Board { |
18 | 18 | ||
19 | /** | ||
20 | * Distance (in SubCells) from a bomb to block a player. | ||
21 | */ | ||
22 | public static final int BOMB_BLOCKING_DISTANCE = 6; | ||
23 | |||
19 | private static final int BLOCKS_LIST_SIZE = 195; | 24 | private static final int BLOCKS_LIST_SIZE = 195; |
20 | private static final int BOARD_ROWS = 13; | 25 | private static final int BOARD_ROWS = 13; |
21 | private static final int BOARD_COLUMNS = 15; | 26 | private static final int BOARD_COLUMNS = 15; |
@@ -45,7 +50,6 @@ public final class Board { | |||
45 | * List containing all the blocks of the board. | 50 | * List containing all the blocks of the board. |
46 | */ | 51 | */ |
47 | private List<Sq<Block>> blocks; | 52 | private List<Sq<Block>> blocks; |
48 | |||
49 | /** | 53 | /** |
50 | * Instantiates a new Board with the given sequence of blocks. | 54 | * Instantiates a new Board with the given sequence of blocks. |
51 | * | 55 | * |
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java index 10b648b..c9a23ac 100644 --- a/src/ch/epfl/xblast/server/GameState.java +++ b/src/ch/epfl/xblast/server/GameState.java | |||
@@ -200,12 +200,11 @@ public final class GameState { | |||
200 | directedPositions1 = directedPositions1.tail(); | 200 | directedPositions1 = directedPositions1.tail(); |
201 | 201 | ||
202 | // Check possible collisions and update the Sequence if necessary (kinda ugly right now) | 202 | // Check possible collisions and update the Sequence if necessary (kinda ugly right now) |
203 | Cell possiblyWalledCell = directedPositions1.tail().findFirst(dp -> dp.position().isCentral()).position().containingCell(); | 203 | Cell possiblyBlockingCell = directedPositions1.tail().findFirst(dp -> dp.position().isCentral()).position().containingCell(); |
204 | if (!board1.blockAt(possiblyWalledCell).canHostPlayer()) { // if block non-free | 204 | if (!board1.blockAt(possiblyBlockingCell).canHostPlayer()) { // if block non-free |
205 | Sq<Player.DirectedPosition> actualDirectedPosition = Sq.repeat(1 , player0.directedPositions().head()); | 205 | Sq<Player.DirectedPosition> actualDirectedPosition = Sq.repeat(1 , player0.directedPositions().head()); |
206 | directedPositions1 = actualDirectedPosition.concat(directedPositions1); // won't move for a tick | 206 | directedPositions1 = actualDirectedPosition.concat(directedPositions1); // won't move for a tick |
207 | } | 207 | } else if (bombedCells1.contains(possiblyBlockingCell) && possiblyBlockingCell.equals(player0.position().containingCell()) && player0.position().distanceToCentral() == Board.BOMB_BLOCKING_DISTANCE) { |
208 | if (bombedCells1.contains(player0.position().containingCell()) && player0.position().distanceToCentral() <= 6) { // Magic number ! 10 lashes for Fnux. | ||
209 | Sq<Player.DirectedPosition> actualDirectedPosition = Sq.repeat(1 , player0.directedPositions().head()); | 208 | Sq<Player.DirectedPosition> actualDirectedPosition = Sq.repeat(1 , player0.directedPositions().head()); |
210 | directedPositions1 = actualDirectedPosition.concat(directedPositions1); // won't move for a tick | 209 | directedPositions1 = actualDirectedPosition.concat(directedPositions1); // won't move for a tick |
211 | } | 210 | } |