aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ch/epfl/xblast/server/GameState.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index abd07b3..19b16a9 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -416,7 +416,7 @@ public final class GameState {
416 List<Bomb> ownedBombs = bombOwnerMap.get(p.id()); 416 List<Bomb> ownedBombs = bombOwnerMap.get(p.id());
417 if (ownedBombs != null && ownedBombs.size() >= p.maxBombs()) continue; 417 if (ownedBombs != null && ownedBombs.size() >= p.maxBombs()) continue;
418 418
419 Bomb b = new Bomb(p.id(), p.position().containingCell(), Ticks.BOMB_FUSE_TICKS - 1, p.bombRange()); 419 Bomb b = p.newBomb();
420 bombedCells.add(b.position()); 420 bombedCells.add(b.position());
421 bombs1.add(b); 421 bombs1.add(b);
422 } 422 }
@@ -562,16 +562,16 @@ public final class GameState {
562 // 3. existing explosions evolution 562 // 3. existing explosions evolution
563 List<Sq<Sq<Cell>>> explosions1 = GameState.nextExplosions(this.explosions); 563 List<Sq<Sq<Cell>>> explosions1 = GameState.nextExplosions(this.explosions);
564 564
565 // 4.1. existing bombs evolution 565 // 4.1. newly dropped bombs addition
566 List<Bomb> explodingBombs = GameState.explodingBombs(this.bombs, blastedCells1); 566 Set<PlayerID> topPriorityBombDropEvents = discardConflictingBombDropEvents(bombDropEvents);
567 List<Bomb> existingBombs = GameState.nextBombs(this.bombs, explodingBombs); 567 List<Bomb> allBombs = GameState.newlyDroppedBombs(this.players, topPriorityBombDropEvents, this.bombs);
568 568
569 // 4.2. subsequent explosions addition 569 // 4.2. existing bombs evolution
570 explodingBombs.forEach(b -> explosions1.addAll(b.explosion())); 570 List<Bomb> explodingBombs = GameState.explodingBombs(allBombs, blastedCells1);
571 List<Bomb> bombs1 = GameState.nextBombs(allBombs, explodingBombs);
571 572
572 // 4.3. newly dropped bombs addition 573 // 4.3. subsequent explosions addition
573 Set<PlayerID> topPriorityBombDropEvents = discardConflictingBombDropEvents(bombDropEvents); 574 explodingBombs.forEach(b -> explosions1.addAll(b.explosion()));
574 List<Bomb> bombs1 = GameState.newlyDroppedBombs(this.players, topPriorityBombDropEvents, existingBombs);
575 575
576 // 5. players evolution 576 // 5. players evolution
577 Map<PlayerID, Bonus> playerBonuses = mapPlayersToBonuses(consumedBonuses); 577 Map<PlayerID, Bonus> playerBonuses = mapPlayersToBonuses(consumedBonuses);