Fix usedTMs crash (#4132)
This commit is contained in:
parent
a30201f185
commit
16fc3a87b7
|
@ -3524,7 +3524,6 @@ export default interface Pokemon {
|
|||
|
||||
export class PlayerPokemon extends Pokemon {
|
||||
public compatibleTms: Moves[];
|
||||
public usedTms: Moves[];
|
||||
|
||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
||||
super(scene, 106, 148, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
|
||||
|
@ -3548,7 +3547,6 @@ export class PlayerPokemon extends Pokemon {
|
|||
}
|
||||
}
|
||||
this.generateCompatibleTms();
|
||||
this.usedTms = [];
|
||||
}
|
||||
|
||||
initBattleInfo(): void {
|
||||
|
|
|
@ -44,6 +44,9 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
if (emptyMoveIndex > -1) {
|
||||
pokemon.setMove(emptyMoveIndex, this.moveId);
|
||||
if (this.fromTM) {
|
||||
if (!pokemon.usedTMs) {
|
||||
pokemon.usedTMs = [];
|
||||
}
|
||||
pokemon.usedTMs.push(this.moveId);
|
||||
}
|
||||
initMoveAnim(this.scene, this.moveId).then(() => {
|
||||
|
@ -91,6 +94,9 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
this.scene.ui.showText(i18next.t("battle:learnMoveForgetSuccess", { pokemonName: getPokemonNameWithAffix(pokemon), moveName: pokemon.moveset[moveIndex]!.getName() }), null, () => { // TODO: is the bang correct?
|
||||
this.scene.ui.showText(i18next.t("battle:learnMoveAnd"), null, () => {
|
||||
if (this.fromTM) {
|
||||
if (!pokemon.usedTMs) {
|
||||
pokemon.usedTMs = [];
|
||||
}
|
||||
pokemon.usedTMs.push(this.moveId);
|
||||
}
|
||||
pokemon.setMove(moveIndex, Moves.NONE);
|
||||
|
|
Loading…
Reference in New Issue