Build 29062545

This commit is contained in:
Renan LE CARO 2025-04-04 09:45:35 +02:00
parent 51d112c942
commit 7d518f14e5
11 changed files with 81 additions and 50 deletions

View file

@ -1,5 +1,5 @@
// The version of the cache.
const VERSION = "29061838";
const VERSION = "29062545";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -1 +1 @@
"29061838"
"29062545"

View file

@ -291,7 +291,7 @@ export async function openUpgradesPicker(gameState: GameState) {
level: gameState.currentLevel + 1,
max: max_levels(gameState),
})} </p>
<p>${levelsListHTMl(gameState)}</p>
<p>${levelsListHTMl(gameState, gameState.currentLevel + 1)}</p>
`,
...actions,
pickedUpgradesHTMl(gameState),
@ -456,7 +456,7 @@ async function openScorePanel() {
content: [
pickedUpgradesHTMl(gameState),
levelsListHTMl(gameState),
levelsListHTMl(gameState, gameState.currentLevel),
gameState.rerolls
? t("score_panel.rerolls_count", { rerolls: gameState.rerolls })
: "",

View file

@ -24,8 +24,8 @@ import {
getRowColIndex,
isMovingWhilePassiveIncome,
isPickyEatingPossible,
isTelekinesisActive,
isYoyoActive,
telekinesisEffectRate,
yoyoEffectRate,
makeEmptyPerksMap,
max_levels,
reachRedRowIndex,
@ -1428,17 +1428,22 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
gameState.perks.puck_repulse_ball +
gameState.perks.ball_attract_ball;
if (isTelekinesisActive(gameState, ball)) {
if (telekinesisEffectRate(gameState, ball) > 0) {
speedLimitDampener += 3;
ball.vx +=
((gameState.puckPosition - ball.x) / 1000) *
delta *
gameState.perks.telekinesis;
gameState.perks.telekinesis *
telekinesisEffectRate(gameState, ball);
}
if (isYoyoActive(gameState, ball)) {
if (yoyoEffectRate(gameState, ball) > 0) {
speedLimitDampener += 3;
ball.vx +=
((gameState.puckPosition - ball.x) / 1000) * delta * gameState.perks.yoyo;
((gameState.puckPosition - ball.x) / 1000) *
delta *
gameState.perks.yoyo *
yoyoEffectRate(gameState, ball);
}
if (
ball.vx * ball.vx + ball.vy * ball.vy <
@ -1511,7 +1516,7 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
}
if (gameState.perks.top_is_lava && borderHitCode >= 2) {
resetCombo(gameState, ball.x, ball.y + gameState.ballSize);
resetCombo(gameState, ball.x, ball.y + gameState.ballSize * 3);
}
if (gameState.perks.trampoline) {
decreaseCombo(

View file

@ -2,6 +2,7 @@ import { Ball, GameState, Level, PerkId, PerksMap } from "./types";
import { icons, upgrades } from "./loadGameData";
import { t } from "./i18n/i18n";
import { brickAt } from "./level_editor/levels_editor_util";
import { clamp } from "./pure_functions";
export function describeLevel(level: Level) {
let bricks = 0,
@ -83,6 +84,7 @@ export function max_levels(gameState: GameState) {
export function pickedUpgradesHTMl(gameState: GameState) {
const upgradesList = getPossibleUpgrades(gameState)
.filter((u) => gameState.bannedPerks[u.id] || gameState.perks[u.id])
.map((u) => {
const newMax = Math.max(0, u.max - gameState.bannedPerks[u.id]);
@ -118,12 +120,12 @@ export function pickedUpgradesHTMl(gameState: GameState) {
return ` <p>${t("score_panel.upgrades_picked")}</p>` + upgradesList.join("");
}
export function levelsListHTMl(gameState: GameState) {
export function levelsListHTMl(gameState: GameState, level: number) {
if (!gameState.perks.clairvoyant) return "";
if (gameState.mode === "creative") return "";
let list = "";
for (let i = 0; i < max_levels(gameState); i++) {
list += `<span style="opacity: ${i >= gameState.currentLevel ? 1 : 0.2}" title="${gameState.runLevels[i].name}">${icons[gameState.runLevels[i].name]}</span>`;
list += `<span style="opacity: ${i >= level ? 1 : 0.2}" title="${gameState.runLevels[i].name}">${icons[gameState.runLevels[i].name]}</span>`;
}
return `<p>${t("score_panel.upcoming_levels")}</p><p>${list}</p>`;
}
@ -159,11 +161,21 @@ export function reachRedRowIndex(gameState: GameState) {
return maxY;
}
export function isTelekinesisActive(gameState: GameState, ball: Ball) {
return gameState.perks.telekinesis && ball.vy < 0;
export function telekinesisEffectRate(gameState: GameState, ball: Ball) {
return (
(gameState.perks.telekinesis &&
ball.vy < 0 &&
clamp((ball.y / gameState.gameZoneHeight) * 1.1 + 0.1, 0, 1)) ||
0
);
}
export function isYoyoActive(gameState: GameState, ball: Ball) {
return gameState.perks.yoyo && ball.vy > 0;
export function yoyoEffectRate(gameState: GameState, ball: Ball) {
return (
(gameState.perks.yoyo &&
ball.vy > 0 &&
clamp(1 - (ball.y / gameState.gameZoneHeight) * 1.1 + 0.1, 0, 1)) ||
0
);
}
export function findLast<T>(

View file

@ -7,8 +7,8 @@ import {
currentLevelInfo,
isMovingWhilePassiveIncome,
isPickyEatingPossible,
isTelekinesisActive,
isYoyoActive,
telekinesisEffectRate,
yoyoEffectRate,
max_levels,
reachRedRowIndex,
} from "./game_utils";
@ -363,10 +363,16 @@ export function render(gameState: GameState) {
gameState.puckColor,
);
if (isTelekinesisActive(gameState, ball) || isYoyoActive(gameState, ball)) {
if (
telekinesisEffectRate(gameState, ball) ||
yoyoEffectRate(gameState, ball)
) {
ctx.beginPath();
ctx.moveTo(gameState.puckPosition, gameState.gameZoneHeight);
ctx.globalAlpha = Math.max(
telekinesisEffectRate(gameState, ball),
yoyoEffectRate(gameState, ball),
);
ctx.strokeStyle = gameState.puckColor;
ctx.bezierCurveTo(
gameState.puckPosition,
@ -381,6 +387,7 @@ export function render(gameState: GameState) {
ctx.lineWidth = 2;
ctx.setLineDash(emptyArray);
}
ctx.globalAlpha = 1;
if (gameState.perks.clairvoyant && gameState.ballStickToPuck) {
ctx.strokeStyle = gameState.ballsColor;
ctx.beginPath();

View file

@ -596,7 +596,7 @@ export const rawUpgrades = [
threshold: 145000,
giftable: false,
id: "clairvoyant",
max: 3,
max: 1,
name: t("upgrades.clairvoyant.name"),
help: (lvl: number) => t("upgrades.clairvoyant.help"),
fullHelp: t("upgrades.clairvoyant.fullHelp"),