|
@@ -500,12 +500,25 @@ const model = {
|
|
|
},
|
|
|
|
|
|
renderColorSearchResults() {
|
|
|
- renderPokemon(
|
|
|
- this.ranked
|
|
|
- .filter(({ traits }) => traits.every(t => !filterElements[t]?.checked))
|
|
|
- .slice(0, parseInt(colorDisplayElements.resultsToDisplay.value)),
|
|
|
- colorSearchResultsTarget
|
|
|
- );
|
|
|
+ const count = parseInt(colorDisplayElements.resultsToDisplay.value);
|
|
|
+ const dexNums = new Set();
|
|
|
+ const toRender = [];
|
|
|
+ for (const pkmn of this.ranked) {
|
|
|
+ if (toRender.length >= count) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (!filterElements.allowNoStartForms.checked && pkmn.traits.includes("nostart")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!filterElements.allowRepeatDexNum.checked) {
|
|
|
+ if (dexNums.has(pkmn.num)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ dexNums.add(pkmn.num);
|
|
|
+ }
|
|
|
+ toRender.push(pkmn);
|
|
|
+ }
|
|
|
+ renderPokemon(toRender, colorSearchResultsTarget);
|
|
|
},
|
|
|
};
|
|
|
|