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.finalLevel = finalLevel;
|
||||||
rolled.bonus = bonus;
|
rolled.bonus = bonus;
|
||||||
rolled.factorHtml = Misc.getFractionHtml(diviseur);
|
rolled.factorHtml = Misc.getFractionHtml(diviseur);
|
||||||
|
rolled.niveauNecessaire = this.findNiveauNecessaire(caracValue, rolled.roll );
|
||||||
|
rolled.ajustementNecessaire = rolled.niveauNecessaire - finalLevel;
|
||||||
return rolled;
|
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) {
|
static _updateChancesFactor(chances, diviseur) {
|
||||||
if (chances.level > -11 && diviseur && diviseur > 1) {
|
if (chances.level > -11 && diviseur && diviseur > 1) {
|
||||||
@ -137,11 +149,13 @@ export class RdDResolutionTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static significativeRequise(chances) {
|
static significativeRequise(chances) {
|
||||||
chances.roll = Math.floor(chances.score / 2);
|
chances.roll = Math.floor(chances.score / 2);
|
||||||
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static succesRequis(chances) {
|
static succesRequis(chances) {
|
||||||
chances.roll = chances.score;
|
chances.roll = chances.score;
|
||||||
mergeObject(chances, reussites.find(x => x.code == 'norm'), { overwrite: true });
|
mergeObject(chances, reussites.find(x => x.code == 'norm'), { overwrite: true });
|
||||||
|
@ -105,6 +105,8 @@ export class RdDRollResolutionTable extends Dialog {
|
|||||||
this.updateRollResult();
|
this.updateRollResult();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async updateRollResult() {
|
async updateRollResult() {
|
||||||
let rollData = this.rollData;
|
let rollData = this.rollData;
|
||||||
rollData.caracValue = parseInt(rollData.selectedCarac.value)
|
rollData.caracValue = parseInt(rollData.selectedCarac.value)
|
||||||
@ -127,6 +129,7 @@ export class RdDRollResolutionTable extends Dialog {
|
|||||||
return diffLibre + diffConditions;
|
return diffLibre + diffConditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_computeDiffLibre(rollData) {
|
_computeDiffLibre(rollData) {
|
||||||
return Misc.toInt(rollData.diffLibre);
|
return Misc.toInt(rollData.diffLibre);
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>{{rolled.roll}} : </span><span class="rdd-roll-{{rolled.code}} strong-text">{{rolled.quality}}</span>
|
<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>
|
</div>
|
Loading…
Reference in New Issue
Block a user