This commit is contained in:
Renan LE CARO 2025-04-08 10:36:30 +02:00
parent e1c20627bc
commit 6ef13f2d19
15 changed files with 289 additions and 65 deletions

View file

@ -42,13 +42,14 @@ export function getRunLevels(
export function newGameState(params: RunParams): GameState {
const highScore = getHighScore();
const totalScoreAtRunStart=getTotalScore()
const perks = { ...makeEmptyPerksMap(upgrades), ...(params?.perks || {}) };
let randomGift: PerkId | undefined = undefined;
if (!sumOfValues(perks)) {
const giftable = upgrades.filter(
(u) => highScore >= u.threshold && !u.requires && isStartingPerk(u),
(u) => totalScoreAtRunStart >= u.threshold && isStartingPerk(u),
);
randomGift =
@ -106,7 +107,8 @@ export function newGameState(params: RunParams): GameState {
ballSize: 20,
coinSize: 14,
puckHeight: 20,
totalScoreAtRunStart: getTotalScore(),
totalScoreAtRunStart,
pauseUsesDuringRun: 0,
keyboardPuckSpeed: 0,
lastTick: performance.now(),