Respect pokeball type on caught Pokemon

pull/14/head
Flashfyre 2024-01-04 19:56:26 -05:00
parent 4776851bb8
commit 32dda0a603
2 changed files with 8 additions and 7 deletions

View File

@ -795,13 +795,13 @@ export class SummonPhase extends PartyMemberPokemonPhase {
} }
summon(): void { 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.setVisible(false);
pokeball.setOrigin(0.5, 0.625); pokeball.setOrigin(0.5, 0.625);
this.scene.field.add(pokeball); this.scene.field.add(pokeball);
const pokemon = this.getPokemon();
if (this.fieldIndex === 1) if (this.fieldIndex === 1)
pokemon.setFieldPosition(FieldPosition.RIGHT, 0); pokemon.setFieldPosition(FieldPosition.RIGHT, 0);
else { else {
@ -3022,7 +3022,7 @@ export class AttemptCapturePhase extends PokemonPhase {
this.scene.playSound('pb_catch'); this.scene.playSound('pb_catch');
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}`)); this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}`));
const doShake = pokeballMultiplier > -1 ? () => { const doShake = () => {
let shakeCount = 0; let shakeCount = 0;
const pbX = this.pokeball.x; const pbX = this.pokeball.x;
const shakeCounter = this.scene.tweens.addCounter({ const shakeCounter = this.scene.tweens.addCounter({
@ -3057,7 +3057,7 @@ export class AttemptCapturePhase extends PokemonPhase {
}, },
onComplete: () => this.catch() onComplete: () => this.catch()
}); });
} : () => this.catch(); };
this.scene.time.delayedCall(250, () => doPokeballBounceAnim(this.scene, this.pokeball, 16, 72, 350, doShake)); 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); this.scene.field.remove(pokemon, true);
}; };
const addToParty = () => { const addToParty = () => {
const newPokemon = pokemon.addToParty(); const newPokemon = pokemon.addToParty(this.pokeballType);
const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false); const modifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
if (this.scene.getParty().filter(p => p.isShiny()).length === 6) if (this.scene.getParty().filter(p => p.isShiny()).length === 6)
this.scene.validateAchv(achvs.SHINY_PARTY); this.scene.validateAchv(achvs.SHINY_PARTY);

View File

@ -2086,11 +2086,12 @@ export class EnemyPokemon extends Pokemon {
return BattlerIndex.ENEMY + this.getFieldIndex(); return BattlerIndex.ENEMY + this.getFieldIndex();
} }
addToParty() { addToParty(pokeballType: PokeballType) {
const party = this.scene.getParty(); const party = this.scene.getParty();
let ret: PlayerPokemon = null; let ret: PlayerPokemon = null;
if (party.length < 6) { 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); const newPokemon = new PlayerPokemon(this.scene, this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, null, this);
party.push(newPokemon); party.push(newPokemon);
ret = newPokemon; ret = newPokemon;