Affichage niveau min necessaire #188

This commit is contained in:
sladecraven 2021-05-28 09:12:18 +02:00
parent be1ad028a7
commit f22622710a
3 changed files with 18 additions and 0 deletions

View File

@ -118,9 +118,21 @@ export class RdDResolutionTable {
rolled.finalLevel = finalLevel;
rolled.bonus = bonus;
rolled.factorHtml = Misc.getFractionHtml(diviseur);
rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll );
rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel;
return rolled;
}
/* -------------------------------------------- */
static findNiveauNecessaire(caracValue, rollValue) {
for (let cell of this.resolutionTable[caracValue]) {
if ( rollValue <= cell.norm) {
return cell.niveau;
}
}
return 16; // Dummy default
}
/* -------------------------------------------- */
static _updateChancesFactor(chances, diviseur) {
if (chances.level > -11 && diviseur && diviseur > 1) {
@ -137,11 +149,13 @@ export class RdDResolutionTable {
}
}
/* -------------------------------------------- */
static significativeRequise(chances) {
chances.roll = Math.floor(chances.score / 2);
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
}
/* -------------------------------------------- */
static succesRequis(chances) {
chances.roll = chances.score;
mergeObject(chances, reussites.find(x => x.code == 'norm'), { overwrite: true });

View File

@ -105,6 +105,8 @@ export class RdDRollResolutionTable extends Dialog {
this.updateRollResult();
});
}
/* -------------------------------------------- */
async updateRollResult() {
let rollData = this.rollData;
rollData.caracValue = parseInt(rollData.selectedCarac.value)
@ -127,6 +129,7 @@ export class RdDRollResolutionTable extends Dialog {
return diffLibre + diffConditions;
}
/* -------------------------------------------- */
_computeDiffLibre(rollData) {
return Misc.toInt(rollData.diffLibre);
}

View File

@ -22,4 +22,5 @@
</div>
<div>
<span>{{rolled.roll}} : </span><span class="rdd-roll-{{rolled.code}} strong-text">{{rolled.quality}}</span>
<span>(Min.:{{numberFormat rolled.niveauNecessaire decimals=0 sign=true}}/{{numberFormat rolled.ajustementNecessaire decimals=0 sign=true}}) </span>
</div>