Fenêtres Roll V2
Maintenant disponibles pour: - méditation - tâches - soins
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { RdDItemSigneDraconique } from "../item/signedraconique.js"
|
||||
import { DIFF, ROLL_TYPE_MEDITATION } from "./roll-constants.mjs"
|
||||
import { PART_MEDITATION } from "./roll-part-meditation.mjs"
|
||||
import { RollType } from "./roll-type.mjs"
|
||||
@@ -16,4 +17,20 @@ export class RollTypeMeditation extends RollType {
|
||||
onSelect(rollData) {
|
||||
this.setDiffType(rollData, DIFF.AUCUN)
|
||||
}
|
||||
callbacks(rollOptions) { return [RollTypeMeditation.$onRollMeditation] }
|
||||
|
||||
static async $onRollMeditation(rollData) {
|
||||
const actor = rollData.active.actor
|
||||
const meditation = rollData.current.meditation.meditation
|
||||
const rolled = rollData.rolled
|
||||
if (meditation && rolled) {
|
||||
if (rolled.isSuccess) {
|
||||
await actor.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditation, rolled)])
|
||||
}
|
||||
if (rolled.isEPart) {
|
||||
await actor.updateEmbeddedDocuments('Item', [{ _id: meditation._id, 'system.malus': meditation.system.malus - 1 }])
|
||||
}
|
||||
await actor.santeIncDec("fatigue", 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user