From 32dda0a60384a4644b34b56d247592845338bf2b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 4 Jan 2024 19:56:26 -0500 Subject: [PATCH] Respect pokeball type on caught Pokemon --- src/battle-phases.ts | 12 ++++++------ src/pokemon.ts | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 2f650625d..cc649b682 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -795,13 +795,13 @@ export class SummonPhase extends PartyMemberPokemonPhase { } summon(): void { - const pokeball = this.scene.addFieldSprite(this.player ? 36 : 248, this.player ? 80 : 44, 'pb', 'pb'); + const pokemon = this.getPokemon(); + + const pokeball = this.scene.addFieldSprite(this.player ? 36 : 248, this.player ? 80 : 44, 'pb', getPokeballAtlasKey(pokemon.pokeball)); pokeball.setVisible(false); pokeball.setOrigin(0.5, 0.625); this.scene.field.add(pokeball); - const pokemon = this.getPokemon(); - if (this.fieldIndex === 1) pokemon.setFieldPosition(FieldPosition.RIGHT, 0); else { @@ -3022,7 +3022,7 @@ export class AttemptCapturePhase extends PokemonPhase { this.scene.playSound('pb_catch'); this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}`)); - const doShake = pokeballMultiplier > -1 ? () => { + const doShake = () => { let shakeCount = 0; const pbX = this.pokeball.x; const shakeCounter = this.scene.tweens.addCounter({ @@ -3057,7 +3057,7 @@ export class AttemptCapturePhase extends PokemonPhase { }, onComplete: () => this.catch() }); - } : () => this.catch(); + }; this.scene.time.delayedCall(250, () => doPokeballBounceAnim(this.scene, this.pokeball, 16, 72, 350, doShake)); } @@ -3121,7 +3121,7 @@ export class AttemptCapturePhase extends PokemonPhase { this.scene.field.remove(pokemon, true); }; const addToParty = () => { - const newPokemon = pokemon.addToParty(); + const newPokemon = pokemon.addToParty(this.pokeballType); const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false); if (this.scene.getParty().filter(p => p.isShiny()).length === 6) this.scene.validateAchv(achvs.SHINY_PARTY); diff --git a/src/pokemon.ts b/src/pokemon.ts index f8b15cb01..554f4d37d 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -2086,11 +2086,12 @@ export class EnemyPokemon extends Pokemon { return BattlerIndex.ENEMY + this.getFieldIndex(); } - addToParty() { + addToParty(pokeballType: PokeballType) { const party = this.scene.getParty(); let ret: PlayerPokemon = null; if (party.length < 6) { + this.pokeball = pokeballType; const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, null, this); party.push(newPokemon); ret = newPokemon;