From 98c6133938d355c20b814232d247cff4f389bdb0 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 14 Feb 2021 18:31:00 +0100 Subject: [PATCH] Fix danses --- module/actor.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/module/actor.js b/module/actor.js index 1ab93c47..0928318c 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2087,11 +2087,13 @@ export class RdDActor extends Actor { diffLibre: - (oeuvre.data.niveau ?? 0), diffConditions: 0, use: { libre: false, conditions: true }, - selectedCarac: duplicate(this.data.data.carac[selected]), - forceCarac: {} + selectedCarac: duplicate(this.data.data.carac[selected]) }); artData.competence.data.defaut_carac = selected; - artData.forceCarac[selected] = duplicate(this.data.data.carac[selected]); + if ( !artData.forceCarac ) { + artData.forceCarac = {}; + artData.forceCarac[selected] = duplicate(this.data.data.carac[selected]); + } console.log("rollArt !!!", artData); @@ -2122,15 +2124,23 @@ export class RdDActor extends Actor { const oeuvre = duplicate(this.getChant(id)); await this._rollArt(artData, "ouie", oeuvre); } + /* -------------------------------------------- */ async rollDanse(id) { - const artData = { art: 'danse', verbe: 'Danser' }; + const artData = { art: 'danse', verbe: 'Danser', forceCarac: {} }; const oeuvre = duplicate(this.getOeuvre(id, artData.art)); - const selectedCarac = this._getCaracDanse(oeuvre,); + const selectedCarac = this._getCaracDanse(oeuvre); + if ( oeuvre.data.agilite) { + artData.forceCarac['agilite'] = duplicate(this.data.data.carac.agilite ); + } + if ( oeuvre.data.apparence) { + artData.forceCarac['apparence'] = duplicate(this.data.data.carac.apparence ); + } await this._rollArt(artData, selectedCarac, oeuvre); } - _getCaracDanse(oeuvre) { + /* -------------------------------------------- */ + _getCaracDanse(oeuvre) { if (oeuvre.data.agilite) { return "agilite"; } else if (oeuvre.data.apparence) { return "apparence"; } const competence = this.getCompetence(oeuvre.data.competence);