Fixed fiery fallout encounter and relative test by making sure that isCategoryId works properly

This commit is contained in:
Wlowscha 2025-07-12 00:35:42 +02:00
parent 849550808a
commit dbfbc24c8a
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
4 changed files with 7 additions and 7 deletions

View File

@ -299,7 +299,7 @@ export const FieryFalloutEncounter: MysteryEncounter = MysteryEncounterBuilder.w
function giveLeadPokemonAttackTypeBoostItem() {
// Give first party pokemon attack type boost item for free at end of battle
const leadPokemon = globalScene.getPlayerParty()?.[0];
const leadPokemon = globalScene.getPlayerParty()[0];
if (leadPokemon) {
// Generate type booster held item, default to Charcoal if item fails to generate
let item = getNewHeldItemFromCategory(HeldItemCategoryId.TYPE_ATTACK_BOOSTER, leadPokemon);

View File

@ -129,7 +129,7 @@ export function getHeldItemCategory(itemId: HeldItemId): HeldItemCategoryId {
}
export function isCategoryId(id: number): boolean {
return (id & ITEM_CATEGORY_MASK) === id && id in HeldItemCategoryId;
return (Object.values(HeldItemCategoryId) as number[]).includes(id);
}
export function isItemInCategory(itemId: HeldItemId, category: HeldItemCategoryId): boolean {

View File

@ -1,9 +1,9 @@
import { allHeldItems } from "#app/data/data-lists";
import {
type HeldItemCategoryId,
isCategoryId,
isItemInCategory,
isItemInRequested,
type HeldItemCategoryId,
type HeldItemId,
} from "#app/enums/held-item-id";
import type { FormChangeItem } from "#enums/form-change-item";

View File

@ -180,8 +180,8 @@ describe("Fiery Fallout - Mystery Encounter", () => {
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
const hasAttackBooster = scene
.getPlayerParty()?.[0]
.heldItemManager.hasItemCategory(HeldItemCategoryId.TYPE_ATTACK_BOOSTER);
.getPlayerParty()[0]
.heldItemManager.hasItem(HeldItemCategoryId.TYPE_ATTACK_BOOSTER);
expect(hasAttackBooster).toBe(true);
});
});
@ -266,8 +266,8 @@ describe("Fiery Fallout - Mystery Encounter", () => {
expect(scene.phaseManager.getCurrentPhase()?.constructor.name).toBe(SelectModifierPhase.name);
const hasAttackBooster = scene
.getPlayerParty()?.[0]
.heldItemManager.hasItemCategory(HeldItemCategoryId.TYPE_ATTACK_BOOSTER);
.getPlayerParty()[0]
.heldItemManager.hasItem(HeldItemCategoryId.TYPE_ATTACK_BOOSTER);
expect(hasAttackBooster).toBe(true);
});