Bugfixes #565

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-10-14 22:52:09 +02:00
2 changed files with 12 additions and 10 deletions
Showing only changes of commit fa75828bc1 - Show all commits

View File

@ -2293,12 +2293,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
computeDraconicAndSortIndex(sortList) { computeDraconicAndSortIndex(sortList) {
let draconicList = this.getDraconicList() let draconicList = this.getDraconicList();
.map(it => {
it = duplicate(it)
it.system.defaut_carac = "reve";
return it;
});
for (let sort of sortList) { for (let sort of sortList) {
let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name); let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name);
for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) { for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) {

View File

@ -84,7 +84,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getVoieDraconic(competences, voie) { 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) { if (idOrName == undefined) {
return undefined; return undefined;
} }
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence', }); options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false});
return list.find(it => it.id == idOrName && it.isCompetence()) return RdDItemCompetence.findFirstItem(list, idOrName, options);
?? Misc.findFirstLike(idOrName, list, options);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -229,6 +231,11 @@ export class RdDItemCompetence extends Item {
return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' }); 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) { static getCompetenceNextXp(niveau) {
return RdDItemCompetence.getCompetenceXp(niveau + 1); return RdDItemCompetence.getCompetenceXp(niveau + 1);