diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f52e2a032..e3dc77dfb 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -84,6 +84,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { public fusionShiny: boolean; public fusionGender: Gender; + private summonDataPrimer: PokemonSummonData; + public summonData: PokemonSummonData; public battleData: PokemonBattleData; public battleSummonData: PokemonBattleSummonData; @@ -1659,6 +1661,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } } + primeSummonData(summonDataPrimer: PokemonSummonData): void { + this.summonDataPrimer = summonDataPrimer; + } + resetSummonData(): void { if (this.summonData?.speciesForm) { this.summonData.speciesForm = null; @@ -1668,6 +1674,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (!this.battleData) this.resetBattleData(); this.resetBattleSummonData(); + if (this.summonDataPrimer) { + for (let k of Object.keys(this.summonData)) { + if (this.summonDataPrimer[k]) + this.summonData[k] = this.summonDataPrimer[k]; + } + this.summonDataPrimer = null; + } } resetBattleData(): void { diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index c2dc3ce86..ac7bc6ce2 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -107,8 +107,11 @@ export default class PokemonData { toPokemon(scene: BattleScene, battleType?: BattleType, partyMemberIndex: integer = 0, double: boolean = false): Pokemon { const species = getPokemonSpecies(this.species); - if (this.player) - return scene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.ivs, this.nature, this); - return scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER ? !double || !(partyMemberIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER : TrainerSlot.NONE, this.boss, this); + const ret: Pokemon = this.player + ? scene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.ivs, this.nature, this) + : scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER ? !double || !(partyMemberIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER : TrainerSlot.NONE, this.boss, this); + if (this.summonData) + ret.primeSummonData(this.summonData); + return ret; } } \ No newline at end of file