From f36e8c217967284ab29413a869f9cdb2ac6d82a8 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 30 Dec 2020 11:50:18 +0100 Subject: [PATCH] Bug fixe sort --- module/actor.js | 6 +++--- module/rdd-tmr-dialog.js | 5 +++-- module/tmr-utility.js | 13 +++++++++++++ system.json | 2 +- template.json | 12 +++++++++++- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/module/actor.js b/module/actor.js index 8fd1b68f..858733cb 100644 --- a/module/actor.js +++ b/module/actor.js @@ -739,7 +739,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async ajouterSouffle(options = {chat : false}) { - let souffle = RdDRollTables.getSouffle(); + let souffle = await RdDRollTables.getSouffle(); await this.createOwnedItem(souffle); if (options.chat){ ChatMessage.create({ @@ -1305,7 +1305,7 @@ export class RdDActor extends Actor { + " pour " + sort.data.ptreve_reel + " points de Rêve" + "
Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")"; - let depenseReve = sort.data.ptreve_reel; + let depenseReve = Number(sort.data.ptreve_reel); let myReve = duplicate(this.data.data.reve.reve); if (rolled.isSuccess) { // Réussite du sort ! //sort.ptreve_reel = coutReve; @@ -1335,7 +1335,7 @@ export class RdDActor extends Actor { } } else { if (rolled.isETotal) { // Echec total ! - depenseReve = Math.max(myReve.value, Math.floor(depenseReve * 1.5)) + depenseReve = Math.min(myReve.value, Math.floor(depenseReve * 1.5)); explications += "
Echec TOTAL du sort : " + depenseReve + " Points de Rêve"; // TODO: mise en réserve d'un échec total... } else { diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 1f9071f8..b81f53e3 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -348,7 +348,7 @@ export class RdDTMRDialog extends Dialog { } if (rolled.isPart) { explication += "
Vous avez fait une Réussite Particulière"; - this.actor._appliquerAjoutExperience({ rolled: rolled, seletedCarac: {label: 'reve'}, competence: draconic.name }) + this.actor._appliquerAjoutExperience({ rolled: rolled, seletedCarac: { label: 'reve'}, competence: draconic.name }) msg2MJ += "
Et a fait une réussite particulière"; } @@ -372,7 +372,8 @@ export class RdDTMRDialog extends Dialog { if (this.viewOnly) { return; } - let sortReserve = this.sortReserves.find(it => it.coord == coordTMR) + + let sortReserve = TMRUtility.getSortReserve( this.sortReserves, coordTMR ); if (sortReserve != undefined) { await this.actor.deleteSortReserve(sortReserve.coord); this.updateSortReserve(); diff --git a/module/tmr-utility.js b/module/tmr-utility.js index 0246260c..429ab896 100644 --- a/module/tmr-utility.js +++ b/module/tmr-utility.js @@ -558,6 +558,19 @@ export class TMRUtility { } } + /* -------------------------------------------- */ + static getSortReserve( reserveList, coordTMR ) { + // TODO : Gérer les têtes spéciales réserve! + let sortReserve + let tmrDescr = this.getTMRDescription(coordTMR); + if ( tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve + sortReserve = reserveList.find(it => { TMRUtility.getTMRDescription(it.coord).type == 'fleuve' } ); + } else { // Reserve sur un case "normale" + sortReserve = reserveList.find(it => it.coord == coordTMR); + } + return sortReserve; + } + /* -------------------------------------------- */ /** Returns a list of case inside a given distance * diff --git a/system.json b/system.json index ffd5a596..9dd214f6 100644 --- a/system.json +++ b/system.json @@ -5,7 +5,7 @@ "version": "1.2.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.8", - "templateVersion": 72, + "templateVersion": 73, "author": "LeRatierBretonnien", "esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ], "styles": ["styles/simple.css"], diff --git a/template.json b/template.json index 1b9efb47..c1c66e7b 100644 --- a/template.json +++ b/template.json @@ -541,7 +541,7 @@ } }, "Item": { - "types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache"], + "types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation"], "objet": { "description": "", "quantite": 1, @@ -713,6 +713,16 @@ "valeur_deniers":0, "encombrement":0, "description": "" + }, + "meditation": { + "competence": "", + "theme": "", + "support": "", + "heure": "", + "purification": "", + "veture": "", + "comportement": "", + "tmr": "" } } }