mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
fix: new pokemon not being hidden initially
When switching the active pokemon (slot 1) with the new one, the new ones visibility is `true` causing a crash with animation frames
This commit is contained in:
parent
03bedac283
commit
a8528e6705
@ -4899,6 +4899,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new pokemon to the player's party (at `slotIndex` if set).
|
* Add a new pokemon to the player's party (at `slotIndex` if set).
|
||||||
|
* If the first slot is replaced, the new pokemons visibility will be set to `false`.
|
||||||
* @param pokeballType the type of pokeball the pokemon was caught with
|
* @param pokeballType the type of pokeball the pokemon was caught with
|
||||||
* @param slotIndex an optional index to place the pokemon in the party
|
* @param slotIndex an optional index to place the pokemon in the party
|
||||||
* @returns the pokemon that was added or null if the pokemon could not be added
|
* @returns the pokemon that was added or null if the pokemon could not be added
|
||||||
@ -4916,6 +4917,9 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this);
|
const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this);
|
||||||
|
|
||||||
if (Utils.isBetween(slotIndex, 0, PLAYER_PARTY_MAX_SIZE - 1)) {
|
if (Utils.isBetween(slotIndex, 0, PLAYER_PARTY_MAX_SIZE - 1)) {
|
||||||
|
if (slotIndex === 0) {
|
||||||
|
newPokemon.setVisible(false); // Hide if replaced with first pokemon
|
||||||
|
}
|
||||||
party.splice(slotIndex, 0, newPokemon);
|
party.splice(slotIndex, 0, newPokemon);
|
||||||
} else {
|
} else {
|
||||||
party.push(newPokemon);
|
party.push(newPokemon);
|
||||||
|
Loading…
Reference in New Issue
Block a user