forked from public/foundryvtt-reve-de-dragon
#76 : Jets de dés assistés pour les méditations
This commit is contained in:
@ -218,12 +218,44 @@ export class RdDRoll extends Dialog {
|
||||
this.rollData.useMalusEncTotal = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
// Section Méditation
|
||||
html.find('#isHeure').change((event) => {
|
||||
this.rollData.isHeure = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isPurification').change((event) => {
|
||||
this.rollData.isPurification = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isVeture').change((event) => {
|
||||
this.rollData.isVeture = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
html.find('#isComportement').change((event) => {
|
||||
this.rollData.isComportement = event.currentTarget.checked;
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_isIgnoreEtatGeneral(rollData) {
|
||||
return rollData.selectedCarac.ignoreEtatGeneral;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffMeditation( rollData ) {
|
||||
let diff = 0;
|
||||
if ( rollData.meditation ) {
|
||||
diff = (!rollData.isHeure) ? diff - 2 : diff;
|
||||
diff = (!rollData.isVeture) ? diff - 2 : diff;
|
||||
diff = (!rollData.isComportement) ? diff - 2 : diff;
|
||||
diff = (!rollData.isisPuritication) ? diff - 2 : diff;
|
||||
diff = diff - rollData.meditation.data.malus; // Malus permanent éventuel
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeFinalLevel(rollData) {
|
||||
const etat = this._isIgnoreEtatGeneral(rollData) ? 0 : Misc.toInt(rollData.etat);
|
||||
@ -235,13 +267,15 @@ export class RdDRoll extends Dialog {
|
||||
// Gestion malus armure
|
||||
const malusArmureValue = this._computeMalusArmure(rollData);
|
||||
|
||||
const diffMeditation = this._computeDiffMeditation( rollData );
|
||||
const diffLibre = this._computeDiffLibre(rollData);
|
||||
const diffCompetence = this._computeDiffCompetence(rollData);
|
||||
const diffMoral = rollData.selectedCarac == this.actor.data.data.carac.volonte ? rollData.moral : 0;
|
||||
|
||||
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + ajustementChance + bonusTactique;
|
||||
return etat + diffCompetence + diffLibre + diffMoral + diffConditions + malusEnc + malusEncTotal + malusArmureValue + diffMeditation + ajustementChance + bonusTactique;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffCompetence(rollData) {
|
||||
if (rollData.competence) {
|
||||
return Misc.toInt(rollData.competence.data.niveau);
|
||||
@ -252,6 +286,7 @@ export class RdDRoll extends Dialog {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeDiffLibre(rollData) {
|
||||
let diffLibre = Misc.toInt(rollData.diffLibre);
|
||||
if (rollData.draconicList && rollData.selectedSort) {
|
||||
|
Reference in New Issue
Block a user