12.0.44 - Les errements d'Astrobazzarh, suite #753

Merged
uberwald merged 3 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2025-03-05 08:24:13 +01:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 6aba92900c - Show all commits

View File

@ -56,6 +56,10 @@ export class RdDItemSort extends Item {
return voies.map(voie => RdDItemCompetence.getVoieDraconic(competencesDraconic, voie))
}
static getBestDraconicSort(competencesDraconic, sort) {
return RdDItemSort.getDraconicsSort(competencesDraconic, sort).sort(Misc.descending(it => it.system.niveau)).find(it=>true)
}
static getOrdreCode(code) {
return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?')
}
@ -92,7 +96,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static isCoutVariable(sort) {
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
return sort && !Number.isInteger(sort.system.ptreve) && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
}
/* -------------------------------------------- */

View File

@ -279,7 +279,7 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) {
this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.competence = RdDItemSort.getBestDraconicSort(this.rollData.draconicList, sort)
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort);