From 5776ae0a20e1d370e35276720923adffdcc3cc0d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 15 Nov 2020 00:59:23 +0100 Subject: [PATCH 1/2] Parade bouclier: pas besoin de significative --- module/actor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/actor.js b/module/actor.js index de9734c4..3924ff93 100644 --- a/module/actor.js +++ b/module/actor.js @@ -153,7 +153,7 @@ export class RdDActor extends Actor { let attCategory = RdDUtility.getArmeCategory(rollData.attackerRoll.arme); let defCategory = RdDUtility.getArmeCategory(rollData.arme); if (defCategory == "bouclier") - rollData.needSignificative = true; + rollData.needSignificative = false; else if (attCategory != defCategory) rollData.needSignificative = true; if (attCategory.match("epee") && (defCategory == "hache" || defCategory == "lance")) From 52caf1b39a73be303f189da55167ecb35677ecf4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 15 Nov 2020 02:07:41 +0100 Subject: [PATCH 2/2] Separation difficulte libre/conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ajout de diffConditions pour gérer l'ajustement de conditions * renommage de bmValue en diffLibre * calcul de l'ajustement (etat+conditions+difficulté libre) * présentation des 2 champs fix: * utiliser .change() au lieu de .click() permet de supporter aussi les changements au clavier --- module/actor-sheet.js | 5 +- module/actor.js | 141 ++++++++++++++------------- module/misc.js | 20 +++- module/rdd-main.js | 10 +- module/rdd-resolution-table.js | 19 ++-- module/rdd-roll-dialog.js | 51 +++++----- module/rdd-roll-encaisser.js | 2 +- module/rdd-tmr-dialog.js | 1 - module/rdd-utility.js | 11 ++- templates/dialog-competence.html | 19 +++- templates/dialog-roll-carac.html | 18 +++- templates/dialog-roll-encaisser.html | 4 +- templates/dialog-roll-sort.html | 21 ++-- templates/dialog-tmr.html | 42 ++------ 14 files changed, 199 insertions(+), 165 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 52bde16a..131f6996 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -110,7 +110,8 @@ export class RdDActorSheet extends ActorSheet { data.data.competenceByCategory = data.competenceByCategory; data.data.encombrementTotal = this.actor.encombrementTotal; data.data.isGM = game.user.isGM; - data.bonusmalusTable = CONFIG.RDD.bonusmalus; + data.ajustementsConditions = CONFIG.RDD.ajustementsConditions; + data.difficultesLibres = CONFIG.RDD.difficultesLibres; // low is normal, this the base used to compute the grid. data.data.fatigueHTML = "" + RdDUtility.makeHTMLfatigueMatrix( data.data.sante.fatigue.value, data.data.sante.endurance.max ).html() + "
"; @@ -156,7 +157,7 @@ export class RdDActorSheet extends ActorSheet { /* -------------------------------------------- */ async displayDialogEncaisser( ) { - let data = { bonusmalusTable: CONFIG.RDD.bonusmalus }; + let data = { ajustementsConditions: CONFIG.RDD.ajustementsConditions /* techniquement on peut encaisser à +20 */ }; let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data ); new RdDEncaisser(html, this.actor ).render(true); } diff --git a/module/actor.js b/module/actor.js index 3924ff93..12f5fcc7 100644 --- a/module/actor.js +++ b/module/actor.js @@ -166,8 +166,8 @@ export class RdDActor extends Actor { console.log(">>> ROLL", rollData, rolled); let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel); - let resumeCompetence = (rollData.competence) ? rollData.competence.name : rollData.bmValue; - let explications = "
Points de taches : " + rolled.tache + ", Points de qualité: " + rolled.qualite; + let resumeCompetence = (rollData.competence) ? rollData.competence.name : (rollData.diffLibre + rollData.diffConditions); + let explications = "
Points de taches : " + rolled.ptTache + ", ajustement qualité: " + rolled.ptQualite; // Fight management ! let defenseMsg; @@ -217,7 +217,8 @@ export class RdDActor extends Actor { // Final chat message let chatOptions = { content: "Test : " + rollData.selectedCarac.label + " / " + resumeCompetence + "" - + "
Jet : " + rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rolled.score + "%
Résutat : " + rolled.roll + + "
Difficultés libre : " + rollData.diffLibre + " / conditions : " + Misc.toSignedString(rollData.diffConditions) +" / état : " + rollData.etat + + "
Jet : " + rolled.roll + " sur "+ rolled.score + "% (" + rollData.selectedCarac.value + " à " +Misc.toSignedString(rollData.finalLevel) + ")" + "
" + quality + "" + explications + xpmsg, user: game.user._id, @@ -264,7 +265,7 @@ export class RdDActor extends Actor { let closeTMR = true; let coutReve = sort.data.ptreve_reel || sort.data.ptreve; // cas de sort à ptreve variables - let explications = "
Lancement du sort " + sort.name + " : " + Misc._upperFirst(sort.data.draconic) + let explications = "
Lancement du sort " + sort.name + " : " + Misc.upperFirst(sort.data.draconic) + " pour "+coutReve+ " points de Rêve" + "
Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")"; @@ -694,7 +695,7 @@ export class RdDActor extends Actor { case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll } } let second = RdDResolutionTable.rollChances(target) - switch (second.qualite) { + switch (second.quality) { case "part": case "sign": return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll } default: @@ -716,9 +717,11 @@ export class RdDActor extends Actor { selectedSort: sortList[0], coord: coord, finalLevel: 0, - bmValue: sortList[0].data.difficulte, // Per default at startup + diffConditions: 0, + diffLibre: sortList[0].data.difficulte, // Per default at startup coutreve: Array(20).fill().map((item, index) => 1 + index), - bonusmalusTable: CONFIG.RDD.bonusmalus + ajustementsConditions: CONFIG.RDD.ajustementsConditions, + difficultesLibres: CONFIG.RDD.difficultesLibres } let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData); new RdDRollDialog("sort", html, rollData, this ).render(true); @@ -729,41 +732,43 @@ export class RdDActor extends Actor { { let rollData = { selectedCarac: this.data.data.carac[caracName], - bonusmalusTable: CONFIG.RDD.bonusmalus, + ajustementsConditions: CONFIG.RDD.ajustementsConditions, + difficultesLibres: CONFIG.RDD.difficultesLibres, etat: this.data.data.compteurs.etat.value, finalLevel: 0, - bmValue: 0 + diffConditions: 0, + diffLibre: 0 } - console.log(caracName, rollData); - let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData); - new RdDRollDialog("carac", html, rollData, this ).render(true); - } - - /* -------------------------------------------- */ - getSortList() { - return this.data.items.filter(item => item.type == "sort"); - } - - /* -------------------------------------------- */ - getDraconicList() { - return this.data.items.filter(item => item.data.categorie == 'draconic') - } - - /* -------------------------------------------- */ - async displayTMR(mode="normal" ) - { - let isRapide= mode == "rapide" - if (mode != "visu") - { - let minReveValue = (isRapide) ? 3 : 2; - if (this.data.data.reve.reve.value <= minReveValue ) { - ChatMessage.create( { title: "Montée impossible !", content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes", - whisper: ChatMessage.getWhisperRecipients(game.user.name) } ); - return; - } + console.log(caracName, rollData); + let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData); + new RdDRollDialog("carac", html, rollData, this ).render(true); } - let data = { + /* -------------------------------------------- */ + getSortList() { + return this.data.items.filter(item => item.type == "sort"); + } + + /* -------------------------------------------- */ + getDraconicList() { + return this.data.items.filter(item => item.data.categorie == 'draconic') + } + + /* -------------------------------------------- */ + async displayTMR(mode="normal" ) + { + let isRapide= mode == "rapide" + if (mode != "visu") + { + let minReveValue = (isRapide) ? 3 : 2; + if (this.data.data.reve.reve.value <= minReveValue ) { + ChatMessage.create( { title: "Montée impossible !", content: "Vous n'avez plus assez de Points de Reve pour monter dans les Terres Médianes", + whisper: ChatMessage.getWhisperRecipients(game.user.name) } ); + return; + } + } + + let data = { fatigueHTML:"" + RdDUtility.makeHTMLfatigueMatrix( this.data.data.sante.fatigue.value, this.data.data.sante.endurance.max ).html() + "
", draconic: this.getDraconicList(), sort: this.getSortList(), @@ -771,36 +776,38 @@ export class RdDActor extends Actor { pointsReve: this.data.data.reve.reve.value, isRapide: isRapide } - let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data ); - this.currentTMR = new RdDTMRDialog(html, this, data, mode == "visu"); - this.currentTMR.render(true); - } - - /* -------------------------------------------- */ - rollArme( armeName ) - { - let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName)); - if ( armeItem && armeItem.data.competence ) - this.rollCompetence( armeItem.data.competence, armeItem ); - else - this.rollCompetence( armeName ); //Bypass mode! - } - - /* -------------------------------------------- */ - async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) - { - let competence = RdDUtility.findCompetence( this.data.items, name); - console.log("rollCompetence !!!", competence, armeItem, attackerRoll); - // Common rollData values - let rollData = { - bonusmalusTable: CONFIG.RDD.bonusmalus, - etat: this.data.data.compteurs.etat.value, - bmValue: (attackerRoll) ? attackerRoll.bmValue : 0, - attackerRoll: attackerRoll, - finalLevel: 0 + let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data ); + this.currentTMR = new RdDTMRDialog(html, this, data, mode == "visu"); + this.currentTMR.render(true); } - - if ( competence.type == 'competencecreature') { // Specific case for Creatures + + /* -------------------------------------------- */ + rollArme( armeName ) + { + let armeItem = this.data.items.find(item=>item.type==="arme" && (item.name === armeName)); + if ( armeItem && armeItem.data.competence ) + this.rollCompetence( armeItem.data.competence, armeItem ); + else + this.rollCompetence( armeName ); //Bypass mode! + } + + /* -------------------------------------------- */ + async rollCompetence( name, armeItem=undefined, attackerRoll=undefined ) + { + let competence = RdDUtility.findCompetence( this.data.items, name); + console.log("rollCompetence !!!", competence, armeItem, attackerRoll); + // Common rollData values + let rollData = { + ajustementsConditions: CONFIG.RDD.ajustementsConditions, + difficultesLibres: CONFIG.RDD.difficultesLibres, + etat: this.data.data.compteurs.etat.value, + diffConditions: 0, + diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, + attackerRoll: attackerRoll, + finalLevel: 0 + } + + if ( competence.type == 'competencecreature') { // Specific case for Creatures if ( competence.data.iscombat ) { armeItem = { name: name, data: { dommages: competence.data.dommages} }; } @@ -894,7 +901,7 @@ export class RdDActor extends Actor { parerAttaque( attackerRoll, armeId ) { let armeItem = this.getOwnedItem(armeId); // Item.data.data ! - console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.bmValue); + console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre); this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll ); } diff --git a/module/misc.js b/module/misc.js index 962156f5..cd3dc4f6 100644 --- a/module/misc.js +++ b/module/misc.js @@ -5,7 +5,25 @@ * to actual classes of the game system or of FoundryVTT */ export class Misc { - static _upperFirst(text) { + static upperFirst(text) { return text.charAt(0).toUpperCase() + text.slice(1); } + static toSignedString(number){ + const value = parseInt(number) + const isPositiveNumber = value != NaN && value > 0; + return isPositiveNumber ? "+"+number : number + } + /** + * Converts the value to an integer, or to 0 if undefined/null/not representing integer + * @param {*} value value to convert to an integer using parseInt + */ + static toInt(value) + { + if (value == undefined) + { + return 0; + } + const parsed = parseInt(value); + return isNaN(parsed) ? 0 : parsed; + } } \ No newline at end of file diff --git a/module/rdd-main.js b/module/rdd-main.js index 25c084ec..9b438cb5 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -119,10 +119,12 @@ Hooks.once("init", async function() { // Define custom Entity classes CONFIG.Actor.entityClass = RdDActor; CONFIG.RDD = { - resolutionTable : RdDResolutionTable.resolutionTable, - level_category : RdDUtility.getLevelCategory(), - carac_array : RdDUtility.getCaracArray(), - bonusmalus : RdDUtility.getBonusMalus() + resolutionTable : RdDResolutionTable.resolutionTable, + level_category : RdDUtility.getLevelCategory(), + carac_array : RdDUtility.getCaracArray(), + ajustementsConditions : RdDUtility.getAjustementsConditions(), + difficultesLibres : RdDUtility.getDifficultesLibres() + } // Register sheet application classes diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 2c9e4039..9d9cd19e 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -1,3 +1,4 @@ +import { Misc } from "./misc.js"; /** * difficultés au delà de -10 @@ -40,13 +41,13 @@ const specialResults = [ const reussites = [ - { 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) } + { 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: "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) } ]; const reussiteSignificative = reussites.find(r => r.code == "sign"); @@ -196,9 +197,7 @@ export class RdDResolutionTable { tr.append($("").text("...")); } for (let difficulte = minLevel; difficulte <= maxLevel; difficulte++) { - const niveau = dataRow[difficulte + 10].niveau; - const txt = (niveau > 0 ? "+" : "") + niveau; - tr.append($("").text(txt)); + tr.append($("").text(Misc.toSignedString(difficulte))); } return tr; } diff --git a/module/rdd-roll-dialog.js b/module/rdd-roll-dialog.js index 07578790..11fafe98 100644 --- a/module/rdd-roll-dialog.js +++ b/module/rdd-roll-dialog.js @@ -1,3 +1,4 @@ +import { Misc } from "./misc.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; /** @@ -38,7 +39,7 @@ export class RdDRollDialog extends Dialog { dialogOptions.height = 350 } else if (mode == "sort") { dialogConf.title = "Lancer un sort" - dialogConf.height = 450 + dialogConf.height = 470 } super(dialogConf, dialogOptions) @@ -65,7 +66,6 @@ export class RdDRollDialog extends Dialog { let rollLevel = RdDRollDialog._computeFinalLevel(rollData); rollData.finalLevel = rollLevel; - rollData.finalLevelStr = (rollLevel > 0 ? "+" : "") + rollLevel; rollData.rollTarget = RdDResolutionTable.computeChances(rollData.selectedCarac.value, rollData.finalLevel); // Sort management @@ -83,7 +83,7 @@ export class RdDRollDialog extends Dialog { } } - $("#roll-param").text(rollData.selectedCarac.value + " / " + rollData.finalLevelStr); + $("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel)); $("#compdialogTitle").text(RdDRollDialog._getTitle(rollData)); $(".table-resolution").remove(); $("#resolutionTable").append(RdDResolutionTable.buildHTMLTableExtract(caracValue, rollLevel)); @@ -101,36 +101,42 @@ export class RdDRollDialog extends Dialog { // Si sort, for les points de reve à 1 if (rollData.selectedSort && !rollData.selectedSort.data.ptreve_reel) rollData.selectedSort.data.ptreve_reel = 1; - $("#bonusmalus").val(rollData.bmValue); + $("#diffLibre").val(Misc.toInt(rollData.diffLibre)); + $("#diffConditions").val(Misc.toInt(rollData.diffConditions)); updateRollResult(rollData); }); // Update ! - html.find('#bonusmalus').click((event) => { - rollData.bmValue = event.currentTarget.value; // Update the selected bonus/malus + html.find('#diffLibre').change((event) => { + rollData.diffLibre = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus //console.log("RdDRollDialog","BM CLICKED !!!", rollData); updateRollResult(rollData); }); - html.find('#carac').click((event) => { + html.find('#diffConditions').change((event) => { + rollData.diffConditions = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus + //console.log("RdDRollDialog","BM CLICKED !!!", rollData); + updateRollResult(rollData); + }); + html.find('#carac').change((event) => { let caracKey = event.currentTarget.value; this.rollData.selectedCarac = rollData.carac[caracKey]; // Update the selectedCarac //console.log("RdDRollDialog","CARAC CLICKED !!!", rollData); updateRollResult(rollData); }); - html.find('#draconic').click((event) => { - let draconicKey = Number(event.currentTarget.value); + html.find('#draconic').change((event) => { + let draconicKey = Misc.toInt(event.currentTarget.value); this.rollData.selectedDraconic = rollData.draconicList[draconicKey]; // Update the selectedCarac //console.log("RdDRollDialog","CARAC CLICKED !!!", rollData); updateRollResult(rollData); }); - html.find('#sort').click((event) => { - let sortKey = Number(event.currentTarget.value); + html.find('#sort').change((event) => { + let sortKey = Misc.toInt(event.currentTarget.value); this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac //console.log("RdDRollDialog - Sort selection", rollData.selectedSort); updateRollResult(rollData); }); - html.find('#ptreve-variable').click((event) => { - let ptreve = Number(event.currentTarget.value); + html.find('#ptreve-variable').change((event) => { + let ptreve = Misc.toInt(event.currentTarget.value); this.rollData.selectedSort.data.ptreve_reel = ptreve; // Update the selectedCarac console.log("RdDRollDialog - Cout reve", ptreve); updateRollResult(rollData); @@ -139,18 +145,17 @@ export class RdDRollDialog extends Dialog { /* -------------------------------------------- */ static _computeFinalLevel(rollData) { - let etat = rollData.etat === undefined ? 0 : parseInt(rollData.etat); + let etat = Misc.toInt(rollData.etat); + const diffLibre = Misc.toInt(rollData.diffLibre); + const diffConditions = Misc.toInt(rollData.diffConditions); if (rollData.competence) { - return etat + parseInt(rollData.competence.data.niveau) + parseInt(rollData.bmValue); + return etat + Misc.toInt(rollData.competence.data.niveau) + diffLibre + diffConditions; } if (rollData.draconicList) { - let difficulte = rollData.selectedSort.data.difficulte; // Sort de difficulté variable - if (difficulte.toLowerCase() == "variable") { - difficulte = parseInt(rollData.bmValue); // Récupérer la valeur de la listbox dans ce cas - } - return etat + parseInt(rollData.selectedDraconic.data.niveau) + parseInt(difficulte); + let diffSort = (rollData.selectedSort.data.difficulte.toLowerCase() == "variable") ? diffLibre : Misc.toInt(rollData.selectedSort.data.difficulte); + return etat + Misc.toInt(rollData.selectedDraconic.data.niveau) + diffSort + diffConditions; } - return etat + parseInt(rollData.bmValue); + return etat + diffLibre + diffConditions; } /* -------------------------------------------- */ @@ -158,8 +163,8 @@ export class RdDRollDialog extends Dialog { if (rollData.competence) { // If a weapon is there, add it in the title let armeTitle = (rollData.arme) ? " (" + rollData.arme.name + ") " : ""; - let niveauStr = (rollData.competence.data.niveau > 0 ? "+" : "") + rollData.competence.data.niveau; - return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveauStr + let niveau = Misc.toSignedString(rollData.competence.data.niveau); + return rollData.selectedCarac.label + "/" + rollData.competence.name + armeTitle + " " + niveau } if (rollData.draconicList) { return rollData.selectedDraconic.name + " - " + rollData.selectedSort.name; diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index d0f17708..c365dfad 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -50,7 +50,7 @@ export class RdDEncaisser extends Dialog { $("#modificateurDegats").val("0"); }); - html.find('#modificateurDegats').click((event) => { + html.find('#modificateurDegats').change((event) => { this.modifier = event.currentTarget.value; // Update the selected bonus/malus }); } diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index b25eb2ac..64df5d9e 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -314,7 +314,6 @@ export class RdDTMRDialog extends Dialog { else { // Roll Sort html.find('#lancer-sort').click((event) => { - this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord); }); } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 157409bb..a87341bd 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -26,7 +26,8 @@ const competence_xp = { // This table starts at 0 -> niveau -10 const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20, 20, 20, 20, 30, 30, 40, 40, 60, 60, 100, 100, 100, 100, 100, 100, 100, 100, 100]; const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; -const bonusmalus = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10]; +const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]; +const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10]; const fatigueMatrix = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Dummy filler for the array. [2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3 ], [2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3 ], @@ -195,9 +196,13 @@ export class RdDUtility { { return carac_array; } - static getBonusMalus() + static getDifficultesLibres() { - return bonusmalus; + return difficultesLibres; + } + static getAjustementsConditions() + { + return ajustementsConditions; } /* -------------------------------------------- */ diff --git a/templates/dialog-competence.html b/templates/dialog-competence.html index 8382c9c0..5c919c39 100644 --- a/templates/dialog-competence.html +++ b/templates/dialog-competence.html @@ -11,14 +11,23 @@
- - + {{#select diffLibre}} + {{#each difficultesLibres as |key|}} + {{/each}} {{/select}} + + +
{{#if arme}}
diff --git a/templates/dialog-roll-carac.html b/templates/dialog-roll-carac.html index 0c85f1ac..e2f62cf7 100644 --- a/templates/dialog-roll-carac.html +++ b/templates/dialog-roll-carac.html @@ -1,11 +1,19 @@

- - + {{#select diffLibre}} + {{#each difficultesLibres as |key|}} + + {{/each}} + {{/select}} + + + diff --git a/templates/dialog-roll-encaisser.html b/templates/dialog-roll-encaisser.html index 3afefb54..f3aacd8a 100644 --- a/templates/dialog-roll-encaisser.html +++ b/templates/dialog-roll-encaisser.html @@ -4,8 +4,8 @@ diff --git a/templates/dialog-roll-sort.html b/templates/dialog-roll-sort.html index 84e202b9..856d71f3 100644 --- a/templates/dialog-roll-sort.html +++ b/templates/dialog-roll-sort.html @@ -13,6 +13,14 @@ {{/each}} {{/select}} + +
@@ -20,7 +28,8 @@ @@ -28,12 +37,12 @@
- + {{#select diffLibre}} + {{#each difficultesLibres as |key|}} + {{/each}} - {{/select}} + {{/select}}
diff --git a/templates/dialog-tmr.html b/templates/dialog-tmr.html index 4f053aa3..365c5762 100644 --- a/templates/dialog-tmr.html +++ b/templates/dialog-tmr.html @@ -4,6 +4,13 @@
+ +
+
+ +
Rêve Actuel : 0
@@ -20,41 +27,6 @@ Fatigue {{{fatigueHTML}}} -
- -
-
- -
- -
- Draconic : - - -
- -
- Sorts : - - -
- - -