Exclude species without HA from HA filters in starter select

This commit is contained in:
AJ Fontaine 2024-08-29 21:22:44 -04:00
parent f7169868f3
commit f23019f832

View File

@ -45,6 +45,7 @@ import { DropDownColumn, FilterBar } from "./filter-bar";
import { ScrollBar } from "./scroll-bar"; import { ScrollBar } from "./scroll-bar";
import { SelectChallengePhase } from "#app/phases/select-challenge-phase.js"; import { SelectChallengePhase } from "#app/phases/select-challenge-phase.js";
import { TitlePhase } from "#app/phases/title-phase.js"; import { TitlePhase } from "#app/phases/title-phase.js";
import { Abilities } from "#app/enums/abilities.js";
export type StarterSelectCallback = (starters: Starter[]) => void; export type StarterSelectCallback = (starters: Starter[]) => void;
@ -2450,12 +2451,13 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}); });
// HA Filter // HA Filter
const speciesHasHiddenAbility = container.species.abilityHidden !== container.species.ability1 && container.species.abilityHidden !== Abilities.NONE;
const hasHA = starterData.abilityAttr & AbilityAttr.ABILITY_HIDDEN; const hasHA = starterData.abilityAttr & AbilityAttr.ABILITY_HIDDEN;
const fitsHA = this.filterBar.getVals(DropDownColumn.MISC).some(misc => { const fitsHA = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.ON) { if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.ON) {
return hasHA; return hasHA;
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.EXCLUDE) { } else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.EXCLUDE) {
return !hasHA; return speciesHasHiddenAbility && !hasHA;
} else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.OFF) { } else if (misc.val === "HIDDEN_ABILITY" && misc.state === DropDownState.OFF) {
return true; return true;
} }