Skip to content
Snippets Groups Projects
Commit 1d066b56 authored by svornost's avatar svornost
Browse files

Improve hero slave filtering

parent 8253c0d4
No related branches found
No related tags found
1 merge request!8987Fixes
......@@ -22,15 +22,11 @@ App.Utils.buildHeroArray = function() {
let array = [].concat(...chunks);
delete V.heroSlaves;
for (let hero = 0; hero < array.length; hero++) {
if (V.seePreg !== 1 && [900089, 900102].includes(array[hero].ID)) {
array.splice(hero, 1);
hero--;
} else if (V.heroSlavesPurchased.includes(array[hero].ID)) {
array.splice(hero, 1);
hero--;
}
}
/** @type {function(App.Entity.SlaveState):boolean} */
const disallowedPregnantSlave = (s) => (V.seePreg !== 1 && s.preg > 0);
/** @type {function(App.Entity.SlaveState):boolean} */
const underAgedSlave = (s) => (s.actualAge < V.minimumSlaveAge);
array.deleteWith((s) => V.heroSlavesPurchased.includes(s.ID) || disallowedPregnantSlave(s) || underAgedSlave(s));
const collator = new Intl.Collator('en', {usage: "sort", ignorePunctuation: true});
return array.sort((a, b) => collator.compare(a.slaveName, b.slaveName));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment