From 68d268db53d747495866ec7d5563f3b2ee07d85d Mon Sep 17 00:00:00 2001 From: cadi Date: Sat, 29 Jun 2024 00:54:05 +0900 Subject: [PATCH] just add swapping logic after calculation will fine --- src/battle-scene.ts | 5 ----- src/field/pokemon.ts | 9 +++------ src/phases.ts | 3 --- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 2f519268c8d..1b1d1fde83f 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -66,8 +66,6 @@ import { PlayerGender } from "#enums/player-gender"; import { Species } from "#enums/species"; import { UiTheme } from "#enums/ui-theme"; import { TimedEventManager } from "#app/timed-event-manager.js"; -import { BattlerTagType } from "#enums/battler-tag-type"; -import { Stat } from "./data/pokemon-stat"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; @@ -2393,9 +2391,6 @@ export default class BattleScene extends SceneBase { Promise.allSettled(party.map(p => { if (p.scene) { p.calculateStats(); - if (p.getTag(BattlerTagType.POWER_TRICK)) { - [p.stats[Stat.ATK], p.stats[Stat.DEF]] = [p.stats[Stat.DEF], p.stats[Stat.ATK]]; - } } return p.updateInfo(instant); })).then(() => resolve()); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 1f5eb8add6f..b01d3374062 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -754,6 +754,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } this.stats[s] = value; } + if (this.getTag(BattlerTagType.POWER_TRICK)) { + [this.stats[Stat.ATK], this.stats[Stat.DEF]] = [this.stats[Stat.DEF], this.stats[Stat.ATK]]; + } } getNature(): Nature { @@ -2287,9 +2290,6 @@ 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()); }); }); @@ -3302,9 +3302,6 @@ 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()); }); }; diff --git a/src/phases.ts b/src/phases.ts index 83d6f93ab73..263a1673671 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -4576,9 +4576,6 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase { this.scene.unshiftPhase(new EvolutionPhase(this.scene, pokemon as PlayerPokemon, evolution, this.lastLevel)); } } - if (pokemon.getTag(BattlerTagType.POWER_TRICK)) { - [pokemon.stats[Stat.ATK], pokemon.stats[Stat.DEF]] = [pokemon.stats[Stat.DEF], pokemon.stats[Stat.ATK]]; - } } }