Fix: éliminer le risque de jets qui plante
Bloquait les rencontres en TMR. Quand un rollData ne contient pas les sous-noeuds pouvant être utilisés par les ajustements possibles, le jet de dés était perdu. Le calcul d'ajustements ajoute maintenant les noeuds use/ajustements s'ils ne sont pas fournis, pour éviter le risque.
This commit is contained in:
parent
b5dc14687e
commit
095eed9da3
@ -64,19 +64,19 @@ export const referenceAjustements = {
|
|||||||
},
|
},
|
||||||
encTotal: {
|
encTotal: {
|
||||||
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
|
||||||
isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use.encTotal,
|
isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use?.encTotal,
|
||||||
getLabel: (rollData, actor) => 'Encombrement total',
|
getLabel: (rollData, actor) => 'Encombrement total',
|
||||||
getValue: (rollData, actor) => -actor.getEncTotal()
|
getValue: (rollData, actor) => -actor.getEncTotal()
|
||||||
},
|
},
|
||||||
surenc: {
|
surenc: {
|
||||||
isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac) && actor.isSurenc(),
|
isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac) && actor.isSurenc(),
|
||||||
isUsed: (rollData, actor) => rollData.use?.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac),
|
isUsed: (rollData, actor) => rollData.use.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac),
|
||||||
getLabel: (rollData, actor) => 'Sur-encombrement',
|
getLabel: (rollData, actor) => 'Sur-encombrement',
|
||||||
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
|
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
|
||||||
},
|
},
|
||||||
moral: {
|
moral: {
|
||||||
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral,
|
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral,
|
||||||
isUsed: (rollData, actor) => rollData.use?.moral,
|
isUsed: (rollData, actor) => rollData.use.moral,
|
||||||
getLabel: (rollData, actor) => 'Appel au moral',
|
getLabel: (rollData, actor) => 'Appel au moral',
|
||||||
getValue: (rollData, actor) => 1
|
getValue: (rollData, actor) => 1
|
||||||
},
|
},
|
||||||
@ -84,7 +84,7 @@ export const referenceAjustements = {
|
|||||||
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac),
|
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac),
|
||||||
isUsed: (rollData, actor) => rollData.use.coeur != undefined,
|
isUsed: (rollData, actor) => rollData.use.coeur != undefined,
|
||||||
getLabel: (rollData, actor) => 'Ajustement de cœur',
|
getLabel: (rollData, actor) => 'Ajustement de cœur',
|
||||||
getValue: (rollData, actor) => -2 * (rollData.use.coeur?.coeur ?? 0)
|
getValue: (rollData, actor) => -2 * (rollData.use?.coeur?.coeur ?? 0)
|
||||||
},
|
},
|
||||||
moralTotal: {
|
moralTotal: {
|
||||||
isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac),
|
isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac),
|
||||||
@ -141,7 +141,7 @@ export const referenceAjustements = {
|
|||||||
getLabel: (rollData, actor) => "Force de l'alcool: ",
|
getLabel: (rollData, actor) => "Force de l'alcool: ",
|
||||||
getValue: (rollData, actor) => rollData.forceAlcool,
|
getValue: (rollData, actor) => rollData.forceAlcool,
|
||||||
},
|
},
|
||||||
ethylisme:{
|
ethylisme: {
|
||||||
isVisible: (rollData, actor) => rollData.ethylisme != undefined,
|
isVisible: (rollData, actor) => rollData.ethylisme != undefined,
|
||||||
isUsed: (rollData, actor) => rollData.ethylisme != undefined,
|
isUsed: (rollData, actor) => rollData.ethylisme != undefined,
|
||||||
getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme),
|
getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme),
|
||||||
@ -159,7 +159,9 @@ export class RollDataAjustements {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static calcul(rollData, actor) {
|
static calcul(rollData, actor) {
|
||||||
rollData.ajustements = {};
|
// s'assurer de la correction des infos rollData
|
||||||
|
mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
|
||||||
|
|
||||||
for (var key in referenceAjustements) {
|
for (var key in referenceAjustements) {
|
||||||
const reference = referenceAjustements[key];
|
const reference = referenceAjustements[key];
|
||||||
rollData.ajustements[key] = {
|
rollData.ajustements[key] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user