forked from public/fvtt-cthulhu-eternal
Fix #28 : switch to manual BP management
This commit is contained in:
parent
3adb34d721
commit
03a54d86e6
@ -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;
|
||||
|
@ -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": {
|
||||
},
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -43,8 +43,6 @@
|
||||
"CTHULHUETERNAL.Label.sanBPShort"}}</span>
|
||||
{{formInput systemFields.san.fields.breakingPoint value=system.san.breakingPoint disabled=true}}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flexrow">
|
||||
@ -57,9 +55,12 @@
|
||||
<span class="label-insanity" >
|
||||
{{localize "CTHULHUETERNAL.Label.tempInsanity"}}
|
||||
</span>
|
||||
|
||||
{{formInput systemFields.san.fields.insanity value=system.san.insanity localize=true}}
|
||||
|
||||
{{#if (not isPlayMode)}}
|
||||
<button data-action="setBP" class="button" data-tooltip="{{localize "CTHULHUETERNAL.Tooltip.setBP"}}">{{localize "CTHULHUETERNAL.Label.setBP"}}</button>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user