fix: autoclose TMR on success
Ajout de isSuccess aux cas possibles pour lisibilité et éviter les erreurs bêtes
This commit is contained in:
parent
a00f187f9f
commit
368a5b369b
@ -40,13 +40,13 @@ const specialResults = [
|
|||||||
|
|
||||||
|
|
||||||
const reussites = [
|
const reussites = [
|
||||||
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEPart: true, isETotal: true, tache: -4, qualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
|
{ code: "etotal", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, tache: -4, qualite: -6, quality: "Echec total", condition: (target, roll) => roll >= target.etotal && roll <= 100 },
|
||||||
{ code: "epart", isPart: false, isSign: false, isSuccess: false, isEPart: true, isETotal: false, tache: -2, qualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) },
|
{ code: "epart", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: false, tache: -2, qualite: -4, quality: "Echec particulier", condition: (target, roll) => (roll >= target.epart && roll < target.etotal) },
|
||||||
{ code: "echec", isPart: false, isSign: false, isSuccess: false, isEPart: false, isETotal: false, tache: 0, qualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.score && roll < target.etotal) },
|
{ code: "echec", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: false, isETotal: false, tache: 0, qualite: -2, quality: "Echec normal", condition: (target, roll) => (roll > target.score && roll < target.etotal) },
|
||||||
{ code: "norm", isPart: false, isSign: false, isSuccess: true, isEPart: false, isETotal: false, tache: 1, qualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.score) },
|
{ code: "norm", isPart: false, isSign: false, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 1, qualite: 0, quality: "Réussite normale", condition: (target, roll) => (roll > target.sign && roll <= target.score) },
|
||||||
{ code: "sign", isPart: false, isSign: true, isSuccess: true, isEPart: false, isETotal: false, tache: 2, qualite: 1, quality: "Réussite significative", condition: (target, roll) => (roll > target.part && roll <= target.sign) },
|
{ code: "sign", isPart: false, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 2, qualite: 1, quality: "Réussite significative", condition: (target, roll) => (roll > target.part && roll <= target.sign) },
|
||||||
{ code: "part", isPart: true, isSign: true, isSuccess: true, isEPart: false, isETotal: false, tache: 3, qualite: 2, quality: "Réussite Particulière!", condition: (target, roll) => (roll > 0 && roll <= target.part) },
|
{ code: "part", isPart: true, isSign: true, isSuccess: true, isEchec: false, isEPart: false, isETotal: false, tache: 3, qualite: 2, quality: "Réussite Particulière!", condition: (target, roll) => (roll > 0 && roll <= target.part) },
|
||||||
{ code: "error", isPart: false, isSign: false, isSuccess: false, isEPart: true, isETotal: true, tache: 0, qualite: 0, quality: "Jet de dés invalide", condition: (target, roll) => (roll <= 0 || roll > 100) }
|
{ code: "error", isPart: false, isSign: false, isSuccess: false, isEchec: true, isEPart: true, isETotal: true, tache: 0, qualite: 0, quality: "Jet de dés invalide", condition: (target, roll) => (roll <= 0 || roll > 100) }
|
||||||
];
|
];
|
||||||
|
|
||||||
const reussiteSignificative = reussites.find(r => r.code == "sign");
|
const reussiteSignificative = reussites.find(r => r.code == "sign");
|
||||||
@ -86,8 +86,7 @@ export class RdDResolutionTable {
|
|||||||
return duplicate(this.resolutionTable[carac][difficulte + 10]);
|
return duplicate(this.resolutionTable[carac][difficulte + 10]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static buildXpMessage(rolled, level)
|
static buildXpMessage(rolled, level) {
|
||||||
{
|
|
||||||
if (rolled.isPart && level < 0) {
|
if (rolled.isPart && level < 0) {
|
||||||
const xp = Math.abs(level);
|
const xp = Math.abs(level);
|
||||||
const xpcarac = Math.floor(xp / 2);
|
const xpcarac = Math.floor(xp / 2);
|
||||||
|
@ -138,7 +138,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
const roll = RdDResolutionTable.roll(carac, difficulte);
|
const roll = RdDResolutionTable.roll(carac, difficulte);
|
||||||
|
|
||||||
if ( !roll.isSuccess) {
|
if (roll.isEchec) {
|
||||||
TMRUtility.processRencontreEchec( this.actor, this.currentRencontre);
|
TMRUtility.processRencontreEchec( this.actor, this.currentRencontre);
|
||||||
ChatMessage.create( { title: "TMR", content: "Vous avez <strong>échoué</strong> à votre maîtrise d'un " . this.currentRencontre.name + " de force " +
|
ChatMessage.create( { title: "TMR", content: "Vous avez <strong>échoué</strong> à votre maîtrise d'un " . this.currentRencontre.name + " de force " +
|
||||||
this.currentRencontre.force +
|
this.currentRencontre.force +
|
||||||
@ -230,11 +230,11 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
let level = draconic.data.niveau - 7;
|
let level = draconic.data.niveau - 7;
|
||||||
let rolled = RdDResolutionTable.roll(carac, level);//RdDResolutionTable.computeChances(carac, level);
|
let rolled = RdDResolutionTable.roll(carac, level);//RdDResolutionTable.computeChances(carac, level);
|
||||||
|
|
||||||
console.log(">>>>", rolled);
|
console.log("manageCaseHumide >>", rolled);
|
||||||
|
|
||||||
this.toclose = rolled.isSuccess;
|
|
||||||
let content = "";
|
let content = "";
|
||||||
if (!rolled.isSuccess) {
|
this.toclose = rolled.isEchec;
|
||||||
|
if (rolled.isEchec) {
|
||||||
content += "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> !"
|
content += "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> !"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user