Fix: régression lancer de sorts
A cause du duplicate, les voies n'étaient plus des RdDItem, du coup, la méthode isCompetence de la recherche de compétences ne marche pas... Et le duplicate était inutile de toutes façons.
This commit is contained in:
parent
232f414a62
commit
fa75828bc1
@ -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++) {
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user