Enhance initiative + fix combat

This commit is contained in:
2022-11-30 20:58:27 +01:00
parent b2fe67ab05
commit ac96f3ca67
9 changed files with 46 additions and 36 deletions

View File

@ -648,15 +648,37 @@ export class BoLActor extends Actor {
}
/*-------------------------------------------- */
registerInit(initScore, isCritical, isFumble) {
this.update({ 'system.combat.lastinit': initScore, 'system.combat.iscritical': isCritical, 'system.combat.isfumble': isFumble })
registerInit(rollData) {
rollData.actor = undefined // Cleanup if present
this.setFlag("world", "last-initiative", rollData)
}
/*-------------------------------------------- */
getLastInitData() {
return this.system.combat
getInitiativeRank() {
let rollData = this.getFlag("world", "last-initiative")
let fvttInit = 5
if (this.type == 'character') {
if (rollData.isLegendary) {
fvttInit = 10
} else if (rollData.isCritical) {
fvttInit = 9
} else if (rollData.isSuccess ) {
fvttInit = 8
} else if (rollData.isFumble) {
fvttInit = 3
}
} else {
fvttInit = 4 // Pietaille par defautco
if ( this.getCharType() == 'adversary') {
fvttInit = 7
}
if ( this.getCharType() == 'tough') {
fvttInit = 6
}
}
return fvttInit
}
/*-------------------------------------------- */
async subHeroPoints(nb) {
let newHeroP = this.system.resources.hero.value - nb;