diff --git a/module/actor.js b/module/actor.js index e21d8d0c..e7de17ce 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2293,12 +2293,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ computeDraconicAndSortIndex(sortList) { - let draconicList = this.getDraconicList() - .map(it => { - it = duplicate(it) - it.system.defaut_carac = "reve"; - return it; - }); + let draconicList = this.getDraconicList(); for (let sort of sortList) { let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name); for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) { diff --git a/module/item-competence.js b/module/item-competence.js index 9530f0c9..c2cdcb78 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -84,7 +84,10 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static getVoieDraconic(competences, voie) { - return RdDItemCompetence.findCompetence(competences.filter(it => RdDItemCompetence.isDraconic(it)), voie); + return RdDItemCompetence.findFirstItem(competences, voie, { + preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), + description: 'Draconic', + }); } /* -------------------------------------------- */ @@ -219,9 +222,8 @@ export class RdDItemCompetence extends Item { if (idOrName == undefined) { return undefined; } - options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence', }); - return list.find(it => it.id == idOrName && it.isCompetence()) - ?? Misc.findFirstLike(idOrName, list, options); + options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false}); + return RdDItemCompetence.findFirstItem(list, idOrName, options); } /* -------------------------------------------- */ @@ -229,6 +231,11 @@ export class RdDItemCompetence extends Item { return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' }); } + static findFirstItem(list, idOrName, options) { + return list.find(it => it.id == idOrName && options.preFilter(it)) + ?? Misc.findFirstLike(idOrName, list, options); + } + /* -------------------------------------------- */ static getCompetenceNextXp(niveau) { return RdDItemCompetence.getCompetenceXp(niveau + 1); diff --git a/module/item-monnaie.js b/module/item-monnaie.js index b1a57e66..d79c049d 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -71,9 +71,12 @@ export class Monnaie { let updates = []; let parValeur = Misc.classifyFirst(monnaies, it => it.system.valeur_deniers); for (let valeur of [1000, 100, 10, 1]) { - if (parValeur[valeur]) { - const piecesDeCetteValeur = Math.floor(reste / valeur); - updates.push({ _id: parValeur[valeur].id, 'system.quantite': piecesDeCetteValeur }); + const itemPiece = parValeur[valeur]; + const piecesDeCetteValeur = Math.floor(reste / valeur); + if (itemPiece) { + if (piecesDeCetteValeur != itemPiece.system.quantite) { + updates.push({ _id: parValeur[valeur].id, 'system.quantite': piecesDeCetteValeur }); + } reste -= piecesDeCetteValeur*valeur; } } diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index 109e6fbf..b791a5f2 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -51,6 +51,7 @@ export class RdDEncaisser extends Dialog { this.actor.encaisserDommages({ dmg: { total: Number(this.modifier), + ajustement: Number(this.modifier), encaisserSpecial: this.encaisserSpecial, loc: { result: 0, label: "" }, mortalite: mortalite diff --git a/module/rdd-rolltables.js b/module/rdd-rolltables.js index 3f90a5bd..9ba058c5 100644 --- a/module/rdd-rolltables.js +++ b/module/rdd-rolltables.js @@ -2,14 +2,14 @@ export class RdDRollTables { /* -------------------------------------------- */ static async genericGetTableResult(tableName, toChat) { - let table = RdDRollTables.getWorldTable() ?? (await RdDRollTables.getSystemTable(tableName)); + let table = RdDRollTables.getWorldTable(tableName) ?? (await RdDRollTables.getSystemTable(tableName)); const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"}); //console.log("RdDRollTables", tableName, toChat, ":", draw); return draw.results.length > 0 ? draw.results[0] : undefined; } - static getWorldTable() { + static getWorldTable(tableName) { return game.tables.find(table => table.name.toLowerCase() == tableName.toLowerCase()); } diff --git a/system.json b/system.json index f9aed920..4689c221 100644 --- a/system.json +++ b/system.json @@ -1,6 +1,13 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", + "version": "10.0.28", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.28.zip", + "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", + "compatibility": { + "minimum": "10", + "verified": "10.288" + }, "description": "Rêve de Dragon RPG for FoundryVTT", "authors": [ { @@ -34,11 +41,6 @@ ], "url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/", "license": "LICENSE.txt", - "version": "10.0.27", - "compatibility": { - "minimum": "10", - "verified": "10.287" - }, "esmodules": [ "module/rdd-main.js" ], @@ -332,8 +334,6 @@ } ], "socket": true, - "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.27.zip", "gridDistance": 1, "gridUnits": "m", "primaryTokenAttribute": "sante.vie", diff --git a/templates/actor/dragon-queues.html b/templates/actor/dragon-queues.html index 3e246c66..c04ef0ff 100644 --- a/templates/actor/dragon-queues.html +++ b/templates/actor/dragon-queues.html @@ -4,7 +4,7 @@ {{#if (and queues.length ombres.length)}} et {{/if}} {{#if ombres.length}}Ombres de Thanatos{{/if}} -