Build 29095000

This commit is contained in:
Renan LE CARO 2025-04-26 22:40:32 +02:00
parent 096f7d4abd
commit 4c324d211c
27 changed files with 500 additions and 1350 deletions

View file

@ -1,17 +1,17 @@
import { GameState } from "./types";
import { asyncAlert } from "./asyncAlert";
import { t } from "./i18n/i18n";
import {
levelsListHTMl,
max_levels,
pickedUpgradesHTMl,
} from "./game_utils";
import { levelsListHTMl, max_levels, pickedUpgradesHTMl } from "./game_utils";
import { getCreativeModeWarning, getHistory } from "./gameOver";
import { pause } from "./game";
import { allLevels, icons } from "./loadGameData";
import { firstWhere } from "./pure_functions";
import { getSettingValue, getTotalScore } from "./settings";
import {getLevelUnlockCondition, reasonLevelIsLocked, upgradeName} from "./get_level_unlock_condition";
import {
getLevelUnlockCondition,
reasonLevelIsLocked,
upgradeName,
} from "./get_level_unlock_condition";
export async function openScorePanel(gameState: GameState) {
pause(true);
@ -41,10 +41,13 @@ export function getNearestUnlockHTML(gameState: GameState) {
const unlocked = new Set(getSettingValue("breakout_71_unlocked_levels", []));
const firstUnlockable = firstWhere(allLevels, (l, li) => {
if (unlocked.has(l.name)) return;
const reason = reasonLevelIsLocked(li, l.name, getHistory(), false);
const reason = reasonLevelIsLocked(li, l.name, getHistory(), false);
if (!reason) return;
const { minScore, forbidden, required } = getLevelUnlockCondition(li, l.name);
const { minScore, forbidden, required } = getLevelUnlockCondition(
li,
l.name,
);
const missing = required.filter((id) => !gameState?.perks?.[id]);
// we can't have a forbidden perk
if (forbidden.find((id) => gameState?.perks?.[id])) {
@ -69,7 +72,9 @@ export function getNearestUnlockHTML(gameState: GameState) {
if (!firstUnlockable) return "";
let missingPoints = Math.max(0, firstUnlockable.minScore - gameState.score);
let missingUpgrades = firstUnlockable.missing.map((id) => upgradeName(id)).join(", ");
let missingUpgrades = firstUnlockable.missing
.map((id) => upgradeName(id))
.join(", ");
const title =
(missingUpgrades &&