Savesrolls + HP
This commit is contained in:
@ -61,12 +61,35 @@ export class CrucibleActor extends Actor {
|
||||
super.prepareData();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeHitPoints( ) {
|
||||
let hp = duplicate(this.data.data.secondary.hp)
|
||||
let max = (this.data.data.abilities.str.value + this.data.data.abilities.con.value) * 6
|
||||
if ( max != hp.max || hp.value > max) {
|
||||
hp.max = max
|
||||
hp.value = max // Init case
|
||||
this.update({ 'data.secondary.hp': hp})
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
computeEffortPoints( ) {
|
||||
let effort = duplicate(this.data.data.secondary.effort)
|
||||
let max = (this.data.data.abilities.con.value + this.data.data.abilities.int.value) * 6
|
||||
if ( max != effort.max || effort.value > max) {
|
||||
effort.max = max
|
||||
effort.value = max // Init case
|
||||
this.update({ 'data.secondary.effort': effort})
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
|
||||
if (this.type == 'character') {
|
||||
if (this.type == 'character' || game.user.isGM) {
|
||||
this.data.data.encCapacity = this.getEncumbranceCapacity()
|
||||
this.buildContainerTree()
|
||||
this.computeHitPoints()
|
||||
this.computeEffortPoints()
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
@ -515,7 +538,21 @@ export class CrucibleActor extends Actor {
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
rollSave( saveKey) {
|
||||
let saves = this.getSaveRoll()
|
||||
let save = saves[saveKey]
|
||||
if (save) {
|
||||
save = duplicate(save)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "save"
|
||||
rollData.save = save
|
||||
//rollData.img = skill.img
|
||||
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async startRoll(rollData) {
|
||||
this.syncRoll(rollData)
|
||||
|
Reference in New Issue
Block a user