Fix #28 : switch to manual BP management
This commit is contained in:
@ -12,6 +12,7 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
|
||||
contentClasses: ["protagonist-content"],
|
||||
},
|
||||
actions: {
|
||||
setBP: CthulhuEternalProtagonistSheet.#onSetBP,
|
||||
createGear: CthulhuEternalProtagonistSheet.#onCreateGear,
|
||||
createArmor: CthulhuEternalProtagonistSheet.#onCreateArmor,
|
||||
createWeapon: CthulhuEternalProtagonistSheet.#onCreateWeapon,
|
||||
@ -125,6 +126,10 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
|
||||
* @param {Event} event The initiating click event.
|
||||
* @param {HTMLElement} target The current target of the event listener.
|
||||
*/
|
||||
static #onSetBP(event, target) {
|
||||
this.document.system.setBP()
|
||||
}
|
||||
|
||||
static #onCreateGear(event, target) {
|
||||
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newGear"), type: "gear" }])
|
||||
}
|
||||
|
@ -106,11 +106,6 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
updates[`system.san.max`] = maxSan
|
||||
}
|
||||
|
||||
let bp = Math.max(this.san.value - this.characteristics.pow.value, 0)
|
||||
if ( this.san.breakingPoint !== bp) {
|
||||
updates[`system.san.breakingPoint`] = bp
|
||||
}
|
||||
|
||||
let recoverySan = this.characteristics.pow.value * 5
|
||||
if (recoverySan > this.san.max) {
|
||||
recoverySan = this.san.max
|
||||
@ -183,6 +178,17 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
|
||||
return this.wp.exhausted
|
||||
}
|
||||
|
||||
setBP() {
|
||||
let updates = {}
|
||||
let bp = Math.max(this.san.value - this.characteristics.pow.value, 0)
|
||||
if ( this.san.breakingPoint !== bp) {
|
||||
updates[`system.san.breakingPoint`] = bp
|
||||
}
|
||||
if (Object.keys(updates).length > 0) {
|
||||
this.parent.update(updates)
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* Rolls a dice for a character.
|
||||
|
@ -20,7 +20,6 @@ export default class CthulhuEternalSkill extends foundry.abstract.TypeDataModel
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["CTHULHUETERNAL.Skill"]
|
||||
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.skillTotal = this.computeScore();
|
||||
|
Reference in New Issue
Block a user