diff --git a/css/fvtt-cthulhu-eternal.css b/css/fvtt-cthulhu-eternal.css index 0e0e7ff..e4b388d 100644 --- a/css/fvtt-cthulhu-eternal.css +++ b/css/fvtt-cthulhu-eternal.css @@ -326,6 +326,10 @@ i.fvtt-cthulhu-eternal { cursor: pointer; font-size: 0.9rem; } +.fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .button { + min-width: 4rem; + max-width: 4rem; +} .fvtt-cthulhu-eternal .protagonist-main .protagonist-pc .protagonist-right .san .san-checkbox { min-width: 1rem; max-width: 1rem; diff --git a/lang/en.json b/lang/en.json index deeb401..3e65c8a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -323,6 +323,7 @@ "veryHarsh": "Very Harsh" }, "Label": { + "setBP": "Set BP", "Vehicle": "Vehicle", "Speed": "Speed", "Slow": "Slow", @@ -431,7 +432,8 @@ "roll": "Roll" }, "Tooltip": { - "sanBP": ">5 SAN lost in one roll, temporary insanity. If SAN less reaches BP = a Disorder unconscious Breaking and AND reset BP." + "sanBP": ">5 SAN lost in one roll, temporary insanity. If SAN less reaches BP = a Disorder unconscious Breaking and AND reset BP.", + "setBP": "Set the current Breaking Point based on the current SAN value" }, "Setting": { }, diff --git a/module/applications/sheets/protagonist-sheet.mjs b/module/applications/sheets/protagonist-sheet.mjs index 0a5d4f9..5bba1dc 100644 --- a/module/applications/sheets/protagonist-sheet.mjs +++ b/module/applications/sheets/protagonist-sheet.mjs @@ -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" }]) } diff --git a/module/models/protagonist.mjs b/module/models/protagonist.mjs index 1b29b38..bb18874 100644 --- a/module/models/protagonist.mjs +++ b/module/models/protagonist.mjs @@ -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. diff --git a/module/models/skill.mjs b/module/models/skill.mjs index 06f5db3..09919c2 100644 --- a/module/models/skill.mjs +++ b/module/models/skill.mjs @@ -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(); diff --git a/styles/protagonist.less b/styles/protagonist.less index 71a9b02..d2c5669 100644 --- a/styles/protagonist.less +++ b/styles/protagonist.less @@ -83,6 +83,10 @@ cursor: pointer; font-size: 0.9rem; } + .button { + min-width: 4rem; + max-width: 4rem; + } .san-checkbox { min-width: 1rem; max-width: 1rem; diff --git a/templates/protagonist-main.hbs b/templates/protagonist-main.hbs index 9795675..5709e92 100644 --- a/templates/protagonist-main.hbs +++ b/templates/protagonist-main.hbs @@ -42,8 +42,6 @@ {{localize "CTHULHUETERNAL.Label.sanBPShort"}} {{formInput systemFields.san.fields.breakingPoint value=system.san.breakingPoint disabled=true}} - - @@ -51,15 +49,18 @@
{{localize "CTHULHUETERNAL.Label.max"}} - {{formInput systemFields.san.fields.max value=system.san.max rootId=partId disabled=true}} + {{formInput systemFields.san.fields.max value=system.san.max rootId=partId disabled=true}}
{{localize "CTHULHUETERNAL.Label.tempInsanity"}} - {{formInput systemFields.san.fields.insanity value=system.san.insanity localize=true}} + {{#if (not isPlayMode)}} + + {{/if}} +