diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index ab29c1f5..6285151f 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -4,7 +4,6 @@ import { Misc } from "./misc.js"; import { RdDBonus } from "./rdd-bonus.js"; import { RdDCombat } from "./rdd-combat.js"; import { RdDDice } from "./rdd-dice.js"; -import { RdDRollTables } from "./rdd-rolltables.js"; /** * difficultés au delà de -10 @@ -48,8 +47,8 @@ const specialResults = [ const reussites = [ { code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: -4, ptQualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 }, { code: "epart", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: false, ptTache: -2, ptQualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) }, - { code: "echec", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: false, isETotal: false, ptTache: 0, ptQualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.score && roll < target.etotal) }, - { code: "norm", isPart: false, isSign: false, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 1, ptQualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.score) }, + { code: "echec", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: false, isETotal: false, ptTache: 0, ptQualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.norm && roll < target.etotal) }, + { code: "norm", isPart: false, isSign: false, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 1, ptQualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.norm) }, { code: "sign", isPart: false, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 2, ptQualite: 1, quality: "Réussite significative", condition: (target, roll) => (roll > target.part && roll <= target.sign) }, { code: "part", isPart: true, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, ptTache: 3, ptQualite: 2, quality: "Réussite Particulière!", condition: (target, roll) => (roll > 0 && roll <= target.part) }, { code: "error", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, ptTache: 0, ptQualite: 0, quality: "Jet de dés invalide", condition: (target, roll) => (roll <= 0 || roll > 100) } @@ -288,31 +287,34 @@ export class RdDResolutionTable { return { niveau: niveau, score: percentage, + norm: Math.min(99, percentage), sign: this._reussiteSignificative(percentage), part: this._reussitePart(percentage), epart: this._echecParticulier(percentage), etotal: this._echecTotal(percentage) - } + }; } /* -------------------------------------------- */ - static _reussiteSignificative(score) { - return Math.floor(score / 2); + static _reussiteSignificative(percentage) { + return Math.floor(percentage / 2); } /* -------------------------------------------- */ - static _reussitePart(score) { - return Math.ceil(score / 5); + static _reussitePart(percentage) { + return Math.ceil(percentage / 5); } /* -------------------------------------------- */ - static _echecParticulier(score) { - return Math.ceil(score / 5) + 80; + static _echecParticulier(percentage) { + const epart = Math.ceil(percentage / 5) + 80; + return epart >= 100 ? 101 : epart; } /* -------------------------------------------- */ - static _echecTotal(score) { - return Math.ceil(score / 10) + 91; + static _echecTotal(percentage) { + const etotal = Math.ceil(percentage / 10) + 91; + return percentage >= 100 ? 101 : Math.min(etotal, 100); } /* -------------------------------------------- */