mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-05-05 03:07:14 -04:00
wip
This commit is contained in:
parent
4c66cc820c
commit
cee5c6bc60
28 changed files with 948 additions and 344 deletions
|
@ -1,9 +1,17 @@
|
|||
import {Ball, Coin, GameState, Level, PerkId, PerksMap, Upgrade} from "./types";
|
||||
import {icons, upgrades} from "./loadGameData";
|
||||
import {t} from "./i18n/i18n";
|
||||
import {clamp} from "./pure_functions";
|
||||
import {getSettingValue, getTotalScore} from "./settings";
|
||||
import {isOptionOn} from "./options";
|
||||
import {
|
||||
Ball,
|
||||
Coin,
|
||||
GameState,
|
||||
Level,
|
||||
PerkId,
|
||||
PerksMap,
|
||||
Upgrade,
|
||||
} from "./types";
|
||||
import { icons, upgrades } from "./loadGameData";
|
||||
import { t } from "./i18n/i18n";
|
||||
import { clamp } from "./pure_functions";
|
||||
import { getSettingValue, getTotalScore } from "./settings";
|
||||
import { isOptionOn } from "./options";
|
||||
|
||||
export function describeLevel(level: Level) {
|
||||
let bricks = 0,
|
||||
|
@ -99,10 +107,13 @@ export function max_levels(gameState: GameState) {
|
|||
return 7 + gameState.perks.extra_levels;
|
||||
}
|
||||
|
||||
export function upgradeLevelAndMaxDisplay(upgrade: Upgrade, gameState: GameState) {
|
||||
export function upgradeLevelAndMaxDisplay(
|
||||
upgrade: Upgrade,
|
||||
gameState: GameState,
|
||||
) {
|
||||
const lvl = gameState.perks[upgrade.id];
|
||||
const max = upgrade.max + gameState.perks.limitless
|
||||
return `<span class="level ${lvl < max ? 'can-upgrade' : 'capped'}"><span>${lvl}</span><span>${max}</span></span>`
|
||||
const max = upgrade.max + gameState.perks.limitless;
|
||||
return `<span class="level ${lvl < max ? "can-upgrade" : "capped"}"><span>${lvl}</span><span>${max}</span></span>`;
|
||||
}
|
||||
|
||||
export function pickedUpgradesHTMl(gameState: GameState) {
|
||||
|
@ -111,7 +122,6 @@ export function pickedUpgradesHTMl(gameState: GameState) {
|
|||
.map((u) => {
|
||||
const newMax = Math.max(0, u.max + gameState.perks.limitless);
|
||||
|
||||
|
||||
const state = (gameState.perks[u.id] && 1) || (!newMax && 2) || 3;
|
||||
return {
|
||||
state,
|
||||
|
@ -320,6 +330,10 @@ export function hoursSpentPlaying() {
|
|||
}
|
||||
}
|
||||
|
||||
export function escapeAttribute(str:String){
|
||||
return str.replace(/&/gi,'&').replace(/</gi,'<').replace(/"/gi,'"').replace(/'/gi,''')
|
||||
}
|
||||
export function escapeAttribute(str: String) {
|
||||
return str
|
||||
.replace(/&/gi, "&")
|
||||
.replace(/</gi, "<")
|
||||
.replace(/"/gi, """)
|
||||
.replace(/'/gi, "'");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue