fix broken sorting for talente
This commit is contained in:
parent
e338b79d3a
commit
39c3f90240
@ -151,6 +151,10 @@ Hooks.once("init", async function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function string_compare(a, b) {
|
||||||
|
return a > b ? 1 : a < b ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
function get_targeted_actors() {
|
function get_targeted_actors() {
|
||||||
const targets = [];
|
const targets = [];
|
||||||
|
|
||||||
@ -792,7 +796,7 @@ class DSA41_CharacterData extends TypeDataModel {
|
|||||||
this.computed.parade.wert = this.computed.parade.basiswert + this.modifikator_parade + this.computed.wunden_modifiers.parade;
|
this.computed.parade.wert = this.computed.parade.basiswert + this.modifikator_parade + this.computed.wunden_modifiers.parade;
|
||||||
this.computed.fernkampf.wert = this.computed.fernkampf.basiswert + this.modifikator_fernkampf;
|
this.computed.fernkampf.wert = this.computed.fernkampf.basiswert + this.modifikator_fernkampf;
|
||||||
|
|
||||||
this.kampftalente = this.parent.items.filter((x) => x.type === "Kampftalent").sort((a, b) => a.name > b.name);
|
this.kampftalente = this.parent.items.filter((x) => x.type === "Kampftalent").sort((a, b) => string_compare(a.name, b.name));
|
||||||
for(const talent of this.kampftalente) {
|
for(const talent of this.kampftalente) {
|
||||||
this.computed.kampf.talente[talent.name] = {};
|
this.computed.kampf.talente[talent.name] = {};
|
||||||
this.computed.kampf.talente[talent.name].attacke = (talent.system.kategorie === "fernkampf" ? this.computed.fernkampf.wert : this.computed.attacke.wert) + talent.system.attacke;
|
this.computed.kampf.talente[talent.name].attacke = (talent.system.kategorie === "fernkampf" ? this.computed.fernkampf.wert : this.computed.attacke.wert) + talent.system.attacke;
|
||||||
@ -900,7 +904,7 @@ class DSA41_CharacterData extends TypeDataModel {
|
|||||||
computed.trefferpunkte_display = computed.trefferpunkte.replace(/[\+\-]/, (op) => "<br>" + op);
|
computed.trefferpunkte_display = computed.trefferpunkte.replace(/[\+\-]/, (op) => "<br>" + op);
|
||||||
}
|
}
|
||||||
|
|
||||||
const talente = this.parent.items.filter((x) => x.type === "Talent").sort((a, b) => a.name > b.name);
|
const talente = this.parent.items.filter((x) => x.type === "Talent").sort((a, b) => string_compare(a.name, b.name));
|
||||||
this.talente = {
|
this.talente = {
|
||||||
koerperliche: talente.filter((x) => x.system.kategorie === "koerperliche"),
|
koerperliche: talente.filter((x) => x.system.kategorie === "koerperliche"),
|
||||||
gesellschaftliche: talente.filter((x) => x.system.kategorie === "gesellschaftliche"),
|
gesellschaftliche: talente.filter((x) => x.system.kategorie === "gesellschaftliche"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user