Build 29068563

This commit is contained in:
Renan LE CARO 2025-04-08 14:03:38 +02:00
parent 6ef13f2d19
commit df8bfbb350
25 changed files with 384 additions and 336 deletions

25
src/addToTotalScore.ts Normal file
View file

@ -0,0 +1,25 @@
import { GameState } from "./types";
import { icons, upgrades } from "./loadGameData";
import { schedulGameSound } from "./gameStateMutators";
import { toast } from "./toast";
import { t } from "./i18n/i18n";
import { getTotalScore, setSettingValue } from "./settings";
export function addToTotalScore(gameState: GameState, points: number) {
if (gameState.creative) return;
const pastScore = getTotalScore();
const newScore = pastScore + points;
setSettingValue("breakout_71_total_score", newScore);
// Check unlocked upgrades
upgrades.forEach((u) => {
if (u.threshold > pastScore && u.threshold <= newScore) {
schedulGameSound(gameState, "colorChange", 0, 1);
toast(
icons["icon:" + u.id] +
"<strong>" +
t("gameOver.unlocked_perk") +
"</strong>",
);
}
});
}