diff --git a/src/data/balance/biomes.ts b/src/data/balance/biomes.ts index adeb4de5054..a6ef328b2c8 100644 --- a/src/data/balance/biomes.ts +++ b/src/data/balance/biomes.ts @@ -7741,9 +7741,9 @@ export function initBiomes() { : [ TimeOfDay.ALL ]; catchableSpecies[speciesId].push({ - biome: biome, - tier: tier, - tod: timesOfDay + biome: biome as Biome, + tier: tier as BiomePoolTier, + tod: timesOfDay as TimeOfDay[] }); for (const tod of timesOfDay) { diff --git a/src/data/balance/tms.ts b/src/data/balance/tms.ts index e5ecfa6c9df..36d5fd3cee3 100644 --- a/src/data/balance/tms.ts +++ b/src/data/balance/tms.ts @@ -68434,23 +68434,24 @@ export const tmSpecies: TmSpecies = { }; interface SpeciesTmMoves { - [key: number]: Array + [key: integer]: Moves[] } function flipTmSpecies(tmSpecies: TmSpecies): SpeciesTmMoves { const flipped: SpeciesTmMoves = {}; - for (const move in tmSpecies) { - const speciesList = tmSpecies[move]; // Convert the move key back to a number + for (const move in Object.keys(tmSpecies)) { + const moveKey = Number(move); + const speciesList = tmSpecies[moveKey]; for (const species of speciesList) { - if (!flipped[species]) { - flipped[species] = []; + const speciesKey = Number(species); + if (!flipped[speciesKey]) { + flipped[speciesKey] = []; } - flipped[species].push(move); + flipped[speciesKey].push(moveKey); } } - return flipped; } diff --git a/src/ui/filter-text.ts b/src/ui/filter-text.ts index c3898a426cd..5aeea3a955d 100644 --- a/src/ui/filter-text.ts +++ b/src/ui/filter-text.ts @@ -63,7 +63,7 @@ export class FilterText extends Phaser.GameObjects.Container { this.menuMessageBoxContainer.setVisible(false); // Full-width window used for testing dialog messages in debug mode - this.dialogueMessageBox = addWindow(this.scene, -this.textPadding, 0, this.scene.game.canvas.width / 6 + this.textPadding * 2, 49, false, false, 0, 0, WindowVariant.THIN); + this.dialogueMessageBox = addWindow(scene, -this.textPadding, 0, this.scene.game.canvas.width / 6 + this.textPadding * 2, 49, false, false, 0, 0, WindowVariant.THIN); this.dialogueMessageBox.setOrigin(0, 0); this.menuMessageBoxContainer.add(this.dialogueMessageBox); @@ -162,20 +162,6 @@ export class FilterText extends Phaser.GameObjects.Container { this.lastCursor = cursor; } - /** - * Switch the message window style and size when we are replaying dialog for debug purposes - * In "dialog test mode", the window takes the whole width of the screen and the text - * is set up to wrap around the same way as the dialogue during the game - * @param isDialogMode whether to use the dialog test - */ - setDialogTestMode(isDialogMode: boolean) { - this.dialogueMessageBox.setVisible(isDialogMode); - // If we're testing dialog, we use the same word wrapping as the battle message handler - this.message.setWordWrapWidth(isDialogMode ? this.scene.ui.getMessageHandler().wordWrapWidth : this.defaultWordWrapWidth); - this.message.setX(isDialogMode ? this.textPadding + 1 : this.textPadding); - this.message.setY(isDialogMode ? this.textPadding + 0.4 : this.textPadding); - } - /////////////////From here down changes must be made /** diff --git a/src/ui/pokedex-scan-ui-handler.ts b/src/ui/pokedex-scan-ui-handler.ts index 619c3ed8f42..c69d2e58076 100644 --- a/src/ui/pokedex-scan-ui-handler.ts +++ b/src/ui/pokedex-scan-ui-handler.ts @@ -8,6 +8,7 @@ import { FilterTextRow } from "./filter-text"; import { allAbilities } from "#app/data/ability"; import { allMoves } from "#app/data/move"; import { allSpecies } from "#app/data/pokemon-species"; +import i18next from "i18next"; export default class PokedexScanUiHandler extends FormModalUiHandler { @@ -17,6 +18,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { nameKeys: string[]; moveKeys: string[]; abilityKeys: string[]; + row: number; constructor(scene, mode) { super(scene, mode); @@ -31,7 +33,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { } getModalTitle(config?: ModalConfig): string { - return "Choose option"; + return i18next.t("pokedexUiHandler:scanChooseOption"); } getWidth(config?: ModalConfig): number { @@ -43,7 +45,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { } getButtonLabels(config?: ModalConfig): string[] { - return [ "Select", "Cancel" ]; + return [ i18next.t("pokedexUiHandler:scanSelect"), i18next.t("pokedexUiHandler:scanCancel") ]; } getReadableErrorMessage(error: string): string { @@ -56,13 +58,29 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { } override getInputFieldConfigs(): InputFieldConfig[] { - return [{ label: "Dialogue" }]; + switch (this.row) { + case FilterTextRow.NAME: { + return [{ label: i18next.t("pokedexUiHandler:scanLabelName") }]; + } + case FilterTextRow.MOVE_1: + case FilterTextRow.MOVE_2: { + return [{ label: i18next.t("pokedexUiHandler:scanLabelMove") }]; + } + case FilterTextRow.ABILITY_1:{ + return [{ label: i18next.t("pokedexUiHandler:scanLabelAbility") }]; + } + case FilterTextRow.ABILITY_2: { + return [{ label: i18next.t("pokedexUiHandler:scanLabelPassive") }]; + } + default: { + return [{ label: "" }]; + } + } + } - reduceKeys(row: FilterTextRow): void { - console.log("Function was called!"); - console.log(this.keys); - switch (row) { + reduceKeys(): void { + switch (this.row) { case FilterTextRow.NAME: { this.reducedKeys = this.nameKeys; break; @@ -87,6 +105,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { // args[2] is an index of FilterTextRow //TODO: This logic is probably way more complex than we need, and actually messes things up for moves and abilities with a space like "Leech Seed" show(args: any[]): boolean { + this.row = args[2]; const ui = this.getUi(); const hasTitle = !!this.getModalTitle(); this.updateFields(this.getInputFieldConfigs(), hasTitle); @@ -94,8 +113,7 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { const input = this.inputs[0]; input.setMaxLength(255); - console.log(args[2]); - this.reduceKeys(args[2]); + this.reduceKeys(); input.on("keydown", (inputObject, evt: KeyboardEvent) => { if ([ "escape", "space" ].some((v) => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && ui.getMode() === Mode.AUTO_COMPLETE) { diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 0183604d58e..46cd29bedd1 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -311,12 +311,8 @@ export default class PokedexUiHandler extends MessageUiHandler { } } } - // Switch to the dialog test window - this.setDialogTestMode(true); ui.showText(String(i18next.t(translatedString, interpolatorOptions)), null, () => this.scene.ui.showText("", 0, () => { handler.tutorialActive = false; - // Go back to the default message window - this.setDialogTestMode(false); }), null, true); }, () => { @@ -2059,15 +2055,6 @@ export default class PokedexUiHandler extends MessageUiHandler { } } - setDialogTestMode(isDialogMode: boolean) { - this.menuMessageBox.setVisible(!isDialogMode); - this.dialogueMessageBox.setVisible(isDialogMode); - // If we're testing dialog, we use the same word wrapping as the battle message handler - this.message.setWordWrapWidth(isDialogMode ? this.scene.ui.getMessageHandler().wordWrapWidth : this.defaultWordWrapWidth); - this.message.setX(isDialogMode ? this.textPadding + 1 : this.textPadding); - this.message.setY(isDialogMode ? this.textPadding + 0.4 : this.textPadding); - } - checkIconId(icon: Phaser.GameObjects.Sprite, species: PokemonSpecies, female: boolean, formIndex: number, shiny: boolean, variant: number) { if (icon.frame.name !== species.getIconId(female, formIndex, shiny, variant)) { console.log(`${species.name}'s icon ${icon.frame.name} does not match getIconId with female: ${female}, formIndex: ${formIndex}, shiny: ${shiny}, variant: ${variant}`);