From 8a5a8ebd2c532e65ba3d1aa756fe7c9b49348717 Mon Sep 17 00:00:00 2001 From: cadi Date: Fri, 28 Jun 2024 18:38:03 +0900 Subject: [PATCH] Power Trick Interaction with `transfer summon` & `changeForm` --- src/field/pokemon.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 58f44dc8b3d..08f4348bace 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2247,6 +2247,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (this instanceof PlayerPokemon && source.summonData.battleStats.find(bs => bs === 6)) { this.scene.validateAchv(achvs.TRANSFER_MAX_BATTLE_STAT); } + + if (this.getTag(BattlerTagType.POWER_TRICK)) { + [this.stats[Stat.ATK], this.stats[Stat.DEF]] = [this.stats[Stat.DEF], this.stats[Stat.ATK]]; + } + this.updateInfo(); } @@ -2292,6 +2297,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.loadAssets().then(() => { this.calculateStats(); this.scene.updateModifiers(this.isPlayer(), true); + + if (this.getTag(BattlerTagType.POWER_TRICK)) { + [this.stats[Stat.ATK], this.stats[Stat.DEF]] = [this.stats[Stat.DEF], this.stats[Stat.ATK]]; + } + Promise.all([ this.updateInfo(), this.scene.updateFieldScale() ]).then(() => resolve()); }); }); @@ -3303,6 +3313,11 @@ export class PlayerPokemon extends Pokemon { this.loadAssets().then(() => { this.calculateStats(); this.scene.updateModifiers(true, true); + + if (this.getTag(BattlerTagType.POWER_TRICK)) { + [this.stats[Stat.ATK], this.stats[Stat.DEF]] = [this.stats[Stat.DEF], this.stats[Stat.ATK]]; + } + this.updateInfo(true).then(() => resolve()); }); };