Corrections soins des blessures V2

This commit is contained in:
2025-12-15 01:09:34 +01:00
parent e33727ac8d
commit 67a085f884
11 changed files with 332 additions and 305 deletions
+6 -10
View File
@@ -1,4 +1,3 @@
import { ITEM_TYPES } from "../constants.js"
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js"
import { DIFF, ROLL_TYPE_TACHE } from "./roll-constants.mjs"
import { PART_TACHE } from "./roll-part-tache.mjs"
@@ -19,25 +18,22 @@ export class RollTypeTache extends RollType {
this.setDiffType(rollData, DIFF.AUCUN)
}
callbacks(rollOptions) { return [ async r => await RollTypeTache.$onRollTache(r, rollOptions)] }
callbacks(rollOptions) { return [async r => await RollTypeTache.$onRollTache(r)] }
static async $onRollTache(rollData, rollOptions) {
static async $onRollTache(rollData) {
const actor = rollData.active.actor
const tache = rollData.current[PART_TACHE].tache
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
await actor.santeIncDec("fatigue", tache.system.fatigue)
}
rollData.current[PART_TACHE].tache = await tache.update({
'system.points_de_tache_courant': tache.system.points_de_tache_courant + rollData.rolled.ptTache,
'system.nb_jet_succes': tache.system.nb_jet_succes + (rollData.rolled.isSuccess ? 1 : 0),
'system.nb_jet_echec': tache.system.nb_jet_echec + (rollData.rolled.isSuccess ? 0 : 1),
'system.difficulte': tache.system.difficulte - (rollData.rolled.isETotal ? 1 : 0),
}, {render:true})
}, { render: true })
if (rollOptions?.onRollAutomate) {
await rollOptions.onRollAutomate(rollData)
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
await actor.santeIncDec("fatigue", tache.system.fatigue)
}
}
}