Forcing first tera type always

This commit is contained in:
Wlowscha 2025-08-16 22:13:47 +02:00
parent 4aa6699e8f
commit f749ab8f63
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -27,6 +27,7 @@ import { AbilityAttr } from "#enums/ability-attr";
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { ChallengeType } from "#enums/challenge-type"; import { ChallengeType } from "#enums/challenge-type";
import { Challenges } from "#enums/challenges";
import { Device } from "#enums/devices"; import { Device } from "#enums/devices";
import { DexAttr } from "#enums/dex-attr"; import { DexAttr } from "#enums/dex-attr";
import { DropDownColumn } from "#enums/drop-down-column"; import { DropDownColumn } from "#enums/drop-down-column";
@ -403,6 +404,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
private originalStarterPreferences: StarterPreferences; private originalStarterPreferences: StarterPreferences;
protected blockInput = false; protected blockInput = false;
private allowTera: boolean;
constructor() { constructor() {
super(UiMode.STARTER_SELECT); super(UiMode.STARTER_SELECT);
@ -1130,6 +1132,8 @@ export class StarterSelectUiHandler extends MessageUiHandler {
this.moveInfoOverlay.clear(); // clear this when removing a menu; the cancel button doesn't seem to trigger this automatically on controllers this.moveInfoOverlay.clear(); // clear this when removing a menu; the cancel button doesn't seem to trigger this automatically on controllers
this.pokerusSpecies = getPokerusStarters(); this.pokerusSpecies = getPokerusStarters();
this.allowTera = globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id);
if (args.length >= 1 && args[0] instanceof Function) { if (args.length >= 1 && args[0] instanceof Function) {
super.show(args); super.show(args);
this.starterSelectCallback = args[0] as StarterSelectCallback; this.starterSelectCallback = args[0] as StarterSelectCallback;
@ -1271,6 +1275,12 @@ export class StarterSelectUiHandler extends MessageUiHandler {
} }
} }
if (starterAttributes.tera !== undefined) {
if (globalScene.gameMode.hasChallenge(Challenges.FRESH_START)) {
starterAttributes.tera = species.type1;
}
}
return starterAttributes; return starterAttributes;
} }
@ -3903,8 +3913,9 @@ export class StarterSelectUiHandler extends MessageUiHandler {
this.canCycleNature = globalScene.gameData.getNaturesForAttr(dexEntry.natureAttr).length > 1; this.canCycleNature = globalScene.gameData.getNaturesForAttr(dexEntry.natureAttr).length > 1;
this.canCycleTera = this.canCycleTera =
!this.statsMode && !this.statsMode &&
globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id) && this.allowTera &&
!isNullOrUndefined(getPokemonSpeciesForm(species.speciesId, formIndex ?? 0).type2); !isNullOrUndefined(getPokemonSpeciesForm(species.speciesId, formIndex ?? 0).type2) &&
!globalScene.gameMode.hasChallenge(Challenges.FRESH_START);
} }
if (dexEntry.caughtAttr && species.malePercent !== null) { if (dexEntry.caughtAttr && species.malePercent !== null) {
@ -4053,9 +4064,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
this.setTypeIcons(speciesForm.type1, speciesForm.type2); this.setTypeIcons(speciesForm.type1, speciesForm.type2);
this.teraIcon.setFrame(PokemonType[this.teraCursor].toLowerCase()); this.teraIcon.setFrame(PokemonType[this.teraCursor].toLowerCase());
this.teraIcon.setVisible( this.teraIcon.setVisible(!this.statsMode && this.allowTera);
!this.statsMode && globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id),
);
} else { } else {
this.pokemonAbilityText.setText(""); this.pokemonAbilityText.setText("");
this.pokemonPassiveText.setText(""); this.pokemonPassiveText.setText("");
@ -4497,7 +4506,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
this.pokemonSprite.setVisible(!!this.speciesStarterDexEntry?.caughtAttr); this.pokemonSprite.setVisible(!!this.speciesStarterDexEntry?.caughtAttr);
//@ts-expect-error //@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!? this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!?
this.teraIcon.setVisible(globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id)); this.teraIcon.setVisible(this.allowTera);
const props = globalScene.gameData.getSpeciesDexAttrProps( const props = globalScene.gameData.getSpeciesDexAttrProps(
this.lastSpecies, this.lastSpecies,
this.getCurrentDexProps(this.lastSpecies.speciesId), this.getCurrentDexProps(this.lastSpecies.speciesId),
@ -4505,8 +4514,9 @@ export class StarterSelectUiHandler extends MessageUiHandler {
const formIndex = props.formIndex; const formIndex = props.formIndex;
this.canCycleTera = this.canCycleTera =
!this.statsMode && !this.statsMode &&
globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id) && this.allowTera &&
!isNullOrUndefined(getPokemonSpeciesForm(this.lastSpecies.speciesId, formIndex ?? 0).type2); !isNullOrUndefined(getPokemonSpeciesForm(this.lastSpecies.speciesId, formIndex ?? 0).type2) &&
!globalScene.gameMode.hasChallenge(Challenges.FRESH_START);
this.updateInstructions(); this.updateInstructions();
} }
} }