Fix ajustements visible

This commit is contained in:
Vincent Vandemeulebrouck 2021-04-20 00:50:16 +02:00
parent a9d49d793c
commit 77f0a93eb6
2 changed files with 3 additions and 2 deletions

View File

@ -95,7 +95,7 @@ export class RdDCarac {
* ainsi que de Perception active et volontaire.
*/
static isActionPhysique(selectedCarac) {
return Grammar.toLowerCaseNoAccent(selectedCarac?.label).match(/(apparence|force|agilite|dexterite|vue|ouie|odorat|empathie|melee|tir|lancer|derobee)/);
return Grammar.toLowerCaseNoAccent(selectedCarac?.label)?.match(/(apparence|force|agilite|dexterite|vue|ouie|odorat|empathie|melee|tir|lancer|derobee)/);
}
/* -------------------------------------------- */

View File

@ -55,7 +55,7 @@ export const referenceAjustements = {
getValue: (rollData, actor) => actor.getEtatGeneral()
},
malusArmure: {
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerivee(rollData.competence),
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac),
isUsed: (rollData, actor) => RdDCarac.isAgiliteOuDerivee(rollData.selectedCarac),
getLabel: (rollData, actor) => 'Malus armure',
getValue: (rollData, actor) => actor.getMalusArmure()
@ -131,6 +131,7 @@ export class RollDataAjustements {
for (var key in referenceAjustements) {
const reference = referenceAjustements[key];
rollData.ajustements[key] = {
visible: reference.isVisible && reference.isVisible(rollData, actor),
used: reference.isUsed(rollData, actor),
label: reference.getLabel && reference.getLabel(rollData, actor),
value: reference.getValue && reference.getValue(rollData, actor),