This commit is contained in:
2025-02-02 15:45:40 -08:00
parent c095da2492
commit 9585f5ae95
6 changed files with 133 additions and 50 deletions

View File

@ -2,6 +2,7 @@ import {Stat} from "./datatypes.ts";
export class PlayerProgress {
#stats: Record<Stat, number>
#blood: number
constructor() {
this.#stats = {
@ -10,6 +11,13 @@ export class PlayerProgress {
CHA: 10,
PSI: 10,
}
this.#blood = 0;
this.refill();
}
refill() {
this.#blood = 2000;
}
add(stat: Stat, amount: number) {
@ -22,9 +30,17 @@ export class PlayerProgress {
this.#stats[stat] += amount;
}
get(stat: Stat): number {
getStat(stat: Stat): number {
return this.#stats[stat]
}
getBlood(): number {
return Math.floor(Math.max(this.#blood, 0));
}
spendBlood(amt: number) {
this.#blood -= amt;
}
}
let active: PlayerProgress = new PlayerProgress();