Fix with explosions

This commit is contained in:
Renan LE CARO 2025-03-25 08:47:24 +01:00
parent 3a72ae005b
commit 35ea8e952a
4 changed files with 14 additions and 13 deletions

View file

@ -284,7 +284,7 @@ export function explosionAt(
if (gameState.bricks[i] && i !== -1) {
// Study bricks resist explosions too
gameState.brickHP[i]--;
if (gameState.brickHP <= 0) {
if (gameState.brickHP[i] <= 0) {
explodeBrick(gameState, i, ball, true);
}
}

View file

@ -406,19 +406,20 @@ let cachedBricksRenderKey = "";
export function renderAllBricks() {
ctx.globalAlpha = 1;
const hasCombo=gameState.combo > baseCombo(gameState)
const redBorderOnBricksWithWrongColor =
gameState.combo > baseCombo(gameState) &&
hasCombo &&
gameState.perks.picky_eater &&
!isOptionOn("basic");
const redColorOnAllBricks = !!(gameState.lastPuckMove &&
gameState.perks.passive_income &&
gameState.combo > baseCombo(gameState) &&
hasCombo &&
gameState.lastPuckMove >
gameState.levelTime - 250 * gameState.perks.passive_income)
let offset = getDashOffset(gameState)
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || gameState.perks.reach)) {
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || gameState.perks.reach || gameState.perks.zen)) {
offset = 0
}
@ -442,7 +443,7 @@ export function renderAllBricks() {
"_" +
clairVoyance + '_' + offset;
if (newKey !== cachedBricksRenderKey) {
if (newKey !== cachedBricksRenderKey ) {
cachedBricksRenderKey = newKey;
cachedBricksRender.width = gameState.gameZoneWidth;
@ -468,7 +469,7 @@ export function renderAllBricks() {
let redBorder =
(gameState.ballsColor !== color &&
color !== "black" &&
redBorderOnBricksWithWrongColor) ||
redBorderOnBricksWithWrongColor) || (hasCombo && gameState.perks.zen && color==='black')||
redBecauseOfReach || redColorOnAllBricks;
canctx.globalCompositeOperation = "source-over";