diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js index 1d21d9b7..ae40b532 100644 --- a/module/actor/base-actor-reve.js +++ b/module/actor/base-actor-reve.js @@ -346,7 +346,6 @@ export class RdDBaseActorReve extends RdDBaseActor { callbackAction: r => this.$onRollCaracResult(r) }) } - /* -------------------------------------------- */ async rollCarac(caracName, options = {}) { if (Grammar.equalsInsensitive(caracName, 'taille')) { diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index 544dd711..a4962cfa 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -81,7 +81,6 @@ export class RdDBaseActor extends Actor { } } - static getRealActor(actorId, tokenId) { if (tokenId) { let token = canvas.tokens.get(tokenId) @@ -161,8 +160,11 @@ export class RdDBaseActor extends Actor { return RdDBaseActor.$findCaracByName(carac, name); } + mapCarac(caracCode) { return caracCode } + getCaracByName(name) { - switch (Grammar.toLowerCaseNoAccent(name)) { + name = this.mapCarac(Grammar.toLowerCaseNoAccent(name)) + switch (name) { case 'reve-actuel': case 'reve actuel': return this.getCaracReveActuel(); case 'chance-actuelle': case 'chance-actuelle': diff --git a/module/actor/creature.js b/module/actor/creature.js index c2f51b27..78d3f0cc 100644 --- a/module/actor/creature.js +++ b/module/actor/creature.js @@ -1,4 +1,6 @@ +import { Grammar } from "../grammar.js"; import { ITEM_TYPES } from "../item.js"; +import { LIST_CARAC_AUTRES } from "../rdd-carac.js"; import { RdDBaseActorSang } from "./base-actor-sang.js"; export class RdDCreature extends RdDBaseActorSang { @@ -32,4 +34,14 @@ export class RdDCreature extends RdDBaseActorSang { } } + mapCarac(caracCode) { + switch (caracCode) { + case 'vue': case 'ouie': + case 'odoratgout': + case 'empathie': + return 'perception' + } + return caracCode + } + } diff --git a/module/actor/entite.js b/module/actor/entite.js index ef11b95a..ee6e480b 100644 --- a/module/actor/entite.js +++ b/module/actor/entite.js @@ -117,4 +117,13 @@ export class RdDEntite extends RdDBaseActorReve { super.setEntiteReveAccordee(actor) } } + + mapCarac(caracCode) { + switch (caracCode) { + case 'taille': + return caracCode + } + return 'reve' + } + } diff --git a/module/apps/rdd-text-roll.js b/module/apps/rdd-text-roll.js index 7a808d61..e8c47af7 100644 --- a/module/apps/rdd-text-roll.js +++ b/module/apps/rdd-text-roll.js @@ -24,18 +24,16 @@ class TextRollCaracCompetence { } static async onRollText(event, actor) { - const caracCode = event.currentTarget.attributes['data-carac-code']?.value + const caracCode = event.currentTarget.attributes['data-carac-code']?.value if (caracCode) { const competence = event.currentTarget.attributes['data-competence']?.value const diff = event.currentTarget.attributes['data-diff']?.value - - const path = RdDCarac.caracDetails(caracCode)?.path const actors = TextRollCaracCompetence.getSelectedActors(actor) - actors.filter(it => foundry.utils.getProperty(it, path) != undefined) - .forEach(it => TextRollCaracCompetence.doRoll(it, caracCode, competence, diff)) + actors.forEach(it => TextRollCaracCompetence.doRoll(it, caracCode, competence, diff)) } } static async doRoll(actor, caracCode, competence, diff) { + caracCode = actor.mapCarac(caracCode) if (competence) { if (actor.type == ACTOR_TYPES.personnage) { actor.rollCaracCompetence(caracCode, competence, diff)