diff --git a/public/images/pokemon/exp/back/shiny/745-midnight.png b/public/images/pokemon/exp/back/shiny/745-midnight.png index 94a9c328d01..a7d7e0497b5 100644 Binary files a/public/images/pokemon/exp/back/shiny/745-midnight.png and b/public/images/pokemon/exp/back/shiny/745-midnight.png differ diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 6da5c9482bc..2a920864850 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -844,14 +844,13 @@ export default class BattleScene extends SceneBase { if (Overrides.OPP_SPECIES_OVERRIDE) { species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE); } - const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource); + if (Overrides.OPP_LEVEL_OVERRIDE !== 0) { - pokemon.level = Overrides.OPP_LEVEL_OVERRIDE; + level = Overrides.OPP_LEVEL_OVERRIDE; } - if (Overrides.OPP_GENDER_OVERRIDE !== null) { - pokemon.gender = Overrides.OPP_GENDER_OVERRIDE; - } + const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource); + overrideModifiers(this, false); overrideHeldItems(this, pokemon, false); if (boss && !dataSource) { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index af9b01ce973..080e10b0f1c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3763,6 +3763,18 @@ export class EnemyPokemon extends Pokemon { this.status = new Status(Overrides.OPP_STATUS_OVERRIDE); } + if (Overrides.OPP_GENDER_OVERRIDE) { + this.gender = Overrides.OPP_GENDER_OVERRIDE; + } + + const speciesId = this.species.speciesId; + + if (speciesId in Overrides.OPP_FORM_OVERRIDES + && Overrides.OPP_FORM_OVERRIDES[speciesId] + && this.species.forms[Overrides.OPP_FORM_OVERRIDES[speciesId]]) { + this.formIndex = Overrides.OPP_FORM_OVERRIDES[speciesId] ?? 0; + } + if (!dataSource) { this.generateAndPopulateMoveset(); diff --git a/src/locales/de/pokemon-summary.json b/src/locales/de/pokemon-summary.json index deb4a69f248..1790c6878b9 100644 --- a/src/locales/de/pokemon-summary.json +++ b/src/locales/de/pokemon-summary.json @@ -13,5 +13,32 @@ "metFragment": { "normal": "Herkunft: {{biome}}\nMit Lv. {{level}} erhalten.", "apparently": "Herkunft: {{biome}}\nOffenbar mit Lv. {{level}} erhalten." + }, + "natureFragment": { + "Hardy": "{{nature}}", + "Lonely": "{{nature}}", + "Brave": "{{nature}}", + "Adamant": "{{nature}}", + "Naughty": "{{nature}}", + "Bold": "{{nature}}", + "Docile": "{{nature}}", + "Relaxed": "{{nature}}", + "Impish": "{{nature}}", + "Lax": "{{nature}}", + "Timid": "{{nature}}", + "Hasty": "{{nature}}", + "Serious": "{{nature}}", + "Jolly": "{{nature}}", + "Naive": "{{nature}}", + "Modest": "{{nature}}", + "Mild": "{{nature}}", + "Quiet": "{{nature}}", + "Bashful": "{{nature}}", + "Rash": "{{nature}}", + "Calm": "{{nature}}", + "Gentle": "{{nature}}", + "Sassy": "{{nature}}", + "Careful": "{{nature}}", + "Quirky": "{{nature}}" } -} \ No newline at end of file +} diff --git a/src/locales/en/pokemon-summary.json b/src/locales/en/pokemon-summary.json index 8d266999084..80e0cdab010 100644 --- a/src/locales/en/pokemon-summary.json +++ b/src/locales/en/pokemon-summary.json @@ -13,5 +13,32 @@ "metFragment": { "normal": "met at Lv{{level}},\n{{biome}}.", "apparently": "apparently met at Lv{{level}},\n{{biome}}." + }, + "natureFragment": { + "Hardy": "{{nature}}", + "Lonely": "{{nature}}", + "Brave": "{{nature}}", + "Adamant": "{{nature}}", + "Naughty": "{{nature}}", + "Bold": "{{nature}}", + "Docile": "{{nature}}", + "Relaxed": "{{nature}}", + "Impish": "{{nature}}", + "Lax": "{{nature}}", + "Timid": "{{nature}}", + "Hasty": "{{nature}}", + "Serious": "{{nature}}", + "Jolly": "{{nature}}", + "Naive": "{{nature}}", + "Modest": "{{nature}}", + "Mild": "{{nature}}", + "Quiet": "{{nature}}", + "Bashful": "{{nature}}", + "Rash": "{{nature}}", + "Calm": "{{nature}}", + "Gentle": "{{nature}}", + "Sassy": "{{nature}}", + "Careful": "{{nature}}", + "Quirky": "{{nature}}" } } \ No newline at end of file diff --git a/src/locales/es/settings.json b/src/locales/es/settings.json index 2351abf04ae..9c16fbb0fd6 100644 --- a/src/locales/es/settings.json +++ b/src/locales/es/settings.json @@ -2,6 +2,106 @@ "boy": "Chico", "girl": "Chica", "general": "General", + "display": "Pantalla", "audio": "Audio", - "shopOverlayOpacity": "Opacidad de la fase de compra" + "gamepad": "Mando", + "keyboard": "Teclado", + "gameSpeed": "Veloc. del juego", + "hpBarSpeed": "Veloc. barra PS", + "expGainsSpeed": "Veloc. de EXP", + "expPartyDisplay": "Mostrar EXP del Equipo", + "skipSeenDialogues": "Saltar diálogos leídos", + "battleStyle": "Estilo de lucha", + "enableRetries": "Activar reintento", + "hideIvs": "Ocultar escáner de IVs", + "tutorials": "Tutoriales", + "touchControls": "Control táctil", + "vibrations": "Vibración", + "normal": "Normal", + "fast": "+1", + "faster": "+2", + "skip": "Saltar", + "levelUpNotifications": "Aumentos de nivel", + "on": "Sí", + "off": "No", + "switch": "Cambiar", + "set": "Mantener", + "auto": "Auto.", + "disabled": "Desact.", + "language": "Idioma", + "change": "Cambiar", + "uiTheme": "Color UI", + "default": "Predet.", + "legacy": "Clásico", + "windowType": "Ventana", + "moneyFormat": "Formato dinero", + "damageNumbers": "Cifras de daño", + "simple": "Simple", + "fancy": "Elegante", + "abbreviated": "Abreviado", + "moveAnimations": "Animación de movs.", + "showStatsOnLevelUp": "Estadísticas al aum. nivel", + "candyUpgradeNotification": "Aviso de caramelos", + "passivesOnly": "Solo pasivas", + "candyUpgradeDisplay": "Muestra de caramelos", + "icon": "Icono", + "animation": "Animación", + "moveInfo": "Info. de movimientos", + "showMovesetFlyout": "Descripción de movimientos", + "showArenaFlyout": "Descripción de escenarios", + "showTimeOfDayWidget": "Mostrar hora del día", + "timeOfDayAnimation": "Animación hora del día", + "bounce": "Rebote", + "timeOfDay_back": "Vuelta", + "spriteSet": "Set de sprites", + "consistent": "Consistente", + "mixedAnimated": "Mixto", + "fusionPaletteSwaps": "Colores de fusión", + "playerGender": "Género del jugador", + "typeHints": "Pistas de tipos", + "masterVolume": "Volumen total", + "bgmVolume": "Volumen música", + "fieldVolume": "Volumen escenario", + "seVolume": "Volumen efectos", + "uiVolume": "Volumen sistema", + "musicPreference": "Preferencia musical", + "mixed": "Mixta", + "gamepadPleasePlug": "Conecta un mando o pulsa un botón", + "delete": "Eliminar", + "keyboardPleasePress": "Pulsa una tecla de tu teclado", + "reset": "Restablecer", + "requireReload": "Requiere reinicio", + "action": "Acción", + "back": "Atrás", + "pressToBind": "Pulsa para vincular", + "pressButton": "Pulsa un botón...", + "buttonUp": "Arriba", + "buttonDown": "Abajo", + "buttonLeft": "Izquierda", + "buttonRight": "Derecha", + "buttonAction": "Acción", + "buttonMenu": "Menú", + "buttonSubmit": "Confirmar", + "buttonCancel": "Cancelar", + "buttonStats": "Estadísticas", + "buttonCycleForm": "Cambiar forma", + "buttonCycleShiny": "Cambiar shiny", + "buttonCycleGender": "Cambiar género", + "buttonCycleAbility": "Cambiar habilidad", + "buttonCycleNature": "Cambiar naturaleza", + "buttonCycleVariant": "Cambiar variante", + "buttonSpeedUp": "Acelerar", + "buttonSlowDown": "Ralentizar", + "alt": " (Alt.)", + "mute": "Silenciar", + "controller": "Mando", + "gamepadSupport": "Soporte de mando", + "showBgmBar": "Mostrar título de canción", + "moveTouchControls": "Controles táctiles", + "shopOverlayOpacity": "Opacidad de la fase de compra", + "shopCursorTarget": "Cursor de la tienda", + "items": "Objetos", + "reroll": "Actualizar", + "shop": "Tienda", + "checkTeam": "Ver equipo" } diff --git a/src/locales/ko/bgm-name.json b/src/locales/ko/bgm-name.json index bfb63e210c5..5295e2d8708 100644 --- a/src/locales/ko/bgm-name.json +++ b/src/locales/ko/bgm-name.json @@ -83,15 +83,17 @@ "battle_aether_grunt": "SM 에테르재단 배틀", "battle_skull_grunt": "SM 스컬단 배틀", "battle_macro_grunt": "SWSH 트레이너 배틀", + "battle_galactic_admin": "BDSP 갤럭시단 간부 배틀", + "battle_skull_admin": "SM 스컬단 간부 배틀", + "battle_oleana": "SWSH 올리브 배틀", "battle_rocket_boss": "USUM 비주기 배틀", "battle_aqua_magma_boss": "ORAS 아강 & 마적 배틀", "battle_galactic_boss": "BDSP 태홍 배틀", "battle_plasma_boss": "B2W2 게치스 배틀", "battle_flare_boss": "XY 플라드리 배틀", - "battle_aether_boss": "SM 루자미네 배틀", + "battle_aether_boss": "SM 루자미네 배틀", "battle_skull_boss": "SM 구즈마 배틀", "battle_macro_boss": "SWSH 로즈 배틀", - "abyss": "불가사의 던전 하늘의 탐험대 어둠의 화구", "badlands": "불가사의 던전 하늘의 탐험대 불모의 계곡", "beach": "불가사의 던전 하늘의 탐험대 축축한 암반", diff --git a/src/locales/ko/pokemon-summary.json b/src/locales/ko/pokemon-summary.json index 3deec35c62d..d9119623662 100644 --- a/src/locales/ko/pokemon-summary.json +++ b/src/locales/ko/pokemon-summary.json @@ -13,5 +13,32 @@ "metFragment": { "normal": "{{biome}}에서\n레벨 {{level}}일 때 만났다.", "apparently": "{{biome}}에서\n레벨 {{level}}일 때 만난 것 같다." + }, + "natureFragment": { + "Hardy": "{{nature}}하는 성격", + "Lonely": "{{nature}}을 타는 성격", + "Brave": "{{nature}}한 성격", + "Adamant": "{{nature}}스러운 성격", + "Naughty": "{{nature}}같은 성격", + "Bold": "{{nature}}한 성격", + "Docile": "{{nature}}한 성격", + "Relaxed": "{{nature}}한 성격", + "Impish": "{{nature}}같은 성격", + "Lax": "{{nature}}거리는 성격", + "Timid": "{{nature}}같은 성격", + "Hasty": "{{nature}}한 성격", + "Serious": "{{nature}}한 성격", + "Jolly": "{{nature}}한 성격", + "Naive": "{{nature}}한 성격", + "Modest": "{{nature}}스러운 성격", + "Mild": "{{nature}}한 성격", + "Quiet": "{{nature}}한 성격", + "Bashful": "{{nature}}을 타는 성격", + "Rash": "{{nature}}거리는 성격", + "Calm": "{{nature}}한 성격", + "Gentle": "{{nature}}한 성격", + "Sassy": "{{nature}}진 성격", + "Careful": "{{nature}}한 성격", + "Quirky": "{{nature}}스러운 성격" } } diff --git a/src/locales/ko/settings.json b/src/locales/ko/settings.json index d867d86a91a..b7fc01cb148 100644 --- a/src/locales/ko/settings.json +++ b/src/locales/ko/settings.json @@ -59,10 +59,11 @@ "fusionPaletteSwaps": "셰이더 적용", "playerGender": "플레이어 성별", "typeHints": "상성 힌트", - "masterVolume": "전체 볼륨", - "bgmVolume": "배경음악 볼륨", + "masterVolume": "마스터 볼륨", + "bgmVolume": "BGM 볼륨", "fieldVolume": "전투효과 볼륨", - "seVolume": "조작 볼륨", + "seVolume": "SE 볼륨", + "uiVolume": "UI 볼륨", "musicPreference": "음악 설정", "mixed": "믹스", "gamepadPleasePlug": "게임패드를 연결하거나 버튼을 입력하세요", diff --git a/src/locales/pt_BR/trainer-names.json b/src/locales/pt_BR/trainer-names.json index fc4e48de040..5500e2ddb46 100644 --- a/src/locales/pt_BR/trainer-names.json +++ b/src/locales/pt_BR/trainer-names.json @@ -138,11 +138,17 @@ "rood": "Rood", "xerosic": "Xerosic", "bryony": "Bryony", + "faba": "Faba", + "plumeria": "Plumeria", + "oleana": "Oleana", "maxie": "Maxie", "archie": "Archie", "cyrus": "Cyrus", "ghetsis": "Ghetsis", "lysandre": "Lysandre", + "lusamine": "Lusamine", + "guzma": "Guzma", + "rose": "Rose", "blue_red_double": "Blue & Red", "red_blue_double": "Red & Blue", "tate_liza_double": "Tate & Liza", @@ -153,4 +159,4 @@ "iris_alder_double": "Iris & Alder", "marnie_piers_double": "Marnie & Piers", "piers_marnie_double": "Piers & Marnie" -} \ No newline at end of file +} diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index beec048754e..938f73a1e08 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -57,7 +57,7 @@ export class ModifierType { this.localeKey = localeKey!; // TODO: is this bang correct? this.iconImage = iconImage!; // TODO: is this bang correct? this.group = group!; // TODO: is this bang correct? - this.soundName = soundName ?? "restore"; + this.soundName = soundName ?? "se/restore"; this.newModifierFunc = newModifierFunc; } @@ -169,7 +169,7 @@ class AddPokeballModifierType extends ModifierType { private count: integer; constructor(iconImage: string, pokeballType: PokeballType, count: integer) { - super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "pb_bounce_1"); + super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1"); this.pokeballType = pokeballType; this.count = count; } @@ -677,7 +677,7 @@ export class MoneyRewardModifierType extends ModifierType { private moneyMultiplierDescriptorKey: string; constructor(localeKey: string, iconImage: string, moneyMultiplier: number, moneyMultiplierDescriptorKey: string) { - super(localeKey, iconImage, (_type, _args) => new Modifiers.MoneyRewardModifier(this, moneyMultiplier), "money", "buy"); + super(localeKey, iconImage, (_type, _args) => new Modifiers.MoneyRewardModifier(this, moneyMultiplier), "money", "se/buy"); this.moneyMultiplier = moneyMultiplier; this.moneyMultiplierDescriptorKey = moneyMultiplierDescriptorKey; @@ -1462,7 +1462,7 @@ export const modifierTypes = { VOUCHER_PLUS: () => new AddVoucherModifierType(VoucherType.PLUS, 1), VOUCHER_PREMIUM: () => new AddVoucherModifierType(VoucherType.PREMIUM, 1), - GOLDEN_POKEBALL: () => new ModifierType("modifierType:ModifierType.GOLDEN_POKEBALL", "pb_gold", (type, _args) => new Modifiers.ExtraModifierModifier(type), undefined, "pb_bounce_1"), + GOLDEN_POKEBALL: () => new ModifierType("modifierType:ModifierType.GOLDEN_POKEBALL", "pb_gold", (type, _args) => new Modifiers.ExtraModifierModifier(type), undefined, "se/pb_bounce_1"), ENEMY_DAMAGE_BOOSTER: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_BOOSTER", "wl_item_drop", (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 5)), ENEMY_DAMAGE_REDUCTION: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_REDUCTION", "wl_guard_spec", (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 2.5)), diff --git a/src/overrides.ts b/src/overrides.ts index 8b3d628e05e..32ff116f41d 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -46,14 +46,14 @@ class DefaultOverrides { readonly SEED_OVERRIDE: string = ""; readonly WEATHER_OVERRIDE: WeatherType = WeatherType.NONE; readonly BATTLE_TYPE_OVERRIDE: "double" | "single" | null = null; - readonly STARTING_WAVE_OVERRIDE: integer = 0; + readonly STARTING_WAVE_OVERRIDE: number = 0; readonly STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN; readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null; /** Multiplies XP gained by this value including 0. Set to null to ignore the override */ readonly XP_MULTIPLIER_OVERRIDE: number | null = null; readonly NEVER_CRIT_OVERRIDE: boolean = false; /** default 1000 */ - readonly STARTING_MONEY_OVERRIDE: integer = 0; + readonly STARTING_MONEY_OVERRIDE: number = 0; /** Sets all shop item prices to 0 */ readonly WAIVE_SHOP_FEES_OVERRIDE: boolean = false; /** Sets reroll price to 0 */ @@ -86,14 +86,14 @@ class DefaultOverrides { readonly STARTER_FORM_OVERRIDES: Partial> = {}; /** default 5 or 20 for Daily */ - readonly STARTING_LEVEL_OVERRIDE: integer = 0; + readonly STARTING_LEVEL_OVERRIDE: number = 0; /** * SPECIES OVERRIDE * will only apply to the first starter in your party or each enemy pokemon * default is 0 to not override * @example SPECIES_OVERRIDE = Species.Bulbasaur; */ - readonly STARTER_SPECIES_OVERRIDE: Species | integer = 0; + readonly STARTER_SPECIES_OVERRIDE: Species | number = 0; readonly ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE; @@ -105,7 +105,7 @@ class DefaultOverrides { // -------------------------- // OPPONENT / ENEMY OVERRIDES // -------------------------- - readonly OPP_SPECIES_OVERRIDE: Species | integer = 0; + readonly OPP_SPECIES_OVERRIDE: Species | number = 0; readonly OPP_LEVEL_OVERRIDE: number = 0; readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; @@ -114,7 +114,8 @@ class DefaultOverrides { readonly OPP_MOVESET_OVERRIDE: Array = []; readonly OPP_SHINY_OVERRIDE: boolean = false; readonly OPP_VARIANT_OVERRIDE: Variant = 0; - readonly OPP_IVS_OVERRIDE: integer | integer[] = []; + readonly OPP_IVS_OVERRIDE: number | number[] = []; + readonly OPP_FORM_OVERRIDES: Partial> = {}; // ------------- // EGG OVERRIDES diff --git a/src/phases/game-over-phase.ts b/src/phases/game-over-phase.ts index a42e8472952..78dd73057a1 100644 --- a/src/phases/game-over-phase.ts +++ b/src/phases/game-over-phase.ts @@ -1,19 +1,19 @@ -import { clientSessionId } from "#app/account.js"; -import BattleScene from "#app/battle-scene.js"; -import { BattleType } from "#app/battle.js"; -import { miscDialogue, getCharVariantFromDialogue } from "#app/data/dialogue.js"; -import { pokemonEvolutions } from "#app/data/pokemon-evolutions.js"; -import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species.js"; -import { trainerConfigs } from "#app/data/trainer-config.js"; -import { PlayerGender } from "#app/enums/player-gender.js"; -import { TrainerType } from "#app/enums/trainer-type.js"; -import Pokemon from "#app/field/pokemon.js"; -import { modifierTypes } from "#app/modifier/modifier-type.js"; -import { achvs, ChallengeAchv } from "#app/system/achv.js"; -import { Unlockables } from "#app/system/unlockables.js"; -import { Mode } from "#app/ui/ui.js"; +import { clientSessionId } from "#app/account"; +import BattleScene from "#app/battle-scene"; +import { BattleType } from "#app/battle"; +import { miscDialogue, getCharVariantFromDialogue } from "#app/data/dialogue"; +import { pokemonEvolutions } from "#app/data/pokemon-evolutions"; +import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species"; +import { trainerConfigs } from "#app/data/trainer-config"; +import { PlayerGender } from "#app/enums/player-gender"; +import { TrainerType } from "#app/enums/trainer-type"; +import Pokemon from "#app/field/pokemon"; +import { modifierTypes } from "#app/modifier/modifier-type"; +import { achvs, ChallengeAchv } from "#app/system/achv"; +import { Unlockables } from "#app/system/unlockables"; +import { Mode } from "#app/ui/ui"; import i18next from "i18next"; -import * as Utils from "#app/utils.js"; +import * as Utils from "#app/utils"; import { BattlePhase } from "./battle-phase"; import { CheckSwitchPhase } from "./check-switch-phase"; import { EncounterPhase } from "./encounter-phase"; @@ -23,6 +23,12 @@ import { SummonPhase } from "./summon-phase"; import { EndCardPhase } from "./end-card-phase"; import { PostGameOverPhase } from "./post-game-over-phase"; import { UnlockPhase } from "./unlock-phase"; +import { SessionSaveData } from "../system/game-data"; +import TrainerData from "../system/trainer-data"; +import PokemonData from "../system/pokemon-data"; +import PersistentModifierData from "../system/modifier-data"; +import ChallengeData from "../system/challenge-data"; +import ArenaData from "../system/arena-data"; export class GameOverPhase extends BattlePhase { private victory: boolean; @@ -98,13 +104,7 @@ export class GameOverPhase extends BattlePhase { this.scene.gameData.gameStats.dailyRunSessionsWon++; } } - this.scene.gameData.getSession(this.scene.sessionSlotId).then(sessionData => { - if (sessionData) { - this.scene.gameData.saveRunHistory(this.scene, sessionData, this.victory); - } - }).catch(err => { - console.error("Failed to save run to history.", err); - }); + this.scene.gameData.saveRunHistory(this.scene, this.getFinalSessionData(), this.victory); const fadeDuration = this.victory ? 10000 : 5000; this.scene.fadeOutBgm(fadeDuration, true); const activeBattlers = this.scene.getField().filter(p => p?.isActive(true)); @@ -207,4 +207,32 @@ export class GameOverPhase extends BattlePhase { this.firstRibbons.push(getPokemonSpecies(pokemon.species.getRootSpeciesId(forStarter))); } } + + /** + * This function mirrors game-data.ts' getSessionSaveData() to update the session data to reflect any changes that occurred within the last wave + * This means that level ups, item usage, evolutions, etc. will all be accurately reflected. + * @returns {@linkCode SessionSaveData} an updated version of the wave's SessionSaveData that accurately reflects the events of the wave + */ + private getFinalSessionData(): SessionSaveData { + return { + seed: this.scene.seed, + playTime: this.scene.sessionPlayTime, + gameMode: this.scene.gameMode.modeId, + party: this.scene.getParty().map(p => new PokemonData(p)), + enemyParty: this.scene.getEnemyParty().map(p => new PokemonData(p)), + modifiers: this.scene.findModifiers(() => true).map(m => new PersistentModifierData(m, true)), + enemyModifiers: this.scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)), + arena: new ArenaData(this.scene.arena), + pokeballCounts: this.scene.pokeballCounts, + money: this.scene.money, + score: this.scene.score, + waveIndex: this.scene.currentBattle.waveIndex, + battleType: this.scene.currentBattle.battleType, + trainer: this.scene.currentBattle.battleType === BattleType.TRAINER ? new TrainerData(this.scene.currentBattle.trainer) : null, + gameVersion: this.scene.game.config.gameVersion, + timestamp: new Date().getTime(), + challenges: this.scene.gameMode.challenges.map(c => new ChallengeData(c)) + } as SessionSaveData; + } } + diff --git a/src/test/utils/gameManager.ts b/src/test/utils/gameManager.ts index cb3c547744b..d3c2652fcbe 100644 --- a/src/test/utils/gameManager.ts +++ b/src/test/utils/gameManager.ts @@ -1,6 +1,7 @@ import { updateUserInfo } from "#app/account"; import { BattlerIndex } from "#app/battle"; import BattleScene from "#app/battle-scene"; +import { BattleStyle } from "#app/enums/battle-style"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import Trainer from "#app/field/trainer"; import { GameModes, getGameMode } from "#app/game-mode"; @@ -170,6 +171,8 @@ export default class GameManager { } /** + * @deprecated Use `game.classicMode.startBattle()` or `game.dailyMode.startBattle()` instead + * * Transitions to the start of a battle. * @param species - Optional array of species to start the battle with. * @returns A promise that resolves when the battle is started. @@ -177,15 +180,17 @@ export default class GameManager { async startBattle(species?: Species[]) { await this.classicMode.runToSummon(species); - this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { - this.setMode(Mode.MESSAGE); - this.endPhase(); - }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase)); + if (this.scene.battleStyle === BattleStyle.SWITCH) { + this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.setMode(Mode.MESSAGE); + this.endPhase(); + }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase)); - this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { - this.setMode(Mode.MESSAGE); - this.endPhase(); - }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase)); + this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.setMode(Mode.MESSAGE); + this.endPhase(); + }, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase)); + } await this.phaseInterceptor.to(CommandPhase); console.log("==================[New Turn]=================="); diff --git a/src/test/utils/helpers/classicModeHelper.ts b/src/test/utils/helpers/classicModeHelper.ts index f41472303b4..55e995fc9dc 100644 --- a/src/test/utils/helpers/classicModeHelper.ts +++ b/src/test/utils/helpers/classicModeHelper.ts @@ -1,8 +1,11 @@ +import { BattleStyle } from "#app/enums/battle-style"; import { Species } from "#app/enums/species"; import { GameModes, getGameMode } from "#app/game-mode"; import overrides from "#app/overrides"; +import { CommandPhase } from "#app/phases/command-phase"; import { EncounterPhase } from "#app/phases/encounter-phase"; import { SelectStarterPhase } from "#app/phases/select-starter-phase"; +import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { Mode } from "#app/ui/ui"; import { generateStarter } from "../gameManagerUtils"; import { GameManagerHelper } from "./gameManagerHelper"; @@ -33,4 +36,28 @@ export class ClassicModeHelper extends GameManagerHelper { this.game.removeEnemyHeldItems(); } } + + /** + * Transitions to the start of a battle. + * @param species - Optional array of species to start the battle with. + * @returns A promise that resolves when the battle is started. + */ + async startBattle(species?: Species[]) { + await this.runToSummon(species); + + if (this.game.scene.battleStyle === BattleStyle.SWITCH) { + this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.game.setMode(Mode.MESSAGE); + this.game.endPhase(); + }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase)); + + this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.game.setMode(Mode.MESSAGE); + this.game.endPhase(); + }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase)); + } + + await this.game.phaseInterceptor.to(CommandPhase); + console.log("==================[New Turn]=================="); + } } diff --git a/src/test/utils/helpers/dailyModeHelper.ts b/src/test/utils/helpers/dailyModeHelper.ts index d68edf43647..e40fada8ac7 100644 --- a/src/test/utils/helpers/dailyModeHelper.ts +++ b/src/test/utils/helpers/dailyModeHelper.ts @@ -1,7 +1,10 @@ +import { BattleStyle } from "#app/enums/battle-style"; import { Button } from "#app/enums/buttons"; import overrides from "#app/overrides"; +import { CommandPhase } from "#app/phases/command-phase"; import { EncounterPhase } from "#app/phases/encounter-phase"; import { TitlePhase } from "#app/phases/title-phase"; +import { TurnInitPhase } from "#app/phases/turn-init-phase"; import SaveSlotSelectUiHandler from "#app/ui/save-slot-select-ui-handler"; import { Mode } from "#app/ui/ui"; import { GameManagerHelper } from "./gameManagerHelper"; @@ -34,4 +37,27 @@ export class DailyModeHelper extends GameManagerHelper { this.game.removeEnemyHeldItems(); } } + + /** + * Transitions to the start of a battle. + * @returns A promise that resolves when the battle is started. + */ + async startBattle() { + await this.runToSummon(); + + if (this.game.scene.battleStyle === BattleStyle.SWITCH) { + this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.game.setMode(Mode.MESSAGE); + this.game.endPhase(); + }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase)); + + this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => { + this.game.setMode(Mode.MESSAGE); + this.game.endPhase(); + }, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase)); + } + + await this.game.phaseInterceptor.to(CommandPhase); + console.log("==================[New Turn]=================="); + } } diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index e5def3a1961..ea7b798f2bf 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -825,10 +825,7 @@ export default class SummaryUiHandler extends UiHandler { biome: `${getBBCodeFrag(getBiomeName(this.pokemon?.metBiome!), TextStyle.SUMMARY_RED)}${closeFragment}`, // TODO: is this bang correct? level: `${getBBCodeFrag(this.pokemon?.metLevel.toString()!, TextStyle.SUMMARY_RED)}${closeFragment}`, // TODO: is this bang correct? }), - natureFragment: - i18next.exists(`pokemonSummary:natureFragment.${rawNature}`) ? - i18next.t(`pokemonSummary:natureFragment.${rawNature}`, { nature: nature }) : - nature, + natureFragment: i18next.t(`pokemonSummary:natureFragment.${rawNature}`, { nature: nature }) }); const memoText = addBBCodeTextObject(this.scene, 7, 113, String(memoString), TextStyle.WINDOW_ALT);