Penance cycle
This commit is contained in:
@ -5,6 +5,7 @@ export class PlayerProgress {
|
||||
#name: string
|
||||
#stats: Record<Stat, number>
|
||||
#talents: Record<Stat, number>
|
||||
#isInPenance: boolean;
|
||||
#wish: Wish | null;
|
||||
#exp: number;
|
||||
#blood: number
|
||||
@ -16,6 +17,7 @@ export class PlayerProgress {
|
||||
this.#name = asSuccessor.name;
|
||||
this.#stats = {...asSuccessor.stats};
|
||||
this.#talents = {...asSuccessor.talents};
|
||||
this.#isInPenance = asSuccessor.inPenance;
|
||||
this.#wish = withWish;
|
||||
this.#exp = 0;
|
||||
this.#blood = 0;
|
||||
@ -28,7 +30,7 @@ export class PlayerProgress {
|
||||
|
||||
applyEndOfTurn() {
|
||||
for (let stat of ALL_STATS.values()) {
|
||||
this.#stats[stat] += this.#talents[stat];
|
||||
this.add(stat, this.#talents[stat]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,11 +38,15 @@ export class PlayerProgress {
|
||||
return this.#name;
|
||||
}
|
||||
|
||||
get isInPenance(): boolean {
|
||||
return this.#isInPenance;
|
||||
}
|
||||
|
||||
refill() {
|
||||
this.#blood = 2000;
|
||||
|
||||
let learnableSkills = []; // TODO: Also include costing info
|
||||
for (let skill of getSkills().getAllAvailableSkills().values()) {
|
||||
for (let skill of getSkills().getAvailableSkills(this.#isInPenance).values()) {
|
||||
if (this.#canBeAvailable(skill)) {
|
||||
learnableSkills.push(skill);
|
||||
}
|
||||
@ -99,10 +105,8 @@ export class PlayerProgress {
|
||||
if (amount != Math.floor(amount)) {
|
||||
throw `stat increment must be integer: ${amount}`
|
||||
}
|
||||
if (amount <= 0) {
|
||||
throw `stat increment must be >0: ${amount}`
|
||||
}
|
||||
this.#stats[stat] += amount;
|
||||
this.#stats[stat] = Math.min(Math.max(this.#stats[stat], -99), 999);
|
||||
}
|
||||
|
||||
addExperience(amt: number) {
|
||||
@ -169,7 +173,9 @@ export class PlayerProgress {
|
||||
}
|
||||
return learnedSkills;
|
||||
}
|
||||
}
|
||||
|
||||
getStats() { return {...this.#stats} }
|
||||
getTalents() { return {...this.#talents} } }
|
||||
|
||||
let active: PlayerProgress | null = null;
|
||||
|
||||
|
Reference in New Issue
Block a user