diff --git a/module/actor.js b/module/actor.js index c99fd5e6..c6e68da7 100644 --- a/module/actor.js +++ b/module/actor.js @@ -91,20 +91,17 @@ export class RdDActor extends Actor { getCurrentReve() { return this.data.data.reve.reve.value; } - + /* -------------------------------------------- */ getBestDraconic() { - - let draconic = {name: "none", niveau: -11 }; - for (const item of this.data.items) { - //console.log(item); - if ( item.data.categorie && item.data.categorie.toLowerCase() == "draconic") { - if (item.data.niveau > draconic.niveau) draconic = duplicate(item); - } + const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau); + if (list.length==0) + { + return { name: "none", niveau: -11 }; } - return draconic; + return duplicate(list[0]); } - + /* -------------------------------------------- */ async deleteSortReserve(coordTMR) { let reserve = duplicate(this.data.data.reve.reserve);