Run biome

This commit is contained in:
Wlowscha 2025-09-10 19:38:19 +02:00
parent 6818d22a67
commit 75914269d7
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
59 changed files with 514 additions and 527 deletions

View File

@ -115,10 +115,10 @@ import { AbilityBar } from "#ui/containers/ability-bar";
import { ArenaFlyout } from "#ui/containers/arena-flyout";
import { CandyBar } from "#ui/containers/candy-bar";
import { CharSprite } from "#ui/containers/char-sprite";
import { ItemBar } from "#ui/item-bar-ui";
import { PartyExpBar } from "#ui/containers/party-exp-bar";
import { PokeballTray } from "#ui/containers/pokeball-tray";
import { PokemonInfoContainer } from "#ui/containers/pokemon-info-container";
import { ItemBar } from "#ui/item-bar-ui";
import { addTextObject, getTextColor } from "#ui/text";
import { UI } from "#ui/ui";
import { addUiThemeOverrides } from "#ui/ui-theme";
@ -2907,7 +2907,7 @@ export class BattleScene extends SceneBase {
for (const t in tokens) {
(allTrainerItems[t] as EnemyAttackStatusEffectChanceTrainerItem).apply(this.enemyTrainerItems, {
pokemon: pokemon,
pokemon,
});
}
}

View File

@ -4640,8 +4640,8 @@ export class PostTurnRestoreBerryAbAttr extends PostTurnAbAttr {
.getHeldItems()
.filter(
bm =>
isItemInCategory(bm, HeldItemCategoryId.BERRY) &&
pokemon.heldItemManager.getStack(bm) < allHeldItems[bm].maxStackCount,
isItemInCategory(bm, HeldItemCategoryId.BERRY)
&& pokemon.heldItemManager.getStack(bm) < allHeldItems[bm].maxStackCount,
)
.map(bm => (allHeldItems[bm] as BerryHeldItem).berryType),
);
@ -6261,16 +6261,14 @@ class ForceSwitchOutHelper {
}
}
if (!allyPokemon?.isActive(true)) {
if (switchOutTarget.hp) {
globalScene.phaseManager.pushNew("BattleEndPhase", false);
if (!allyPokemon?.isActive(true) && switchOutTarget.hp) {
globalScene.phaseManager.pushNew("BattleEndPhase", false);
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
globalScene.phaseManager.pushNew("SelectBiomePhase");
}
globalScene.phaseManager.pushNew("NewBattlePhase");
if (globalScene.gameMode.hasRandomBiomes || globalScene.isNewBiome()) {
globalScene.phaseManager.pushNew("SelectBiomePhase");
}
globalScene.phaseManager.pushNew("NewBattlePhase");
}
}
return false;

View File

@ -40,11 +40,11 @@ const namespace = "mysteryEncounters/absoluteAvarice";
function berrySprite(spriteKey: string, x: number, y: number): MysteryEncounterSpriteConfig {
return {
spriteKey: spriteKey,
spriteKey,
fileRoot: "items",
isItem: true,
x: x,
y: y,
x,
y,
hidden: true,
disableAnimation: true,
};

View File

@ -158,7 +158,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
// Store removed pokemon types
encounter.misc = {
removedTypes: removedPokemon.getTypes(),
itemConfig: itemConfig,
itemConfig,
};
})
.withOptionPhase(async () => {

View File

@ -288,8 +288,8 @@ export const GlobalTradeSystemEncounter: MysteryEncounter = MysteryEncounterBuil
if (tradePokemon.species.abilityHidden && tradePokemon.abilityIndex < hiddenIndex) {
const hiddenAbilityChance = new NumberHolder(64);
globalScene.applyPlayerItems(TrainerItemEffect.HIDDEN_ABILITY_CHANCE_BOOSTER, {
numberHolder: hiddenAbilityChance,
});
numberHolder: hiddenAbilityChance,
});
const hasHiddenAbility = !randSeedInt(hiddenAbilityChance.value);

View File

@ -100,7 +100,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
encounter.setDialogueToken("boost2", allHeldItems[items[1]].name);
encounter.misc = {
chosenPokemon: pokemon,
items: items,
items,
};
};
@ -180,7 +180,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
encounter.setDialogueToken("boost2", allHeldItems[items[1]].name);
encounter.misc = {
chosenPokemon: pokemon,
items: items,
items,
};
};

View File

