mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-05-05 03:07:14 -04:00
wip
This commit is contained in:
parent
bcf40fe667
commit
096f7d4abd
13 changed files with 1917 additions and 225 deletions
|
@ -2,17 +2,16 @@ import { GameState } from "./types";
|
|||
import { asyncAlert } from "./asyncAlert";
|
||||
import { t } from "./i18n/i18n";
|
||||
import {
|
||||
getLevelUnlockCondition,
|
||||
levelsListHTMl,
|
||||
max_levels,
|
||||
pickedUpgradesHTMl,
|
||||
reasonLevelIsLocked,
|
||||
} 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";
|
||||
|
||||
export async function openScorePanel(gameState: GameState) {
|
||||
pause(true);
|
||||
|
@ -42,13 +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, getHistory(), false);
|
||||
const reason = reasonLevelIsLocked(li, l.name, getHistory(), false);
|
||||
if (!reason) return;
|
||||
|
||||
const { minScore, forbidden, required } = getLevelUnlockCondition(li);
|
||||
const missing = required.filter((u) => !gameState?.perks?.[u.id]);
|
||||
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((u) => gameState?.perks?.[u.id])) {
|
||||
if (forbidden.find((id) => gameState?.perks?.[id])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,7 +69,7 @@ export function getNearestUnlockHTML(gameState: GameState) {
|
|||
|
||||
if (!firstUnlockable) return "";
|
||||
let missingPoints = Math.max(0, firstUnlockable.minScore - gameState.score);
|
||||
let missingUpgrades = firstUnlockable.missing.map((u) => u.name).join(", ");
|
||||
let missingUpgrades = firstUnlockable.missing.map((id) => upgradeName(id)).join(", ");
|
||||
|
||||
const title =
|
||||
(missingUpgrades &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue