From 29aa5259261a7ad38e4531f8d9ba6d7ba69ce0e3 Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Wed, 19 Feb 2025 03:33:48 +1100 Subject: [PATCH] Make tera type actually apply in run --- src/phases/select-starter-phase.ts | 7 +++++++ src/ui/starter-select-ui-handler.ts | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/phases/select-starter-phase.ts b/src/phases/select-starter-phase.ts index 79012901a3a..b7ad15533a6 100644 --- a/src/phases/select-starter-phase.ts +++ b/src/phases/select-starter-phase.ts @@ -12,6 +12,7 @@ import type { Starter } from "#app/ui/starter-select-ui-handler"; import { Mode } from "#app/ui/ui"; import type { Species } from "#enums/species"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; +import * as Utils from "../utils"; export class SelectStarterPhase extends Phase { @@ -79,6 +80,12 @@ export class SelectStarterPhase extends Phase { starterPokemon.nickname = starter.nickname; } + if (!Utils.isNullOrUndefined(starter.teraType)) { + starterPokemon.teraType = starter.teraType; + } else { + starterPokemon.teraType = starterPokemon.species.type1; + } + if (globalScene.gameMode.isSplicedOnly || Overrides.STARTER_FUSION_OVERRIDE) { starterPokemon.generateFusionSpecies(true); } diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 5012314b5b3..9f9a83bc485 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -70,6 +70,7 @@ export interface Starter { moveset?: StarterMoveset; pokerus: boolean; nickname?: string; + teraType?: Type; } interface LanguageSetting { @@ -3220,7 +3221,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.dexAttrCursor |= globalScene.gameData.getFormAttr(formIndex !== undefined ? formIndex : (formIndex = oldProps!.formIndex)); // TODO: is this bang correct? this.abilityCursor = abilityIndex !== undefined ? abilityIndex : (abilityIndex = oldAbilityIndex); this.natureCursor = natureIndex !== undefined ? natureIndex : (natureIndex = oldNatureIndex); - this.teraCursor = teraType !== undefined ? teraType : (teraType = species.type1); + this.teraCursor = !Utils.isNullOrUndefined(teraType) ? teraType : (teraType = species.type1); const [ isInParty, partyIndex ]: [boolean, number] = this.isInParty(species); // we use this to firstly check if the pokemon is in the party, and if so, to get the party index in order to update the icon image if (isInParty) { this.updatePartyIcon(species, partyIndex); @@ -3751,7 +3752,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { abilityIndex: thisObj.starterAbilityIndexes[i], passive: !(globalScene.gameData.starterData[starterSpecies.speciesId].passiveAttr ^ (PassiveAttr.ENABLED | PassiveAttr.UNLOCKED)), nature: thisObj.starterNatures[i] as Nature, - tera: thisObj.starterTeras[i] as Type, + teraType: thisObj.starterTeras[i] as Type, moveset: thisObj.starterMovesets[i], pokerus: thisObj.pokerusSpecies.includes(starterSpecies), nickname: thisObj.starterPreferences[starterSpecies.speciesId]?.nickname,