@ -907,8 +907,8 @@ export class HeldItemRequirement extends EncounterSceneRequirement {
override getDialogueToken(pokemon?: PlayerPokemon): [string, string] {
const requiredItems = pokemon?.getHeldItems().filter(item => {
return (
this.requiredHeldItems.some(heldItem => item === heldItem) &&
(!this.requireTransferable || allHeldItems[item].isTransferable)
this.requiredHeldItems.some(heldItem => item === heldItem)
&& (!this.requireTransferable || allHeldItems[item].isTransferable)
);
});
if (requiredItems && requiredItems.length > 0) {

View File

@ -6,124 +6,123 @@ import type { ObjectValues } from "#types/type-helpers";
*/
export const FormChangeItemId = {
// Mega Stones
ABOMASITE: 0x0B01,
ABSOLITE: 0x0B02,
AERODACTYLITE: 0x0B03,
AGGRONITE: 0x0B04,
ALAKAZITE: 0x0B05,
ALTARIANITE: 0x0B06,
AMPHAROSITE: 0x0B07,
AUDINITE: 0x0B08,
BANETTITE: 0x0B09,
BEEDRILLITE: 0x0B0A,
BLASTOISINITE: 0x0B0B,
BLAZIKENITE: 0x0B0C,
CAMERUPTITE: 0x0B0D,
CHARIZARDITE_X: 0x0B0E,
CHARIZARDITE_Y: 0x0B0F,
DIANCITE: 0x0B10,
GALLADITE: 0x0B11,
GARCHOMPITE: 0x0B12,
GARDEVOIRITE: 0x0B13,
GENGARITE: 0x0B14,
GLALITITE: 0x0B15,
GYARADOSITE: 0x0B16,
HERACRONITE: 0x0B17,
HOUNDOOMINITE: 0x0B18,
KANGASKHANITE: 0x0B19,
LATIASITE: 0x0B1A,
LATIOSITE: 0x0B1B,
LOPUNNITE: 0x0B1C,
LUCARIONITE: 0x0B1D,
MANECTITE: 0x0B1E,
MAWILITE: 0x0B1F,
MEDICHAMITE: 0x0B20,
METAGROSSITE: 0x0B21,
MEWTWONITE_X: 0x0B22,
MEWTWONITE_Y: 0x0B23,
PIDGEOTITE: 0x0B24,
PINSIRITE: 0x0B25,
RAYQUAZITE: 0x0B26,
SABLENITE: 0x0B27,
SALAMENCITE: 0x0B28,
SCEPTILITE: 0x0B29,
SCIZORITE: 0x0B2A,
SHARPEDONITE: 0x0B2B,
SLOWBRONITE: 0x0B2C,
STEELIXITE: 0x0B2D,
SWAMPERTITE: 0x0B2E,
TYRANITARITE: 0x0B2F,
VENUSAURITE: 0x0B30,
ABOMASITE: 0x0b01,
ABSOLITE: 0x0b02,
AERODACTYLITE: 0x0b03,
AGGRONITE: 0x0b04,
ALAKAZITE: 0x0b05,
ALTARIANITE: 0x0b06,
AMPHAROSITE: 0x0b07,
AUDINITE: 0x0b08,
BANETTITE: 0x0b09,
BEEDRILLITE: 0x0b0a,
BLASTOISINITE: 0x0b0b,
BLAZIKENITE: 0x0b0c,
CAMERUPTITE: 0x0b0d,
CHARIZARDITE_X: 0x0b0e,
CHARIZARDITE_Y: 0x0b0f,
DIANCITE: 0x0b10,
GALLADITE: 0x0b11,
GARCHOMPITE: 0x0b12,
GARDEVOIRITE: 0x0b13,
GENGARITE: 0x0b14,
GLALITITE: 0x0b15,
GYARADOSITE: 0x0b16,
HERACRONITE: 0x0b17,
HOUNDOOMINITE: 0x0b18,
KANGASKHANITE: 0x0b19,
LATIASITE: 0x0b1a,
LATIOSITE: 0x0b1b,
LOPUNNITE: 0x0b1c,
LUCARIONITE: 0x0b1d,
MANECTITE: 0x0b1e,
MAWILITE: 0x0b1f,
MEDICHAMITE: 0x0b20,
METAGROSSITE: 0x0b21,
MEWTWONITE_X: 0x0b22,
MEWTWONITE_Y: 0x0b23,
PIDGEOTITE: 0x0b24,
PINSIRITE: 0x0b25,
RAYQUAZITE: 0x0b26,
SABLENITE: 0x0b27,
SALAMENCITE: 0x0b28,
SCEPTILITE: 0x0b29,
SCIZORITE: 0x0b2a,
SHARPEDONITE: 0x0b2b,
SLOWBRONITE: 0x0b2c,
STEELIXITE: 0x0b2d,
SWAMPERTITE: 0x0b2e,
TYRANITARITE: 0x0b2f,
VENUSAURITE: 0x0b30,
// Other rare form change items
BLUE_ORB: 0x0B51,
RED_ORB: 0x0B52,
ADAMANT_CRYSTAL: 0x0B53,
LUSTROUS_GLOBE: 0x0B54,
GRISEOUS_CORE: 0x0B55,
REVEAL_GLASS: 0x0B56,
MAX_MUSHROOMS: 0x0B57,
DARK_STONE: 0x0B58,
LIGHT_STONE: 0x0B59,
PRISON_BOTTLE: 0x0B5A,
RUSTED_SWORD: 0x0B5B,
RUSTED_SHIELD: 0x0B5C,
ICY_REINS_OF_UNITY: 0x0B5D,
SHADOW_REINS_OF_UNITY: 0x0B5E,
ULTRANECROZIUM_Z: 0x0B5F,
BLUE_ORB: 0x0b51,
RED_ORB: 0x0b52,
ADAMANT_CRYSTAL: 0x0b53,
LUSTROUS_GLOBE: 0x0b54,
GRISEOUS_CORE: 0x0b55,
REVEAL_GLASS: 0x0b56,
MAX_MUSHROOMS: 0x0b57,
DARK_STONE: 0x0b58,
LIGHT_STONE: 0x0b59,
PRISON_BOTTLE: 0x0b5a,
RUSTED_SWORD: 0x0b5b,
RUSTED_SHIELD: 0x0b5c,
ICY_REINS_OF_UNITY: 0x0b5d,
SHADOW_REINS_OF_UNITY: 0x0b5e,
ULTRANECROZIUM_Z: 0x0b5f,
// less rare form change items
SHARP_METEORITE: 0x0C01,
HARD_METEORITE: 0x0C02,
SMOOTH_METEORITE: 0x0C03,
GRACIDEA: 0x0C04,
SHOCK_DRIVE: 0x0C05,
BURN_DRIVE: 0x0C06,
CHILL_DRIVE: 0x0C07,
DOUSE_DRIVE: 0x0C08,
N_SOLARIZER: 0x0C09,
N_LUNARIZER: 0x0C0A,
WELLSPRING_MASK: 0x0C0B,
HEARTHFLAME_MASK: 0x0C0C,
CORNERSTONE_MASK: 0x0C0D,
FIST_PLATE: 0x0C0E,
SKY_PLATE: 0x0C0F,
TOXIC_PLATE: 0x0C10,
EARTH_PLATE: 0x0C11,
STONE_PLATE: 0x0C12,
INSECT_PLATE: 0x0C13,
SPOOKY_PLATE: 0x0C14,
IRON_PLATE: 0x0C15,
FLAME_PLATE: 0x0C16,
SPLASH_PLATE: 0x0C17,
MEADOW_PLATE: 0x0C18,
ZAP_PLATE: 0x0C19,
MIND_PLATE: 0x0C1A,
ICICLE_PLATE: 0x0C1B,
DRACO_PLATE: 0x0C1C,
DREAD_PLATE: 0x0C1D,
PIXIE_PLATE: 0x0C1E,
BLANK_PLATE: 0x0C1F, // TODO: Find a potential use for this
LEGEND_PLATE: 0x0C20, // TODO: Find a potential use for this
FIGHTING_MEMORY: 0x0C21,
FLYING_MEMORY: 0x0C22,
POISON_MEMORY: 0x0C23,
GROUND_MEMORY: 0x0C24,
ROCK_MEMORY: 0x0C25,
BUG_MEMORY: 0x0C26,
GHOST_MEMORY: 0x0C27,
STEEL_MEMORY: 0x0C28,
FIRE_MEMORY: 0x0C29,
WATER_MEMORY: 0x0C2A,
GRASS_MEMORY: 0x0C2B,
ELECTRIC_MEMORY: 0x0C2C,
PSYCHIC_MEMORY: 0x0C2D,
ICE_MEMORY: 0x0C2E,
DRAGON_MEMORY: 0x0C2F,
DARK_MEMORY: 0x0C30,
FAIRY_MEMORY: 0x0C31,
NORMAL_MEMORY: 0x0C32,
SHARP_METEORITE: 0x0c01,
HARD_METEORITE: 0x0c02,
SMOOTH_METEORITE: 0x0c03,
GRACIDEA: 0x0c04,
SHOCK_DRIVE: 0x0c05,
BURN_DRIVE: 0x0c06,
CHILL_DRIVE: 0x0c07,
DOUSE_DRIVE: 0x0c08,
N_SOLARIZER: 0x0c09,
N_LUNARIZER: 0x0c0a,
WELLSPRING_MASK: 0x0c0b,
HEARTHFLAME_MASK: 0x0c0c,
CORNERSTONE_MASK: 0x0c0d,
FIST_PLATE: 0x0c0e,
SKY_PLATE: 0x0c0f,
TOXIC_PLATE: 0x0c10,
EARTH_PLATE: 0x0c11,
STONE_PLATE: 0x0c12,
INSECT_PLATE: 0x0c13,
SPOOKY_PLATE: 0x0c14,
IRON_PLATE: 0x0c15,
FLAME_PLATE: 0x0c16,
SPLASH_PLATE: 0x0c17,
MEADOW_PLATE: 0x0c18,
ZAP_PLATE: 0x0c19,
MIND_PLATE: 0x0c1a,
ICICLE_PLATE: 0x0c1b,
DRACO_PLATE: 0x0c1c,
DREAD_PLATE: 0x0c1d,
PIXIE_PLATE: 0x0c1e,
BLANK_PLATE: 0x0c1f, // TODO: Find a potential use for this
LEGEND_PLATE: 0x0c20, // TODO: Find a potential use for this
FIGHTING_MEMORY: 0x0c21,
FLYING_MEMORY: 0x0c22,
POISON_MEMORY: 0x0c23,
GROUND_MEMORY: 0x0c24,
ROCK_MEMORY: 0x0c25,
BUG_MEMORY: 0x0c26,
GHOST_MEMORY: 0x0c27,
STEEL_MEMORY: 0x0c28,
FIRE_MEMORY: 0x0c29,
WATER_MEMORY: 0x0c2a,
GRASS_MEMORY: 0x0c2b,
ELECTRIC_MEMORY: 0x0c2c,
PSYCHIC_MEMORY: 0x0c2d,
ICE_MEMORY: 0x0c2e,
DRAGON_MEMORY: 0x0c2f,
DARK_MEMORY: 0x0c30,
FAIRY_MEMORY: 0x0c31,
NORMAL_MEMORY: 0x0c32,
} as const;
export type FormChangeItemId = ObjectValues<typeof FormChangeItemId>
export type FormChangeItemId = ObjectValues<typeof FormChangeItemId>;

View File

@ -15,8 +15,8 @@ export const HeldItemId = {
APICOT_BERRY: 0x0107,
SALAC_BERRY: 0x0108,
LANSAT_BERRY: 0x0109,
STARF_BERRY: 0x010A,
LEPPA_BERRY: 0x010B,
STARF_BERRY: 0x010a,
LEPPA_BERRY: 0x010b,
// Other items that are consumed
REVIVER_SEED: 0x0201,
@ -32,12 +32,12 @@ export const HeldItemId = {
SILVER_POWDER: 0x0307,
SPELL_TAG: 0x0308,
METAL_COAT: 0x0309,
CHARCOAL: 0x030A,
MYSTIC_WATER: 0x030B,
MIRACLE_SEED: 0x030C,
MAGNET: 0x030D,
TWISTED_SPOON: 0x030E,
NEVER_MELT_ICE: 0x030F,
CHARCOAL: 0x030a,
MYSTIC_WATER: 0x030b,
MIRACLE_SEED: 0x030c,
MAGNET: 0x030d,
TWISTED_SPOON: 0x030e,
NEVER_MELT_ICE: 0x030f,
DRAGON_FANG: 0x0310,
BLACK_GLASSES: 0x0311,
FAIRY_FEATHER: 0x0312,
@ -69,12 +69,12 @@ export const HeldItemId = {
WIDE_LENS: 0x0707,
MULTI_LENS: 0x0708,
GOLDEN_PUNCH: 0x0709,
GRIP_CLAW: 0x070A,
TOXIC_ORB: 0x070B,
FLAME_ORB: 0x070C,
SOUL_DEW: 0x070D,
BATON: 0x070E,
MINI_BLACK_HOLE: 0x070F,
GRIP_CLAW: 0x070a,
TOXIC_ORB: 0x070b,
FLAME_ORB: 0x070c,
SOUL_DEW: 0x070d,
BATON: 0x070e,
MINI_BLACK_HOLE: 0x070f,
EVIOLITE: 0x0710,
// Vitamins
@ -92,30 +92,32 @@ export const HeldItemId = {
MACHO_BRACE: 0x0904,
// Evo trackers
GIMMIGHOUL_EVO_TRACKER: 0x0A01,
GIMMIGHOUL_EVO_TRACKER: 0x0a01,
// All form change items
...FormChangeItemId
...FormChangeItemId,
} as const;
export type HeldItemId = ObjectValues<typeof HeldItemId>;
type HeldItemNameMap = {
[k in HeldItemName as (typeof HeldItemId)[k]]: k
}
[k in HeldItemName as (typeof HeldItemId)[k]]: k;
};
type HeldItemName = keyof typeof HeldItemId;
/** `const object` mapping all held item IDs to their respective names. */
// TODO: This stores names as UPPER_SNAKE_CASE, but the locales are in PascalCase...
export const HeldItemNames = Object.freeze(Object.entries(HeldItemId).reduce(
// Use a type-safe reducer to force number keys and values
(acc, [key, value]) => {
acc[value] = key;
return acc;
},
{}
)) as HeldItemNameMap;
export const HeldItemNames = Object.freeze(
Object.entries(HeldItemId).reduce(
// Use a type-safe reducer to force number keys and values
(acc, [key, value]) => {
acc[value] = key;
return acc;
},
{},
),
) as HeldItemNameMap;
export const HeldItemCategoryId = {
NONE: 0x0000,
@ -128,14 +130,14 @@ export const HeldItemCategoryId = {
UNIQUE: 0x0700,
VITAMIN: 0x0800,
BASE_STAT_BOOST: 0x0900,
EVO_TRACKER: 0x0A00,
RARE_FORM_CHANGE: 0x0B00,
FORM_CHANGE: 0x0C00,
EVO_TRACKER: 0x0a00,
RARE_FORM_CHANGE: 0x0b00,
FORM_CHANGE: 0x0c00,
} as const;
export type HeldItemCategoryId = ObjectValues<typeof HeldItemCategoryId>;
const ITEM_CATEGORY_MASK = 0xFF00
const ITEM_CATEGORY_MASK = 0xff00;
export function getHeldItemCategory(itemId: HeldItemId): HeldItemCategoryId {
return (itemId & ITEM_CATEGORY_MASK) as HeldItemCategoryId;
@ -149,9 +151,6 @@ export function isItemInCategory(itemId: HeldItemId, category: HeldItemCategoryI
return getHeldItemCategory(itemId) === category;
}
export function isItemInRequested(
itemId: HeldItemId,
requestedItems: (HeldItemCategoryId | HeldItemId)[]
): boolean {
export function isItemInRequested(itemId: HeldItemId, requestedItems: (HeldItemCategoryId | HeldItemId)[]): boolean {
return requestedItems.some(entry => itemId === entry || (itemId & ITEM_CATEGORY_MASK) === entry);
}

View File

@ -43,29 +43,29 @@ export const RewardId = {
PP_UP: 0x2901,
PP_MAX: 0x2902,
TM_COMMON: 0x2A01,
TM_GREAT: 0x2A02,
TM_ULTRA: 0x2A03,
TM_COMMON: 0x2a01,
TM_GREAT: 0x2a02,
TM_ULTRA: 0x2a03,
MINT: 0x2B01,
TERA_SHARD: 0x2B02,
MEMORY_MUSHROOM: 0x2B03,
DNA_SPLICERS: 0x2B04,
MINT: 0x2b01,
TERA_SHARD: 0x2b02,
MEMORY_MUSHROOM: 0x2b03,
DNA_SPLICERS: 0x2b04,
SPECIES_STAT_BOOSTER: 0x2C01,
RARE_SPECIES_STAT_BOOSTER: 0x2C02,
VITAMIN: 0x2C03,
ATTACK_TYPE_BOOSTER: 0x2C04,
BERRY: 0x2C05,
SPECIES_STAT_BOOSTER: 0x2c01,
RARE_SPECIES_STAT_BOOSTER: 0x2c02,
VITAMIN: 0x2c03,
ATTACK_TYPE_BOOSTER: 0x2c04,
BERRY: 0x2c05,
TEMP_STAT_STAGE_BOOSTER: 0x2D01,
DIRE_HIT: 0x2D02,
LURE: 0x2D03,
SUPER_LURE: 0x2D04,
MAX_LURE: 0x2D05,
TEMP_STAT_STAGE_BOOSTER: 0x2d01,
DIRE_HIT: 0x2d02,
LURE: 0x2d03,
SUPER_LURE: 0x2d04,
MAX_LURE: 0x2d05,
FORM_CHANGE_ITEM: 0x2E01,
RARE_FORM_CHANGE_ITEM: 0x2E02,
FORM_CHANGE_ITEM: 0x2e01,
RARE_FORM_CHANGE_ITEM: 0x2e02,
} as const;
export type RewardId = ObjectValues<typeof RewardId>;
@ -81,17 +81,17 @@ export const RewardCategoryId = {
REVIVE: 0x0700,
ETHER: 0x0800,
ELIXIR: 0x0900,
PP_UP: 0x0A00,
TM: 0x0B00,
OTHER: 0x0C00,
HELD_ITEM: 0x0D00,
TRAINER_ITEM: 0x0E00,
FORM_CHANGE_ITEM: 0x0F00,
PP_UP: 0x0a00,
TM: 0x0b00,
OTHER: 0x0c00,
HELD_ITEM: 0x0d00,
TRAINER_ITEM: 0x0e00,
FORM_CHANGE_ITEM: 0x0f00,
} as const;
export type RewardCategoryId = ObjectValues<typeof RewardCategoryId>;
const ITEM_CATEGORY_MASK = 0xFF00
const ITEM_CATEGORY_MASK = 0xff00;
export function getRewardCategory(itemId: RewardId): RewardCategoryId {
return (itemId & ITEM_CATEGORY_MASK) as RewardCategoryId;

View File

@ -1,62 +1,62 @@
export const TrainerItemId = {
NONE: 0x0000,
MAP: 0x1001,
IV_SCANNER: 0x1002,
LOCK_CAPSULE: 0x1003,
MEGA_BRACELET: 0x1004,
DYNAMAX_BAND: 0x1005,
TERA_ORB: 0x1006,
MAP: 0x1001,
IV_SCANNER: 0x1002,
LOCK_CAPSULE: 0x1003,
MEGA_BRACELET: 0x1004,
DYNAMAX_BAND: 0x1005,
TERA_ORB: 0x1006,
GOLDEN_POKEBALL: 0x1007,
GOLDEN_POKEBALL: 0x1007,
OVAL_CHARM: 0x1008,
EXP_SHARE: 0x1009,
EXP_BALANCE: 0x100A,
OVAL_CHARM: 0x1008,
EXP_SHARE: 0x1009,
EXP_BALANCE: 0x100a,
CANDY_JAR: 0x100B,
BERRY_POUCH: 0x100C,
CANDY_JAR: 0x100b,
BERRY_POUCH: 0x100c,
HEALING_CHARM: 0x100D,
EXP_CHARM: 0x100E,
SUPER_EXP_CHARM: 0x100F,
GOLDEN_EXP_CHARM: 0x1010,
AMULET_COIN: 0x1011,
HEALING_CHARM: 0x100d,
EXP_CHARM: 0x100e,
SUPER_EXP_CHARM: 0x100f,
GOLDEN_EXP_CHARM: 0x1010,
AMULET_COIN: 0x1011,
ABILITY_CHARM: 0x1012,
SHINY_CHARM: 0x1013,
CATCHING_CHARM: 0x1014,
ABILITY_CHARM: 0x1012,
SHINY_CHARM: 0x1013,
CATCHING_CHARM: 0x1014,
BLACK_SLUDGE: 0x1015,
GOLDEN_BUG_NET: 0x1016,
BLACK_SLUDGE: 0x1015,
GOLDEN_BUG_NET: 0x1016,
LURE: 0x1101,
SUPER_LURE: 0x1102,
MAX_LURE: 0x1103,
LURE: 0x1101,
SUPER_LURE: 0x1102,
MAX_LURE: 0x1103,
X_ATTACK: 0x1201,
X_DEFENSE: 0x1202,
X_SP_ATK: 0x1203,
X_SP_DEF: 0x1204,
X_SPEED: 0x1205,
X_ACCURACY: 0x1206,
DIRE_HIT: 0x1207,
X_ATTACK: 0x1201,
X_DEFENSE: 0x1202,
X_SP_ATK: 0x1203,
X_SP_DEF: 0x1204,
X_SPEED: 0x1205,
X_ACCURACY: 0x1206,
DIRE_HIT: 0x1207,
ENEMY_DAMAGE_BOOSTER: 0x1301,
ENEMY_DAMAGE_REDUCTION: 0x1302,
ENEMY_HEAL: 0x1303,
ENEMY_ATTACK_POISON_CHANCE: 0x1304,
ENEMY_ATTACK_PARALYZE_CHANCE: 0x1305,
ENEMY_ATTACK_BURN_CHANCE: 0x1306,
ENEMY_STATUS_EFFECT_HEAL_CHANCE: 0x1307,
ENEMY_ENDURE_CHANCE: 0x1308,
ENEMY_FUSED_CHANCE: 0x1309,
ENEMY_DAMAGE_BOOSTER: 0x1301,
ENEMY_DAMAGE_REDUCTION: 0x1302,
ENEMY_HEAL: 0x1303,
ENEMY_ATTACK_POISON_CHANCE: 0x1304,
ENEMY_ATTACK_PARALYZE_CHANCE: 0x1305,
ENEMY_ATTACK_BURN_CHANCE: 0x1306,
ENEMY_STATUS_EFFECT_HEAL_CHANCE: 0x1307,
ENEMY_ENDURE_CHANCE: 0x1308,
ENEMY_FUSED_CHANCE: 0x1309,
} as const;
export type TrainerItemId = (typeof TrainerItemId)[keyof typeof TrainerItemId];
type TrainerItemName = keyof typeof TrainerItemId;
type TrainerItemValue = typeof TrainerItemId[TrainerItemName];
type TrainerItemValue = (typeof TrainerItemId)[TrainerItemName];
// Use a type-safe reducer to force number keys and values
export const TrainerItemNames: Record<TrainerItemValue, TrainerItemName> = Object.entries(TrainerItemId).reduce(
@ -64,5 +64,5 @@ export const TrainerItemNames: Record<TrainerItemValue, TrainerItemName> = Objec
acc[value as TrainerItemValue] = key as TrainerItemName;
return acc;
},
{} as Record<TrainerItemValue, TrainerItemName>
{} as Record<TrainerItemValue, TrainerItemName>,
);

View File

@ -1377,7 +1377,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
getCritStage(source: Pokemon, move: Move): number {
const critStage = new NumberHolder(0);
applyMoveAttrs("HighCritAttr", source, this, move, critStage);
applyHeldItems(HeldItemEffect.CRIT_BOOST, { pokemon: source, critStage: critStage });
applyHeldItems(HeldItemEffect.CRIT_BOOST, { pokemon: source, critStage });
globalScene.applyPlayerItems(TrainerItemEffect.TEMP_CRIT_BOOSTER, { numberHolder: critStage });
applyAbAttrs("BonusCritAbAttr", { pokemon: source, critStage });
const critBoostTag = source.getTag(CritBoostTag);
@ -1433,7 +1433,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
): number {
const statVal = new NumberHolder(this.getStat(stat, false));
if (!ignoreHeldItems) {
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: this, stat: stat, statHolder: statVal });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: this, stat, statHolder: statVal });
}
// The Ruin abilities here are never ignored, but they reveal themselves on summon anyway
@ -1543,7 +1543,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
const statHolder = new NumberHolder(Math.floor((2 * baseStats[s] + this.ivs[s]) * this.level * 0.01));
if (s === Stat.HP) {
statHolder.value = statHolder.value + this.level + 10;
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder: statHolder });
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder });
if (this.hasAbility(AbilityId.WONDER_GUARD, false, true)) {
statHolder.value = 1;
}
@ -1565,7 +1565,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
1,
);
}
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder: statHolder });
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder });
}
statHolder.value = Phaser.Math.Clamp(statHolder.value, 1, Number.MAX_SAFE_INTEGER);
@ -1578,7 +1578,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
applyChallenges(ChallengeType.FLIP_STAT, this, baseStats);
// Items that add to the stats
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: this, baseStats: baseStats });
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: this, baseStats });
if (this.isFusion()) {
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
applyChallenges(ChallengeType.FLIP_STAT, this, fusionBaseStats);
@ -1592,7 +1592,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
// Vitamins
applyHeldItems(HeldItemEffect.BASE_STAT_MULTIPLY, { pokemon: this, baseStats: baseStats });
applyHeldItems(HeldItemEffect.BASE_STAT_MULTIPLY, { pokemon: this, baseStats });
return baseStats;
}
@ -4104,7 +4104,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURE_TOKEN);
}
if (!surviveDamage.value) {
applyHeldItems(HeldItemEffect.SURVIVE_CHANCE, { pokemon: this, surviveDamage: surviveDamage });
applyHeldItems(HeldItemEffect.SURVIVE_CHANCE, { pokemon: this, surviveDamage });
}
if (surviveDamage.value) {
damage = this.hp - 1;

View File

@ -32,7 +32,7 @@ export class HeldItemManager {
};
return itemSpecs;
}
return undefined;
return;
}
generateHeldItemConfiguration(restrictedIds?: HeldItemId[]): HeldItemConfiguration {

View File

@ -133,7 +133,7 @@ function determineItemPoolTier(pool: HeldItemTieredPool, upgradeCount?: number):
}
tier += upgradeCount;
while (tier && !pool[tier]?.length) {
while (tier && pool[tier]?.length === 0) {
tier--;
if (upgradeCount) {
upgradeCount--;
@ -168,8 +168,8 @@ export function getNewBerryHeldItem(customWeights: HeldItemWeights = {}, target?
const weights = items.map(t =>
target?.heldItemManager.isMaxStack(t)
? 0
: (customWeights[t] ??
(t === HeldItemId.SITRUS_BERRY || t === HeldItemId.LUM_BERRY || t === HeldItemId.LEPPA_BERRY))
: (customWeights[t]
?? (t === HeldItemId.SITRUS_BERRY || t === HeldItemId.LUM_BERRY || t === HeldItemId.LEPPA_BERRY))
? 2
: 1,
);
@ -192,7 +192,7 @@ export function getNewAttackTypeBoosterHeldItem(
.filter(m => m.getMove().is("AttackMove"))
.map(m => p.getMoveType(m.getMove(), true)),
);
if (!attackMoveTypes.length) {
if (attackMoveTypes.length === 0) {
return null;
}

View File

@ -168,7 +168,7 @@ export abstract class ConsumableHeldItem<T extends EffectTuple> extends HeldItem
globalScene.updateItems(pokemon.isPlayer());
}
if (unburden) {
applyAbAttrs("PostItemLostAbAttr", { pokemon: pokemon });
applyAbAttrs("PostItemLostAbAttr", { pokemon });
}
}
}

View File

@ -73,7 +73,7 @@ export class BerryHeldItem extends ConsumableHeldItem<[typeof HeldItemEffect.BER
// }
const preserve = new BooleanHolder(false);
globalScene.applyPlayerItems(TrainerItemEffect.PRESERVE_BERRY, { pokemon: pokemon, doPreserve: preserve });
globalScene.applyPlayerItems(TrainerItemEffect.PRESERVE_BERRY, { pokemon, doPreserve: preserve });
const consumed = !preserve.value;
// munch the berry and trigger unburden-like effects

View File

@ -68,8 +68,8 @@ export class SpeciesCritBoostHeldItem extends CritBoostHeldItem {
apply(effect: typeof HeldItemEffect.CRIT_BOOST, params: CritBoostParams): boolean {
const pokemon = params.pokemon;
const fitsSpecies =
this.species.includes(pokemon.getSpeciesForm(true).speciesId) ||
(pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId));
this.species.includes(pokemon.getSpeciesForm(true).speciesId)
|| (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId));
if (fitsSpecies) {
return super.apply(effect, params);

View File

@ -45,10 +45,10 @@ export class GimmighoulEvoTrackerHeldItem extends EvoTrackerHeldItem {
getStackCount(pokemon: Pokemon): number {
const stackCount =
pokemon.heldItemManager.getStack(this.type) +
pokemon.heldItemManager.getStack(HeldItemId.GOLDEN_PUNCH) +
globalScene.trainerItems.getStack(TrainerItemId.AMULET_COIN) +
globalScene.trainerItems.getStack(TrainerItemId.GOLDEN_POKEBALL);
pokemon.heldItemManager.getStack(this.type)
+ pokemon.heldItemManager.getStack(HeldItemId.GOLDEN_PUNCH)
+ globalScene.trainerItems.getStack(TrainerItemId.AMULET_COIN)
+ globalScene.trainerItems.getStack(TrainerItemId.GOLDEN_POKEBALL);
return stackCount;
}
}

View File

@ -28,7 +28,7 @@ export abstract class ItemTransferHeldItem<T extends EffectTuple> extends HeldIt
applySteal(params: ItemStealParams): boolean {
const opponents = this.getTargets(params);
if (!opponents.length) {
if (opponents.length === 0) {
return false;
}
@ -46,7 +46,7 @@ export abstract class ItemTransferHeldItem<T extends EffectTuple> extends HeldIt
const heldItems = targetPokemon.heldItemManager.getTransferableHeldItems();
for (let i = 0; i < transferredItemCount; i++) {
if (!heldItems.length) {
if (heldItems.length === 0) {
break;
}
const randItemIndex = pokemon.randBattleSeedInt(heldItems.length);
@ -62,7 +62,7 @@ export abstract class ItemTransferHeldItem<T extends EffectTuple> extends HeldIt
globalScene.phaseManager.queueMessage(this.getTransferMessage(params, mt));
}
return !!transferredRewards.length;
return transferredRewards.length > 0;
}
abstract getTargets(params: ItemStealParams): Pokemon[];

View File

@ -141,8 +141,8 @@ export class SpeciesStatBoostHeldItem extends StatBoostHeldItem {
apply(effect: typeof HeldItemEffect.STAT_BOOST, params: StatBoostParams): boolean {
const pokemon = params.pokemon;
const fitsSpecies =
this.species.includes(pokemon.getSpeciesForm(true).speciesId) ||
(pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId));
this.species.includes(pokemon.getSpeciesForm(true).speciesId)
|| (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId));
if (fitsSpecies) {
return super.apply(effect, params);

View File

@ -54,12 +54,12 @@ function initCommonRewardPool() {
const thresholdPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY) &&
p
p.hp
&& !p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY)
&& p
.getMoveset()
.filter(m => m.ppUsed && m.getMovePp() - m.ppUsed <= 5 && m.ppUsed > Math.floor(m.getMovePp() / 2))
.length,
.length > 0,
).length,
3,
);
@ -73,12 +73,12 @@ function initCommonRewardPool() {
const thresholdPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY) &&
p
p.hp
&& !p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY)
&& p
.getMoveset()
.filter(m => m.ppUsed && m.getMovePp() - m.ppUsed <= 5 && m.ppUsed > Math.floor(m.getMovePp() / 2))
.length,
.length > 0,
).length,
3,
);
@ -106,9 +106,9 @@ function initGreatRewardPool() {
const statusEffectPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!!p.status &&
!p
p.hp
&& !!p.status
&& !p
.getHeldItems()
.filter(i => i in [HeldItemId.TOXIC_ORB, HeldItemId.FLAME_ORB])
.some(i => (allHeldItems[i] as TurnEndStatusHeldItem).effect === p.status?.effect),
@ -170,9 +170,9 @@ function initGreatRewardPool() {
const statusEffectPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!!p.status &&
!p
p.hp
&& !!p.status
&& !p
.getHeldItems()
.filter(i => i in [HeldItemId.TOXIC_ORB, HeldItemId.FLAME_ORB])
.some(i => (allHeldItems[i] as TurnEndStatusHeldItem).effect === p.status?.effect),
@ -180,9 +180,9 @@ function initGreatRewardPool() {
3,
);
const thresholdPartyMemberCount = Math.floor(
(Math.min(party.filter(p => p.getInverseHp() >= 100 && p.getHpRatio() <= 0.5 && !p.isFainted()).length, 3) +
statusEffectPartyMemberCount) /
2,
(Math.min(party.filter(p => p.getInverseHp() >= 100 && p.getHpRatio() <= 0.5 && !p.isFainted()).length, 3)
+ statusEffectPartyMemberCount)
/ 2,
);
return thresholdPartyMemberCount;
},
@ -194,12 +194,12 @@ function initGreatRewardPool() {
const thresholdPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY) &&
p
p.hp
&& !p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY)
&& p
.getMoveset()
.filter(m => m.ppUsed && m.getMovePp() - m.ppUsed <= 5 && m.ppUsed > Math.floor(m.getMovePp() / 2))
.length,
.length > 0,
).length,
3,
);
@ -213,12 +213,12 @@ function initGreatRewardPool() {
const thresholdPartyMemberCount = Math.min(
party.filter(
p =>
p.hp &&
!p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY) &&
p
p.hp
&& !p.heldItemManager.hasItem(HeldItemId.LEPPA_BERRY)
&& p
.getMoveset()
.filter(m => m.ppUsed && m.getMovePp() - m.ppUsed <= 5 && m.ppUsed > Math.floor(m.getMovePp() / 2))
.length,
.length > 0,
).length,
3,
);
@ -321,9 +321,9 @@ function initUltraRewardPool() {
return party.some(p => {
// Check if Pokemon's species (or fusion species, if applicable) can evolve or if they're G-Max'd
if (
!p.isMax() &&
(p.getSpeciesForm(true).speciesId in pokemonEvolutions ||
(p.isFusion() && p.getFusionSpeciesForm(true).speciesId in pokemonEvolutions))
!p.isMax()
&& (p.getSpeciesForm(true).speciesId in pokemonEvolutions
|| (p.isFusion() && p.getFusionSpeciesForm(true).speciesId in pokemonEvolutions))
) {
// Check if Pokemon is already holding an Eviolite
return !p.heldItemManager.hasItem(HeldItemId.EVIOLITE);
@ -344,9 +344,9 @@ function initUltraRewardPool() {
// If a party member doesn't already have a Leek and is one of the relevant species, Leek can appear
return party.some(
p =>
!p.heldItemManager.hasItem(HeldItemId.LEEK) &&
(checkedSpecies.includes(p.getSpeciesForm(true).speciesId) ||
(p.isFusion() && checkedSpecies.includes(p.getFusionSpeciesForm(true).speciesId))),
!p.heldItemManager.hasItem(HeldItemId.LEEK)
&& (checkedSpecies.includes(p.getSpeciesForm(true).speciesId)
|| (p.isFusion() && checkedSpecies.includes(p.getFusionSpeciesForm(true).speciesId))),
)
? 12
: 0;
@ -575,9 +575,9 @@ function initMasterRewardPool() {
{
id: RewardId.DNA_SPLICERS,
weight: (party: Pokemon[]) =>
!(globalScene.gameMode.isClassic && timedEventManager.areFusionsBoosted()) &&
!globalScene.gameMode.isSplicedOnly &&
party.filter(p => !p.fusionSpecies).length > 1
!(globalScene.gameMode.isClassic && timedEventManager.areFusionsBoosted())
&& !globalScene.gameMode.isSplicedOnly
&& party.filter(p => !p.fusionSpecies).length > 1
? 24
: 0,
maxWeight: 24,
@ -585,8 +585,9 @@ function initMasterRewardPool() {
{
id: HeldItemId.MINI_BLACK_HOLE,
weight: () =>
globalScene.gameMode.isDaily ||
(!globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))
globalScene.gameMode.isDaily
|| (!globalScene.gameMode.isFreshStartChallenge()
&& globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))
? 1
: 0,
maxWeight: 1,
@ -642,8 +643,8 @@ function skipInLastClassicWaveOrDefault(defaultWeight: number): WeightedRewardWe
function lureWeightFunc(lureId: TrainerItemId, weight: number): WeightedRewardWeightFunc {
return () => {
const lureCount = globalScene.trainerItems.getStack(lureId);
return !(globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex === 199) &&
lureCount < allTrainerItems[lureId].getMaxStackCount() * 0.6
return !(globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex === 199)
&& lureCount < allTrainerItems[lureId].getMaxStackCount() * 0.6
? weight
: 0;
};

View File

@ -144,8 +144,8 @@ export function convertModifierSaveData(data: ModifierData[]) {
}
if (itemId) {
const specs = { id: itemId, stack: stack };
const pokemonItem = { item: specs, pokemonId: pokemonId };
const specs = { id: itemId, stack };
const pokemonItem = { item: specs, pokemonId };
pokemonItems.push(pokemonItem);
}
}

View File

@ -64,10 +64,8 @@ export interface CustomRewardSettings {
export function generateRewardPoolWeights(pool: RewardPool, party: Pokemon[], rerollCount = 0) {
for (const tier of Object.keys(pool)) {
const poolWeights = pool[tier].map(w => {
if (isTrainerItemId(w.id)) {
if (globalScene.trainerItems.isMaxStack(w.id)) {
return 0;
}
if (isTrainerItemId(w.id) && globalScene.trainerItems.isMaxStack(w.id)) {
return 0;
}
if (typeof w.weight === "number") {
return w.weight;
@ -118,7 +116,7 @@ function getRarityUpgradeCount(pool: RewardPool, baseTier: RarityTier, party: Po
if (baseTier < RarityTier.MASTER) {
const partyLuckValue = getPartyLuckValue(party);
const upgradeOdds = Math.floor(128 / ((partyLuckValue + 4) / 4));
while (pool.hasOwnProperty(baseTier + upgradeCount + 1) && pool[baseTier + upgradeCount + 1].length) {
while (pool.hasOwnProperty(baseTier + upgradeCount + 1) && pool[baseTier + upgradeCount + 1].length > 0) {
if (randSeedInt(upgradeOdds) < 4) {
upgradeCount++;
} else {
@ -212,10 +210,10 @@ function getRewardOptionWithRetry(
let candidate = getNewRewardOption(pool, weights, party, tier, undefined, 0, allowLuckUpgrades);
let r = 0;
while (
existingOptions.length &&
++r < retryCount &&
//TODO: Improve this condition to refine what counts as a dupe
existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group).length
existingOptions.length > 0
&& ++r < retryCount //TODO: Improve this condition to refine what counts as a dupe
&& existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group)
.length > 0
) {
console.log("Retry count:", r);
console.log(candidate?.type.group);

View File

@ -14,20 +14,20 @@ export class EvolutionItemReward extends PokemonReward {
constructor(evolutionItem: EvolutionItem) {
super("", EvolutionItem[evolutionItem].toLowerCase(), (pokemon: PlayerPokemon) => {
if (
pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId) &&
pokemonEvolutions[pokemon.species.speciesId].filter(e => e.validate(pokemon, false, this.evolutionItem))
.length &&
pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX
pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId)
&& pokemonEvolutions[pokemon.species.speciesId].filter(e => e.validate(pokemon, false, this.evolutionItem))
.length > 0
&& pokemon.getFormKey() !== SpeciesFormKey.GIGANTAMAX
) {
return null;
}
if (
pokemon.isFusion() &&
pokemon.fusionSpecies &&
pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId) &&
pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.validate(pokemon, true, this.evolutionItem))
.length &&
pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX
pokemon.isFusion()
&& pokemon.fusionSpecies
&& pokemonEvolutions.hasOwnProperty(pokemon.fusionSpecies.speciesId)
&& pokemonEvolutions[pokemon.fusionSpecies.speciesId].filter(e => e.validate(pokemon, true, this.evolutionItem))
.length > 0
&& pokemon.getFusionFormKey() !== SpeciesFormKey.GIGANTAMAX
) {
return null;
}
@ -94,12 +94,12 @@ export class EvolutionItemRewardGenerator extends RewardGenerator {
party
.filter(
p =>
pokemonEvolutions.hasOwnProperty(p.species.speciesId) &&
(!p.pauseEvolutions ||
p.species.speciesId === SpeciesId.SLOWPOKE ||
p.species.speciesId === SpeciesId.EEVEE ||
p.species.speciesId === SpeciesId.KIRLIA ||
p.species.speciesId === SpeciesId.SNORUNT),
pokemonEvolutions.hasOwnProperty(p.species.speciesId)
&& (!p.pauseEvolutions
|| p.species.speciesId === SpeciesId.SLOWPOKE
|| p.species.speciesId === SpeciesId.EEVEE
|| p.species.speciesId === SpeciesId.KIRLIA
|| p.species.speciesId === SpeciesId.SNORUNT),
)
.flatMap(p => {
const evolutions = pokemonEvolutions[p.species.speciesId];
@ -108,14 +108,14 @@ export class EvolutionItemRewardGenerator extends RewardGenerator {
party
.filter(
p =>
p.isFusion() &&
p.fusionSpecies &&
pokemonEvolutions.hasOwnProperty(p.fusionSpecies.speciesId) &&
(!p.pauseEvolutions ||
p.fusionSpecies.speciesId === SpeciesId.SLOWPOKE ||
p.fusionSpecies.speciesId === SpeciesId.EEVEE ||
p.fusionSpecies.speciesId === SpeciesId.KIRLIA ||
p.fusionSpecies.speciesId === SpeciesId.SNORUNT),
p.isFusion()
&& p.fusionSpecies
&& pokemonEvolutions.hasOwnProperty(p.fusionSpecies.speciesId)
&& (!p.pauseEvolutions
|| p.fusionSpecies.speciesId === SpeciesId.SLOWPOKE
|| p.fusionSpecies.speciesId === SpeciesId.EEVEE
|| p.fusionSpecies.speciesId === SpeciesId.KIRLIA
|| p.fusionSpecies.speciesId === SpeciesId.SNORUNT),
)
.flatMap(p => {
const evolutions = pokemonEvolutions[p.fusionSpecies!.speciesId];
@ -126,7 +126,7 @@ export class EvolutionItemRewardGenerator extends RewardGenerator {
.flatMap(e => e.evoItem)
.filter(i => !!i && i > 50 === this.rare);
if (!evolutionItemPool.length) {
if (evolutionItemPool.length === 0) {
return null;
}

View File

@ -22,9 +22,8 @@ export class FormChangeItemReward extends PokemonReward {
super("", allHeldItems[formChangeItem].iconName, (pokemon: PlayerPokemon) => {
// Make sure the Pokemon has alternate forms
if (
pokemonFormChanges.hasOwnProperty(pokemon.species.speciesId) &&
// Get all form changes for this species with an item trigger, including any compound triggers
pokemonFormChanges[pokemon.species.speciesId]
pokemonFormChanges.hasOwnProperty(pokemon.species.speciesId) // Get all form changes for this species with an item trigger, including any compound triggers
&& pokemonFormChanges[pokemon.species.speciesId]
.filter(
fc => fc.trigger.hasTriggerType(SpeciesFormChangeItemTrigger) && fc.preFormKey === pokemon.getFormKey(),
)
@ -92,25 +91,24 @@ export class FormChangeItemRewardGenerator extends RewardGenerator {
let formChangeItemTriggers = formChanges
.filter(
fc =>
((fc.formKey.indexOf(SpeciesFormKey.MEGA) === -1 &&
fc.formKey.indexOf(SpeciesFormKey.PRIMAL) === -1) ||
globalScene.trainerItems.hasItem(TrainerItemId.MEGA_BRACELET)) &&
((fc.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) === -1 &&
fc.formKey.indexOf(SpeciesFormKey.ETERNAMAX) === -1) ||
globalScene.trainerItems.hasItem(TrainerItemId.DYNAMAX_BAND)) &&
(!fc.conditions.length ||
fc.conditions.filter(cond => cond instanceof SpeciesFormChangeCondition && cond.predicate(p))
.length) &&
fc.preFormKey === p.getFormKey(),
((fc.formKey.indexOf(SpeciesFormKey.MEGA) === -1 && fc.formKey.indexOf(SpeciesFormKey.PRIMAL) === -1)
|| globalScene.trainerItems.hasItem(TrainerItemId.MEGA_BRACELET))
&& ((fc.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) === -1
&& fc.formKey.indexOf(SpeciesFormKey.ETERNAMAX) === -1)
|| globalScene.trainerItems.hasItem(TrainerItemId.DYNAMAX_BAND))
&& (fc.conditions.length === 0
|| fc.conditions.filter(cond => cond instanceof SpeciesFormChangeCondition && cond.predicate(p))
.length > 0)
&& fc.preFormKey === p.getFormKey(),
)
.map(fc => fc.findTrigger(SpeciesFormChangeItemTrigger) as SpeciesFormChangeItemTrigger)
.filter(t => t?.active && !p.heldItemManager.hasItem(t.item));
if (p.species.speciesId === SpeciesId.NECROZMA) {
// technically we could use a simplified version and check for formChanges.length > 3, but in case any code changes later, this might break...
let foundULTRA_Z = false,
foundN_LUNA = false,
foundN_SOLAR = false;
let foundULTRA_Z = false;
let foundN_LUNA = false;
let foundN_SOLAR = false;
formChangeItemTriggers.forEach((fc, _i) => {
console.log("Checking ", fc.item);
switch (fc.item) {
@ -143,7 +141,7 @@ export class FormChangeItemRewardGenerator extends RewardGenerator {
.filter(i => (i && i < 100) === this.isRareFormChangeItem);
// convert it into a set to remove duplicate values, which can appear when the same species with a potential form change is in the party.
if (!formChangeItemPool.length) {
if (formChangeItemPool.length === 0) {
return null;
}

View File

@ -65,7 +65,7 @@ export class PokemonAllMovePpRestoreReward extends PokemonReward {
localeKey,
iconImage,
(pokemon: PlayerPokemon) => {
if (!pokemon.getMoveset().filter(m => m.ppUsed).length) {
if (pokemon.getMoveset().filter(m => m.ppUsed).length === 0) {
return PartyUiHandler.NoEffectMessage;
}
return null;

View File

@ -11,7 +11,7 @@ export class RememberMoveReward extends PokemonReward {
localeKey,
iconImage,
(pokemon: PlayerPokemon) => {
if (!pokemon.getLearnableLevelMoves().length) {
if (pokemon.getLearnableLevelMoves().length === 0) {
return PartyUiHandler.NoEffectMessage;
}
return null;

View File

@ -69,11 +69,12 @@ export class PokemonHpRestoreReward extends PokemonReward {
super(
localeKey,
iconImage,
selectFilter ||
((pokemon: PlayerPokemon) => {
selectFilter
|| ((pokemon: PlayerPokemon) => {
if (
!pokemon.hp ||
(pokemon.isFullHp() && (!this.healStatus || (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED))))
!pokemon.hp
|| (pokemon.isFullHp()
&& (!this.healStatus || (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED))))
) {
return PartyUiHandler.NoEffectMessage;
}

View File

@ -52,8 +52,8 @@ export class ChangeTeraTypeReward extends PokemonReward {
*/
shouldApply({ pokemon }: PokemonRewardParams): boolean {
return (
pokemon.teraType !== this.teraType &&
![SpeciesId.SHEDINJA, SpeciesId.OGERPON, SpeciesId.TERAPAGOS].some(s => pokemon.hasSpecies(s))
pokemon.teraType !== this.teraType
&& ![SpeciesId.SHEDINJA, SpeciesId.OGERPON, SpeciesId.TERAPAGOS].some(s => pokemon.hasSpecies(s))
);
}
@ -86,9 +86,9 @@ export class TeraTypeRewardGenerator extends RewardGenerator {
const excludedType = globalScene.getPlayerParty().reduce((prevType, p) => {
if (
// Ignore Pokemon with fixed Tera Types
p.hasSpecies(SpeciesId.TERAPAGOS) ||
p.hasSpecies(SpeciesId.OGERPON) ||
p.hasSpecies(SpeciesId.SHEDINJA)
p.hasSpecies(SpeciesId.TERAPAGOS)
|| p.hasSpecies(SpeciesId.OGERPON)
|| p.hasSpecies(SpeciesId.SHEDINJA)
) {
return prevType;
}

View File

@ -20,8 +20,8 @@ export class TmReward extends PokemonReward {
`tm_${PokemonType[allMoves[moveId].type].toLowerCase()}`,
(pokemon: PlayerPokemon) => {
if (
pokemon.compatibleTms.indexOf(moveId) === -1 ||
pokemon.getMoveset().filter(m => m.moveId === moveId).length
pokemon.compatibleTms.indexOf(moveId) === -1
|| pokemon.getMoveset().filter(m => m.moveId === moveId).length > 0
) {
return PartyUiHandler.NoEffectMessage;
}
@ -90,7 +90,7 @@ export class TmRewardGenerator extends RewardGenerator {
.filter(tm => tmPoolTiers[tm] === this.tier)
.filter(tm => !allMoves[tm].name.endsWith(" (N)"))
.filter((tm, i, array) => array.indexOf(tm) === i);
if (!tierUniqueCompatibleTms.length) {
if (tierUniqueCompatibleTms.length === 0) {
return null;
}

View File

@ -25,7 +25,7 @@ export class TrainerItemManager {
};
return itemSpecs;
}
return undefined;
return;
}
generateTrainerItemConfiguration(restrictedIds?: TrainerItemId[]): TrainerItemConfiguration {

View File

@ -51,9 +51,9 @@ export function assignEnemyBuffTokenForWave(tier: RarityTier) {
let candidate = getNewTrainerItemFromPool(enemyBuffTokenPool[tier], globalScene.enemyTrainerItems);
let r = 0;
while (
++r < retryCount &&
allTrainerItems[candidate].getMaxStackCount() <
globalScene.enemyTrainerItems.getStack(candidate) + (r < 10 ? tierStackCount : 1)
++r < retryCount
&& allTrainerItems[candidate].getMaxStackCount()
< globalScene.enemyTrainerItems.getStack(candidate) + (r < 10 ? tierStackCount : 1)
) {
candidate = getNewTrainerItemFromPool(enemyBuffTokenPool[tier], globalScene.enemyTrainerItems);
}

View File

@ -36,8 +36,8 @@ export class BerryPhase extends FieldPhase {
eatBerries(pokemon: Pokemon): void {
const hasUsableBerry = pokemon.getHeldItems().some(m => {
return (
isItemInCategory(m, HeldItemCategoryId.BERRY) &&
(allHeldItems[m] as BerryHeldItem).shouldApply(HeldItemEffect.BERRY, { pokemon: pokemon })
isItemInCategory(m, HeldItemCategoryId.BERRY)
&& (allHeldItems[m] as BerryHeldItem).shouldApply(HeldItemEffect.BERRY, { pokemon })
);
});
@ -64,7 +64,7 @@ export class BerryPhase extends FieldPhase {
CommonAnim.USE_ITEM,
);
applyHeldItems(HeldItemEffect.BERRY, { pokemon: pokemon });
applyHeldItems(HeldItemEffect.BERRY, { pokemon });
globalScene.updateItems(pokemon.isPlayer());
// AbilityId.CHEEK_POUCH only works once per round of nom noms

View File

@ -430,7 +430,7 @@ export class MoveEffectPhase extends PokemonPhase {
&& !this.move.hitsSubstitute(user, target)
) {
const flinched = new BooleanHolder(false);
applyHeldItems(HeldItemEffect.FLINCH_CHANCE, { pokemon: user, flinched: flinched });
applyHeldItems(HeldItemEffect.FLINCH_CHANCE, { pokemon: user, flinched });
if (flinched.value) {
target.addTag(BattlerTagType.FLINCHED, undefined, this.move.id, user.id);
}
@ -882,7 +882,7 @@ export class MoveEffectPhase extends PokemonPhase {
});
if (user.isPlayer() && target.isEnemy()) {
applyHeldItems(HeldItemEffect.DAMAGE_MONEY_REWARD, { pokemon: user, damage: damage });
applyHeldItems(HeldItemEffect.DAMAGE_MONEY_REWARD, { pokemon: user, damage });
}
return [result, isCritical, damage];
@ -1002,7 +1002,7 @@ export class MoveEffectPhase extends PokemonPhase {
// Apply Grip Claw's chance to steal an item from the target
if (this.move.is("AttackMove")) {
applyHeldItems(HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE, { pokemon: user, target: target });
applyHeldItems(HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE, { pokemon: user, target });
}
}
}

View File

@ -409,10 +409,11 @@ export class MysteryEncounterBattlePhase extends Phase {
// PostSummon and ShinySparkle phases are handled by SummonPhase
if (encounterMode !== MysteryEncounterMode.TRAINER_BATTLE) {
if (globalScene.trainerItems.hasItem(TrainerItemId.IV_SCANNER)) {
enemyField.map(p => globalScene.phaseManager.pushNew("ScanIvsPhase", p.getBattlerIndex()));
}
if (
encounterMode !== MysteryEncounterMode.TRAINER_BATTLE
&& globalScene.trainerItems.hasItem(TrainerItemId.IV_SCANNER)
) {
enemyField.map(p => globalScene.phaseManager.pushNew("ScanIvsPhase", p.getBattlerIndex()));
}
const availablePartyMembers = globalScene.getPlayerParty().filter(p => p.isAllowedInBattle());

View File

@ -25,8 +25,8 @@ import { FusePokemonReward } from "#items/rewards/fuse";
import { RememberMoveReward } from "#items/rewards/remember-move";
import { TmReward } from "#items/rewards/tm";
import { BattlePhase } from "#phases/battle-phase";
import { PartyOption, PartyUiHandler, PartyUiMode, type PokemonMoveSelectFilter } from "#ui/party-ui-handler";
import { type RewardSelectUiHandler, SHOP_OPTIONS_ROW_LIMIT } from "#ui/handlers/reward-select-ui-handler";
import { PartyOption, PartyUiHandler, PartyUiMode, type PokemonMoveSelectFilter } from "#ui/party-ui-handler";
import { isNullOrUndefined, NumberHolder } from "#utils/common";
import i18next from "i18next";
@ -211,11 +211,11 @@ export class SelectRewardPhase extends BattlePhase {
-1,
(fromSlotIndex: number, itemIndex: number, itemQuantity: number, toSlotIndex: number) => {
if (
toSlotIndex !== undefined &&
fromSlotIndex < 6 &&
toSlotIndex < 6 &&
fromSlotIndex !== toSlotIndex &&
itemIndex > -1
toSlotIndex !== undefined
&& fromSlotIndex < 6
&& toSlotIndex < 6
&& fromSlotIndex !== toSlotIndex
&& itemIndex > -1
) {
const items = party[fromSlotIndex].heldItemManager.getTransferableHeldItems();
const item = items[itemIndex];
@ -262,10 +262,10 @@ export class SelectRewardPhase extends BattlePhase {
-1,
(fromSlotIndex: number, spliceSlotIndex: number) => {
if (
spliceSlotIndex !== undefined &&
fromSlotIndex < 6 &&
spliceSlotIndex < 6 &&
fromSlotIndex !== spliceSlotIndex
spliceSlotIndex !== undefined
&& fromSlotIndex < 6
&& spliceSlotIndex < 6
&& fromSlotIndex !== spliceSlotIndex
) {
globalScene.ui.setMode(UiMode.REWARD_SELECT, this.isPlayer()).then(() => {
reward.apply({ pokemon: party[fromSlotIndex], pokemon2: party[spliceSlotIndex] });
@ -302,7 +302,7 @@ export class SelectRewardPhase extends BattlePhase {
if (isRememberMoveReward(reward)) {
partyUiMode = PartyUiMode.REMEMBER_MOVE_REWARD;
getParams = (slotIndex: number, option: PartyOption) => {
return { pokemon: party[slotIndex], moveIndex: option, cost: cost } as PokemonMoveRecallRewardParams;
return { pokemon: party[slotIndex], moveIndex: option, cost } as PokemonMoveRecallRewardParams;
};
}
if (isTmReward(reward)) {
@ -374,9 +374,9 @@ export class SelectRewardPhase extends BattlePhase {
// If custom rewards are specified, overrides default item count
if (this.customRewardSettings) {
const newItemCount =
(this.customRewardSettings.guaranteedRarityTiers?.length ?? 0) +
(this.customRewardSettings.guaranteedRewardOptions?.length ?? 0) +
(this.customRewardSettings.guaranteedRewardSpecs?.length ?? 0);
(this.customRewardSettings.guaranteedRarityTiers?.length ?? 0)
+ (this.customRewardSettings.guaranteedRewardOptions?.length ?? 0)
+ (this.customRewardSettings.guaranteedRewardSpecs?.length ?? 0);
if (this.customRewardSettings.fillRemaining) {
const originalCount = rewardCountHolder.value;
rewardCountHolder.value = originalCount > newItemCount ? originalCount : newItemCount;

View File

@ -229,7 +229,7 @@ export class StatStageChangePhase extends PokemonPhase {
);
if (!existingPhase?.is("StatStageChangePhase")) {
// Apply White Herb if needed
applyHeldItems(HeldItemEffect.RESET_NEGATIVE_STAT_STAGE, { pokemon: pokemon });
applyHeldItems(HeldItemEffect.RESET_NEGATIVE_STAT_STAGE, { pokemon });
}
pokemon.updateInfo();

View File

@ -29,26 +29,25 @@ export class TrainerVictoryPhase extends BattlePhase {
const trainerType = globalScene.currentBattle.trainer?.config.trainerType!; // TODO: is this bang correct?
// Validate Voucher for boss trainers
if (vouchers.hasOwnProperty(TrainerType[trainerType])) {
if (
!globalScene.validateVoucher(vouchers[TrainerType[trainerType]]) &&
globalScene.currentBattle.trainer?.config.isBoss
) {
if (timedEventManager.getUpgradeUnlockedVouchers()) {
globalScene.phaseManager.unshiftNew(
"RewardPhase",
[RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PREMIUM][
vouchers[TrainerType[trainerType]].voucherType
],
);
} else {
globalScene.phaseManager.unshiftNew(
"RewardPhase",
[RewardId.VOUCHER, RewardId.VOUCHER, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PREMIUM][
vouchers[TrainerType[trainerType]].voucherType
],
);
}
if (
vouchers.hasOwnProperty(TrainerType[trainerType])
&& !globalScene.validateVoucher(vouchers[TrainerType[trainerType]])
&& globalScene.currentBattle.trainer?.config.isBoss
) {
if (timedEventManager.getUpgradeUnlockedVouchers()) {
globalScene.phaseManager.unshiftNew(
"RewardPhase",
[RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PREMIUM][
vouchers[TrainerType[trainerType]].voucherType
],
);
} else {
globalScene.phaseManager.unshiftNew(
"RewardPhase",
[RewardId.VOUCHER, RewardId.VOUCHER, RewardId.VOUCHER_PLUS, RewardId.VOUCHER_PREMIUM][
vouchers[TrainerType[trainerType]].voucherType
],
);
}
}
// Breeders in Space achievement

View File

@ -28,7 +28,7 @@ export class TurnEndPhase extends FieldPhase {
if (!pokemon.switchOutStatus) {
pokemon.lapseTags(BattlerTagLapseType.TURN_END);
applyHeldItems(HeldItemEffect.TURN_END_HEAL, { pokemon: pokemon });
applyHeldItems(HeldItemEffect.TURN_END_HEAL, { pokemon });
if (globalScene.arena.terrain?.terrainType === TerrainType.GRASSY && pokemon.isGrounded()) {
globalScene.phaseManager.unshiftNew(
@ -43,16 +43,16 @@ export class TurnEndPhase extends FieldPhase {
}
if (!pokemon.isPlayer()) {
globalScene.applyPlayerItems(TrainerItemEffect.ENEMY_HEAL, { pokemon: pokemon });
globalScene.applyPlayerItems(TrainerItemEffect.ENEMY_STATUS_HEAL_CHANCE, { pokemon: pokemon });
globalScene.applyPlayerItems(TrainerItemEffect.ENEMY_HEAL, { pokemon });
globalScene.applyPlayerItems(TrainerItemEffect.ENEMY_STATUS_HEAL_CHANCE, { pokemon });
}
applyAbAttrs("PostTurnAbAttr", { pokemon });
}
applyHeldItems(HeldItemEffect.TURN_END_STATUS, { pokemon: pokemon });
applyHeldItems(HeldItemEffect.TURN_END_STATUS, { pokemon });
applyHeldItems(HeldItemEffect.TURN_END_ITEM_STEAL, { pokemon: pokemon });
applyHeldItems(HeldItemEffect.TURN_END_ITEM_STEAL, { pokemon });
pokemon.tempSummonData.turnCount++;
pokemon.tempSummonData.waveTurnCount++;

View File

@ -132,6 +132,6 @@ export class VictoryPhase extends PokemonPhase {
return gameMode.getFixedBattle(waveIndex).customRewardSettings;
}
return undefined;
return;
}
}

View File

@ -494,12 +494,8 @@ export const achvs = {
25,
).setSecret(true),
SPLICE: new Achv("splice", "splice.description", "dna_splicers", 50),
MINI_BLACK_HOLE: new HeldItemAchv(
"miniBlackHole",
"miniBlackHole.description",
"mini_black_hole",
25,
pokemon => pokemon.heldItemManager.hasItem(HeldItemId.MINI_BLACK_HOLE),
MINI_BLACK_HOLE: new HeldItemAchv("miniBlackHole", "miniBlackHole.description", "mini_black_hole", 25, pokemon =>
pokemon.heldItemManager.hasItem(HeldItemId.MINI_BLACK_HOLE),
).setSecret(),
HIDDEN_ABILITY: new Achv("hiddenAbility", "hiddenAbility.description", "ability_charm", 25),
PERFECT_IVS: new Achv("perfectIvs", "perfectIvs.description", "blunder_policy", 25),

View File

@ -1162,20 +1162,20 @@ export class GameData {
}
}
globalScene.trainerItems.clearItems();
globalScene.assignTrainerItemsFromSaveData(sessionData.trainerItems, true);
globalScene.trainerItems.clearItems();
globalScene.assignTrainerItemsFromSaveData(sessionData.trainerItems, true);
globalScene.arena.positionalTagManager.tags = fromSession.arena.positionalTags.map(tag =>
loadPositionalTag(tag),
);
globalScene.enemyTrainerItems.clearItems();
globalScene.assignTrainerItemsFromSaveData(sessionData.enemyTrainerItems, false);
globalScene.enemyTrainerItems.clearItems();
globalScene.assignTrainerItemsFromSaveData(sessionData.enemyTrainerItems, false);
Promise.all(loadPokemonAssets).then(() => resolve(true));
globalScene.updateItems(true);
globalScene.updateItems(false);
globalScene.updateItems(true);
globalScene.updateItems(false);
};
if (sessionData) {
initSessionFromData(sessionData);

View File

@ -177,9 +177,9 @@ export class BattleFlyout extends Phaser.GameObjects.Container {
private onBerryUsed(event: Event) {
const berryUsedEvent = event as BerryUsedEvent;
if (
!berryUsedEvent ||
berryUsedEvent.pokemon.id !== this.pokemon?.id ||
berryUsedEvent.berryType !== BerryType.LEPPA
!berryUsedEvent
|| berryUsedEvent.pokemon.id !== this.pokemon?.id
|| berryUsedEvent.berryType !== BerryType.LEPPA
) {
// We only care about Leppa berries
return;

View File

@ -835,9 +835,9 @@ export class PartyUiHandler extends MessageUiHandler {
// This is only relevant for PartyUiMode.CHECK
// TODO: This risks hitting the other options (.MOVE_i and ALL) so does it? Do we need an extra check?
if (
option >= PartyOption.FORM_CHANGE_ITEM &&
globalScene.phaseManager.getCurrentPhase().is("SelectRewardPhase") &&
this.partyUiMode === PartyUiMode.CHECK
option >= PartyOption.FORM_CHANGE_ITEM
&& globalScene.phaseManager.getCurrentPhase().is("SelectRewardPhase")
&& this.partyUiMode === PartyUiMode.CHECK
) {
const formChangeItems = this.getFormChangeItems(pokemon);
const item = formChangeItems[option - PartyOption.FORM_CHANGE_ITEM];
@ -950,7 +950,7 @@ export class PartyUiHandler extends MessageUiHandler {
return this.moveOptionCursor(button);
}
if (button === Button.LEFT || button === Button.RIGHT && this.isItemManageMode()) {
if (button === Button.LEFT || (button === Button.RIGHT && this.isItemManageMode())) {
return this.processItemTransferModeLeftRightInput(button);
}
@ -1017,8 +1017,8 @@ export class PartyUiHandler extends MessageUiHandler {
const ui = this.getUi();
if (this.cursor < 6) {
if (
(this.partyUiMode === PartyUiMode.ITEM_TRANSFER && !this.transferMode) ||
this.partyUiMode === PartyUiMode.DISCARD
(this.partyUiMode === PartyUiMode.ITEM_TRANSFER && !this.transferMode)
|| this.partyUiMode === PartyUiMode.DISCARD
) {
/** Initialize item quantities for the selected Pokemon */
const pokemon = globalScene.getPlayerParty()[this.cursor];
@ -1063,8 +1063,8 @@ export class PartyUiHandler extends MessageUiHandler {
private processPartyCancelInput(): boolean {
const ui = this.getUi();
if (
(this.partyUiMode === PartyUiMode.ITEM_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) &&
this.transferMode
(this.partyUiMode === PartyUiMode.ITEM_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE)
&& this.transferMode
) {
this.clearTransfer();
ui.playSelect();
@ -1337,8 +1337,8 @@ export class PartyUiHandler extends MessageUiHandler {
private allowBatonSwitch(): boolean {
return !!(
this.partyUiMode !== PartyUiMode.FAINT_SWITCH &&
globalScene.getPlayerField()[this.fieldIndex].heldItemManager.hasItem(HeldItemId.BATON)
this.partyUiMode !== PartyUiMode.FAINT_SWITCH
&& globalScene.getPlayerField()[this.fieldIndex].heldItemManager.hasItem(HeldItemId.BATON)
);
}
@ -1580,10 +1580,10 @@ export class PartyUiHandler extends MessageUiHandler {
} else if (option === PartyOption.SCROLL_DOWN) {
optionName = "↓";
} else if (
(this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_REWARD &&
(this.partyUiMode !== PartyUiMode.ITEM_TRANSFER || this.transferMode) &&
this.partyUiMode !== PartyUiMode.DISCARD) ||
option === PartyOption.CANCEL
(this.partyUiMode !== PartyUiMode.REMEMBER_MOVE_REWARD
&& (this.partyUiMode !== PartyUiMode.ITEM_TRANSFER || this.transferMode)
&& this.partyUiMode !== PartyUiMode.DISCARD)
|| option === PartyOption.CANCEL
) {
switch (option) {
case PartyOption.MOVE_1:
@ -1645,11 +1645,11 @@ export class PartyUiHandler extends MessageUiHandler {
const items = pokemon.getHeldItems();
const item = items[option];
if (
this.isItemManageMode() &&
this.transferQuantitiesMax[option] > 1 &&
!this.transferMode &&
item !== undefined &&
allHeldItems[item].name === optionName
this.isItemManageMode()
&& this.transferQuantitiesMax[option] > 1
&& !this.transferMode
&& item !== undefined
&& allHeldItems[item].name === optionName
) {
let amountText = ` (${this.transferQuantities[option]})`;

View File

@ -12,8 +12,8 @@ import { TrainerItemId } from "#enums/trainer-item-id";
import { UiMode } from "#enums/ui-mode";
import type { RewardOption } from "#items/reward";
import { getPlayerShopRewardOptionsForWave, isTmReward } from "#items/reward-utils";
import { AwaitableUiHandler } from "#ui/handlers/awaitable-ui-handler";
import { MoveInfoOverlay } from "#ui/containers/move-info-overlay";
import { AwaitableUiHandler } from "#ui/handlers/awaitable-ui-handler";
import { addTextObject, getRarityTierTextTint, getTextColor, getTextStyleOptions } from "#ui/text";
import { formatMoney, NumberHolder } from "#utils/common";
import i18next from "i18next";

View File

@ -28,7 +28,6 @@ import { LoadingModalUiHandler } from "#ui/handlers/loading-modal-ui-handler";
import { LoginFormUiHandler } from "#ui/handlers/login-form-ui-handler";
import { MenuUiHandler } from "#ui/handlers/menu-ui-handler";
import { MessageUiHandler } from "#ui/handlers/message-ui-handler";
import { ModifierSelectUiHandler } from "#ui/handlers/modifier-select-ui-handler";
import { MysteryEncounterUiHandler } from "#ui/handlers/mystery-encounter-ui-handler";
import { PartyUiHandler } from "#ui/handlers/party-ui-handler";
import { PokedexPageUiHandler } from "#ui/handlers/pokedex-page-ui-handler";
@ -61,6 +60,7 @@ import { executeIf } from "#utils/common";
import i18next from "i18next";
import { AdminUiHandler } from "./handlers/admin-ui-handler";
import { RenameRunFormUiHandler } from "./handlers/rename-run-ui-handler";
import { RewardSelectUiHandler } from "./handlers/reward-select-ui-handler";
const transitionModes = [
UiMode.SAVE_SLOT,

View File

@ -538,7 +538,7 @@ export function pickWeightedIndex(weights: number[]): number | undefined {
const totalWeight = weights.reduce((sum, w) => sum + w, 0);
if (totalWeight <= 0) {
return undefined;
return;
}
let r = randSeedFloat() * totalWeight;
@ -550,7 +550,7 @@ export function pickWeightedIndex(weights: number[]): number | undefined {
r -= weights[i];
}
return undefined; // TODO: Change to something more appropriate
return; // TODO: Change to something more appropriate
}
/**

View File

@ -98,9 +98,12 @@ describe("Abilities - Harvest", () => {
await game.toNextTurn();
expect(milotic.battleData.berriesEaten).toEqualArrayUnsorted(
[BerryType.ENIGMA, BerryType.LUM, BerryType.ENIGMA, BerryType.LUM]
);
expect(milotic.battleData.berriesEaten).toEqualArrayUnsorted([
BerryType.ENIGMA,
BerryType.LUM,
BerryType.ENIGMA,
BerryType.LUM,
]);
expect(getPartyBerries()).toHaveLength(0);
// proc a high roll and we _should_ get a berry back!

View File

@ -202,13 +202,7 @@ describe("LevelAchv", () => {
describe("HeldItemAchv", () => {
it("should create an instance of ModifierAchv", () => {
const heldItemAchv = new HeldItemAchv(
"",
"Test Description",
"modifier_icon",
10,
() => true,
);
const heldItemAchv = new HeldItemAchv("", "Test Description", "modifier_icon", 10, () => true);
expect(heldItemAchv).toBeInstanceOf(HeldItemAchv);
expect(heldItemAchv instanceof Achv).toBe(true);
});

View File

@ -34,7 +34,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
return Math.floor(statValue.value);
});
@ -53,7 +53,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity
@ -83,7 +83,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity
@ -113,7 +113,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity
@ -143,7 +143,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity
@ -173,7 +173,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity
@ -203,7 +203,7 @@ describe("Items - Eviolite", () => {
vi.spyOn(partyMember, "getEffectiveStat").mockImplementation((stat, _opponent?, _move?, _isCritical?) => {
const statValue = new NumberHolder(partyMember.getStat(stat, false));
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat: stat, statValue: statValue });
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: partyMember, stat, statValue });
// Ignore other calculations for simplicity

View File

@ -179,8 +179,8 @@ describe("Department Store Sale - Mystery Encounter", () => {
expect(rewardSelectHandler.options.length).toEqual(5);
for (const option of rewardSelectHandler.options) {
expect(
option.rewardOption.type.id === RewardId.DIRE_HIT ||
option.rewardOption.type.id === RewardId.TEMP_STAT_STAGE_BOOSTER,
option.rewardOption.type.id === RewardId.DIRE_HIT
|| option.rewardOption.type.id === RewardId.TEMP_STAT_STAGE_BOOSTER,
).toBeTruthy();
}
});

View File

@ -264,7 +264,8 @@ describe("Fiery Fallout - Mystery Encounter", () => {
await game.phaseInterceptor.to(SelectRewardPhase, false);
expect(game).toBeAtPhase("SelectRewardPhase");
const hasAttackBooster = game.field.getPlayerPokemon()
const hasAttackBooster = game.field
.getPlayerPokemon()
.heldItemManager.hasItem(HeldItemCategoryId.TYPE_ATTACK_BOOSTER);
expect(hasAttackBooster).toBe(true);
});

View File

@ -213,20 +213,20 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
) as RewardSelectUiHandler;
expect(rewardSelectHandler.options.length).toEqual(4);
expect(
rewardSelectHandler.options[0].rewardOption.type.tier -
rewardSelectHandler.options[0].rewardOption.upgradeCount,
rewardSelectHandler.options[0].rewardOption.type.tier
- rewardSelectHandler.options[0].rewardOption.upgradeCount,
).toBe(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[1].rewardOption.type.tier -
rewardSelectHandler.options[1].rewardOption.upgradeCount,
rewardSelectHandler.options[1].rewardOption.type.tier
- rewardSelectHandler.options[1].rewardOption.upgradeCount,
).toBe(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[2].rewardOption.type.tier -
rewardSelectHandler.options[2].rewardOption.upgradeCount,
rewardSelectHandler.options[2].rewardOption.type.tier
- rewardSelectHandler.options[2].rewardOption.upgradeCount,
).toBe(RarityTier.GREAT);
expect(
rewardSelectHandler.options[3].rewardOption.type.tier -
rewardSelectHandler.options[3].rewardOption.upgradeCount,
rewardSelectHandler.options[3].rewardOption.type.tier
- rewardSelectHandler.options[3].rewardOption.upgradeCount,
).toBe(RarityTier.GREAT);
});
});
@ -269,20 +269,20 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
) as RewardSelectUiHandler;
expect(rewardSelectHandler.options.length).toEqual(4);
expect(
rewardSelectHandler.options[0].rewardOption.type.tier -
rewardSelectHandler.options[0].rewardOption.upgradeCount,
rewardSelectHandler.options[0].rewardOption.type.tier
- rewardSelectHandler.options[0].rewardOption.upgradeCount,
).toBe(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[1].rewardOption.type.tier -
rewardSelectHandler.options[1].rewardOption.upgradeCount,
rewardSelectHandler.options[1].rewardOption.type.tier
- rewardSelectHandler.options[1].rewardOption.upgradeCount,
).toBe(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[2].rewardOption.type.tier -
rewardSelectHandler.options[2].rewardOption.upgradeCount,
rewardSelectHandler.options[2].rewardOption.type.tier
- rewardSelectHandler.options[2].rewardOption.upgradeCount,
).toBe(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[3].rewardOption.type.tier -
rewardSelectHandler.options[3].rewardOption.upgradeCount,
rewardSelectHandler.options[3].rewardOption.type.tier
- rewardSelectHandler.options[3].rewardOption.upgradeCount,
).toBe(RarityTier.GREAT);
});
});

View File

@ -148,7 +148,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
const bstsAfter = scene.getPlayerParty().map(p => {
const baseStats = p.getSpeciesForm().baseStats.slice(0);
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: p, baseStats: baseStats });
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: p, baseStats });
return baseStats.reduce((a, b) => a + b);
});

View File

@ -212,20 +212,20 @@ describe("Trash to Treasure - Mystery Encounter", () => {
) as RewardSelectUiHandler;
expect(rewardSelectHandler.options.length).toEqual(4);
expect(
rewardSelectHandler.options[0].rewardOption.type.tier -
rewardSelectHandler.options[0].rewardOption.upgradeCount,
rewardSelectHandler.options[0].rewardOption.type.tier
- rewardSelectHandler.options[0].rewardOption.upgradeCount,
).toEqual(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[1].rewardOption.type.tier -
rewardSelectHandler.options[1].rewardOption.upgradeCount,
rewardSelectHandler.options[1].rewardOption.type.tier
- rewardSelectHandler.options[1].rewardOption.upgradeCount,
).toEqual(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[2].rewardOption.type.tier -
rewardSelectHandler.options[2].rewardOption.upgradeCount,
rewardSelectHandler.options[2].rewardOption.type.tier
- rewardSelectHandler.options[2].rewardOption.upgradeCount,
).toEqual(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[3].rewardOption.type.tier -
rewardSelectHandler.options[3].rewardOption.upgradeCount,
rewardSelectHandler.options[3].rewardOption.type.tier
- rewardSelectHandler.options[3].rewardOption.upgradeCount,
).toEqual(RarityTier.GREAT);
});
});

View File

@ -204,28 +204,28 @@ describe("Weird Dream - Mystery Encounter", () => {
) as RewardSelectUiHandler;
expect(rewardSelectHandler.options.length).toEqual(6);
expect(
rewardSelectHandler.options[0].rewardOption.type.tier -
rewardSelectHandler.options[0].rewardOption.upgradeCount,
rewardSelectHandler.options[0].rewardOption.type.tier
- rewardSelectHandler.options[0].rewardOption.upgradeCount,
).toEqual(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[1].rewardOption.type.tier -
rewardSelectHandler.options[1].rewardOption.upgradeCount,
rewardSelectHandler.options[1].rewardOption.type.tier
- rewardSelectHandler.options[1].rewardOption.upgradeCount,
).toEqual(RarityTier.ROGUE);
expect(
rewardSelectHandler.options[2].rewardOption.type.tier -
rewardSelectHandler.options[2].rewardOption.upgradeCount,
rewardSelectHandler.options[2].rewardOption.type.tier
- rewardSelectHandler.options[2].rewardOption.upgradeCount,
).toEqual(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[3].rewardOption.type.tier -
rewardSelectHandler.options[3].rewardOption.upgradeCount,
rewardSelectHandler.options[3].rewardOption.type.tier
- rewardSelectHandler.options[3].rewardOption.upgradeCount,
).toEqual(RarityTier.ULTRA);
expect(
rewardSelectHandler.options[4].rewardOption.type.tier -
rewardSelectHandler.options[4].rewardOption.upgradeCount,
rewardSelectHandler.options[4].rewardOption.type.tier
- rewardSelectHandler.options[4].rewardOption.upgradeCount,
).toEqual(RarityTier.GREAT);
expect(
rewardSelectHandler.options[5].rewardOption.type.tier -
rewardSelectHandler.options[5].rewardOption.upgradeCount,
rewardSelectHandler.options[5].rewardOption.type.tier
- rewardSelectHandler.options[5].rewardOption.upgradeCount,
).toEqual(RarityTier.GREAT);
});
});

View File

@ -48,7 +48,6 @@ import type { PhaseClass, PhaseString } from "#types/phase-types";
import type { BallUiHandler } from "#ui/handlers/ball-ui-handler";
import type { BattleMessageUiHandler } from "#ui/handlers/battle-message-ui-handler";
import type { CommandUiHandler } from "#ui/handlers/command-ui-handler";
import type { ModifierSelectUiHandler } from "#ui/handlers/reward-select-ui-handler";
import type { PartyUiHandler } from "#ui/handlers/party-ui-handler";
import type { StarterSelectUiHandler } from "#ui/handlers/starter-select-ui-handler";
import type { TargetSelectUiHandler } from "#ui/handlers/target-select-ui-handler";

View File

@ -144,8 +144,8 @@ export class OverridesHelper extends GameManagerHelper {
* @returns `this`
*/
public startingPokeballs(pokeballs: PokeballCounts): this {
vi.spyOn(Overrides, "POKEBALL_OVERRIDE", "get").mockReturnValue({ active: true, pokeballs: pokeballs });
this.log("Player Pokemon starting held items set to:", { active: true, pokeballs: pokeballs });
vi.spyOn(Overrides, "POKEBALL_OVERRIDE", "get").mockReturnValue({ active: true, pokeballs });
this.log("Player Pokemon starting held items set to:", { active: true, pokeballs });
return this;
}