From 3ed2c74f38e808c271f9c64d35e323ae0fb52232 Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:44:03 -0400 Subject: [PATCH] [Enhancement] Add Met Wave to Pokemon Data (#4271) Co-authored-by: Lugiad Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Co-authored-by: Chapybara-jp --- src/field/pokemon.ts | 6 ++++++ src/locales/de/pokemon-summary.json | 2 +- src/locales/en/pokemon-summary.json | 2 +- src/locales/es/pokemon-summary.json | 4 ++-- src/locales/fr/pokemon-summary.json | 2 +- src/locales/it/pokemon-summary.json | 4 ++-- src/locales/ja/pokemon-summary.json | 2 +- src/locales/ko/pokemon-summary.json | 2 +- src/locales/pt_BR/pokemon-summary.json | 2 +- src/locales/zh_TW/pokemon-summary.json | 2 +- src/system/pokemon-data.ts | 7 ++++--- src/ui/summary-ui-handler.ts | 1 + 12 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 9c8c1e6ce46..ed36bcfe4b3 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -95,6 +95,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { public metLevel: integer; public metBiome: Biome | -1; public metSpecies: Species; + public metWave: number; public luck: integer; public pauseEvolutions: boolean; public pokerus: boolean; @@ -194,6 +195,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.luck = dataSource.luck; this.metBiome = dataSource.metBiome; this.metSpecies = dataSource.metSpecies ?? (this.metBiome !== -1 ? this.species.speciesId : this.species.getRootSpeciesId(true)); + this.metWave = dataSource.metWave ?? (this.metBiome === -1 ? -1 : 0); this.pauseEvolutions = dataSource.pauseEvolutions; this.pokerus = !!dataSource.pokerus; this.evoCounter = dataSource.evoCounter ?? 0; @@ -240,6 +242,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.metLevel = level; this.metBiome = scene.currentBattle ? scene.arena.biomeType : -1; this.metSpecies = species.speciesId; + this.metWave = scene.currentBattle ? scene.currentBattle.waveIndex : -1; this.pokerus = false; if (level > 1) { @@ -4081,6 +4084,7 @@ export class PlayerPokemon extends Pokemon { newPokemon.metLevel = this.metLevel; newPokemon.metBiome = this.metBiome; newPokemon.metSpecies = this.metSpecies; + newPokemon.metWave = this.metWave; newPokemon.fusionSpecies = this.fusionSpecies; newPokemon.fusionFormIndex = this.fusionFormIndex; newPokemon.fusionAbilityIndex = this.fusionAbilityIndex; @@ -4088,6 +4092,7 @@ export class PlayerPokemon extends Pokemon { newPokemon.fusionVariant = this.fusionVariant; newPokemon.fusionGender = this.fusionGender; newPokemon.fusionLuck = this.fusionLuck; + newPokemon.usedTMs = this.usedTMs; this.scene.getParty().push(newPokemon); newPokemon.evolve((!isFusion ? newEvolution : new FusionSpeciesFormEvolution(this.id, newEvolution)), evoSpecies); @@ -4779,6 +4784,7 @@ export class EnemyPokemon extends Pokemon { this.pokeball = pokeballType; this.metLevel = this.level; this.metBiome = this.scene.arena.biomeType; + this.metWave = this.scene.currentBattle.waveIndex; this.metSpecies = this.species.speciesId; const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this); diff --git a/src/locales/de/pokemon-summary.json b/src/locales/de/pokemon-summary.json index 1790c6878b9..3104fc10151 100644 --- a/src/locales/de/pokemon-summary.json +++ b/src/locales/de/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Abbrechen", "memoString": "Wesen: {{natureFragment}}\n{{metFragment}}", "metFragment": { - "normal": "Herkunft: {{biome}}\nMit Lv. {{level}} erhalten.", + "normal": "Herkunft: {{biome}} - Welle {{wave}}\nMit Lv. {{level}} erhalten.", "apparently": "Herkunft: {{biome}}\nOffenbar mit Lv. {{level}} erhalten." }, "natureFragment": { diff --git a/src/locales/en/pokemon-summary.json b/src/locales/en/pokemon-summary.json index 80e0cdab010..458fad0efe0 100644 --- a/src/locales/en/pokemon-summary.json +++ b/src/locales/en/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Cancel", "memoString": "{{natureFragment}} nature,\n{{metFragment}}", "metFragment": { - "normal": "met at Lv{{level}},\n{{biome}}.", + "normal": "met at Lv{{level}},\n{{biome}}, Wave {{wave}}.", "apparently": "apparently met at Lv{{level}},\n{{biome}}." }, "natureFragment": { diff --git a/src/locales/es/pokemon-summary.json b/src/locales/es/pokemon-summary.json index e47335c8394..fe33c9418cc 100644 --- a/src/locales/es/pokemon-summary.json +++ b/src/locales/es/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Salir", "memoString": "Naturaleza {{natureFragment}},\n{{metFragment}}", "metFragment": { - "normal": "encontrado al Nv. {{level}},\n{{biome}}.", + "normal": "encontrado al Nv. {{level}},\n{{biome}}, Oleada {{wave}}.", "apparently": "aparentemente encontrado al Nv. {{level}},\n{{biome}}." } -} \ No newline at end of file +} diff --git a/src/locales/fr/pokemon-summary.json b/src/locales/fr/pokemon-summary.json index 01e712c8468..a038b3a51f9 100644 --- a/src/locales/fr/pokemon-summary.json +++ b/src/locales/fr/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Annuler", "memoString": "{{natureFragment}} de nature,\n{{metFragment}}", "metFragment": { - "normal": "rencontré au N.{{level}},\n{{biome}}.", + "normal": "rencontré au N.{{level}},\n{{biome}}, Vague {{wave}}.", "apparently": "apparemment rencontré au N.{{level}},\n{{biome}}." }, "natureFragment": { diff --git a/src/locales/it/pokemon-summary.json b/src/locales/it/pokemon-summary.json index f6c9290f783..81cd9a278b8 100644 --- a/src/locales/it/pokemon-summary.json +++ b/src/locales/it/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Annulla", "memoString": "Natura {{natureFragment}},\n{{metFragment}}", "metFragment": { - "normal": "incontrato al Lv.{{level}},\n{{biome}}.", + "normal": "incontrato al Lv.{{level}},\n{{biome}}, Onda {{wave}}.", "apparently": "apparentemente incontrato al Lv.{{level}},\n{{biome}}." } -} \ No newline at end of file +} diff --git a/src/locales/ja/pokemon-summary.json b/src/locales/ja/pokemon-summary.json index cf35befe6fd..9465bcd346d 100644 --- a/src/locales/ja/pokemon-summary.json +++ b/src/locales/ja/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "キャンセル", "memoString": "{{natureFragment}}な性格。\n{{metFragment}}", "metFragment": { - "normal": "{{biome}}で\nLv.{{level}}の時に出会った。", + "normal": "ラウンド{{wave}}に{{biome}}で\nLv.{{level}}の時に出会った。", "apparently": "{{biome}}で\nLv.{{level}}の時に出会ったようだ。" }, "natureFragment": { diff --git a/src/locales/ko/pokemon-summary.json b/src/locales/ko/pokemon-summary.json index d9119623662..ca4b7a22b65 100644 --- a/src/locales/ko/pokemon-summary.json +++ b/src/locales/ko/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "그만둔다", "memoString": "{{natureFragment}}.\n{{metFragment}}", "metFragment": { - "normal": "{{biome}}에서\n레벨 {{level}}일 때 만났다.", + "normal": "{{biome}}에서 웨이브{{wave}},\n레벨 {{level}}일 때 만났다.", "apparently": "{{biome}}에서\n레벨 {{level}}일 때 만난 것 같다." }, "natureFragment": { diff --git a/src/locales/pt_BR/pokemon-summary.json b/src/locales/pt_BR/pokemon-summary.json index 4c427dbac4f..14b736a0cf2 100644 --- a/src/locales/pt_BR/pokemon-summary.json +++ b/src/locales/pt_BR/pokemon-summary.json @@ -11,7 +11,7 @@ "cancel": "Cancelar", "memoString": "Natureza {{natureFragment}},\n{{metFragment}}", "metFragment": { - "normal": "encontrado no Nv.{{level}},\n{{biome}}.", + "normal": "encontrado no Nv.{{level}},\n{{biome}}, Onda {{wave}}.", "apparently": "aparentemente encontrado no Nv.{{level}},\n{{biome}}." }, "natureFragment": { diff --git a/src/locales/zh_TW/pokemon-summary.json b/src/locales/zh_TW/pokemon-summary.json index ddbbea63a3a..331330f5bdd 100644 --- a/src/locales/zh_TW/pokemon-summary.json +++ b/src/locales/zh_TW/pokemon-summary.json @@ -12,7 +12,7 @@ "memoString": "{{natureFragment}} 性格,\n{{metFragment}}", "metFragment": { - "normal": "met at Lv{{level}},\n{{biome}}.", + "normal": "met at Lv{{level}},\n{{biome}}, Wave {{wave}}.", "apparently": "命中注定般地相遇于Lv.{{level}},\n{{biome}}。" }, "natureFragment": { diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 5e6c0d93c8c..0fd90e448a1 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -38,8 +38,9 @@ export default class PokemonData { public status: Status | null; public friendship: integer; public metLevel: integer; - public metBiome: Biome | -1; + public metBiome: Biome | -1; // -1 for starters public metSpecies: Species; + public metWave: number; // 0 for unknown (previous saves), -1 for starters public luck: integer; public pauseEvolutions: boolean; public pokerus: boolean; @@ -90,14 +91,14 @@ export default class PokemonData { this.metLevel = source.metLevel || 5; this.metBiome = source.metBiome !== undefined ? source.metBiome : -1; this.metSpecies = source.metSpecies; + this.metWave = source.metWave ?? (this.metBiome === -1 ? -1 : 0); this.luck = source.luck !== undefined ? source.luck : (source.shiny ? (source.variant + 1) : 0); if (!forHistory) { this.pauseEvolutions = !!source.pauseEvolutions; + this.evoCounter = source.evoCounter ?? 0; } this.pokerus = !!source.pokerus; - this.evoCounter = source.evoCounter ?? 0; - this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies; this.fusionFormIndex = source.fusionFormIndex; this.fusionAbilityIndex = source.fusionAbilityIndex; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index d3796a096b9..0892bf8ab1b 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -824,6 +824,7 @@ export default class SummaryUiHandler extends UiHandler { metFragment: i18next.t(`pokemonSummary:metFragment.${this.pokemon?.metBiome === -1? "apparently": "normal"}`, { 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? + wave: `${getBBCodeFrag((this.pokemon?.metWave ? this.pokemon.metWave.toString()! : i18next.t("pokemonSummary:unknownTrainer")), TextStyle.SUMMARY_RED)}${closeFragment}`, }), natureFragment: i18next.t(`pokemonSummary:natureFragment.${rawNature}`, { nature: nature }) });