Merge branch 'working' into 'master'

fix regression: autoclose TMR on success

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!13
This commit is contained in:
Leratier Bretonnien 2020-11-13 21:41:27 +00:00
commit c02a200b69
2 changed files with 17 additions and 18 deletions

View File

@ -40,13 +40,13 @@ const specialResults = [
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: "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: "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: "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: "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: "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: "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: "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, 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, 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, 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, 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, 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, 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");
@ -86,13 +86,12 @@ export class RdDResolutionTable {
return duplicate(this.resolutionTable[carac][difficulte + 10]);
}
static buildXpMessage(rolled, level)
{
static buildXpMessage(rolled, level) {
if (rolled.isPart && level < 0) {
const xp = Math.abs(level);
const xpcarac = Math.floor(xp / 2);
const xpcomp = xp - xpcarac;
return "<br>Points d'expérience gagnés ! Carac: " + xpcarac + ", Comp: " + xpcomp;
const xp = Math.abs(level);
const xpcarac = Math.floor(xp / 2);
const xpcomp = xp - xpcarac;
return "<br>Points d'expérience gagnés ! Carac: " + xpcarac + ", Comp: " + xpcomp;
}
return "";
}
@ -105,7 +104,7 @@ export class RdDResolutionTable {
if (reussite.isSign) {
return reussiteNormale;
}
if (reussite.isSuccess){
if (reussite.isSuccess) {
return echecNormal;
}
}

View File

@ -138,7 +138,7 @@ export class RdDTMRDialog extends Dialog {
const roll = RdDResolutionTable.roll(carac, difficulte);
if ( !roll.isSuccess) {
if (roll.isEchec) {
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 " +
this.currentRencontre.force +
@ -230,11 +230,11 @@ export class RdDTMRDialog extends Dialog {
let level = draconic.data.niveau - 7;
let rolled = RdDResolutionTable.roll(carac, level);//RdDResolutionTable.computeChances(carac, level);
console.log(">>>>", rolled);
console.log("manageCaseHumide >>", rolled);
this.toclose = rolled.isSuccess;
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> !"
}
else {