Affichage niveau min necessaire #188
This commit is contained in:
parent
be1ad028a7
commit
f22622710a
@ -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 });
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user