Updated soft reset perk to just keep lvl*10 % of combo

This commit is contained in:
Renan LE CARO 2025-03-16 14:29:14 +01:00
parent a3c66fcdea
commit a1bf54af71
20 changed files with 4543 additions and 4445 deletions

View file

@ -1,11 +1,13 @@
// Settings
import {GameState} from "./types";
let cachedSettings: { [key: string]: unknown } = {};
export function getSettingValue<T>(key: string, defaultValue: T) {
if (typeof cachedSettings[key] == "undefined") {
try {
const ls = localStorage.getItem("breakout-settings-enable-" + key);
const ls = localStorage.getItem( key);
if (ls) cachedSettings[key] = JSON.parse(ls) as T;
} catch (e) {
console.warn(e);
@ -17,9 +19,19 @@ export function getSettingValue<T>(key: string, defaultValue: T) {
export function setSettingValue<T>(key: string, value: T) {
cachedSettings[key] = value
try {
localStorage.setItem("breakout-settings-enable-" + key, JSON.stringify(value));
localStorage.setItem( key, JSON.stringify(value));
} catch (e) {
console.warn(e);
}
}
export function getTotalScore() {
return getSettingValue('breakout_71_total_score', 0)
}
export function addToTotalScore(gameState: GameState, points: number) {
if (gameState.isCreativeModeRun) return;
setSettingValue('breakout_71_total_score', getTotalScore() + points)
}