just add swapping logic after calculation will fine

This commit is contained in:
cadi 2024-06-29 00:54:05 +09:00
parent 7cbcf6ee96
commit 68d268db53
3 changed files with 3 additions and 14 deletions

View File

@ -66,8 +66,6 @@ import { PlayerGender } from "#enums/player-gender";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { UiTheme } from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
import { TimedEventManager } from "#app/timed-event-manager.js"; 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"; 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 => { Promise.allSettled(party.map(p => {
if (p.scene) { if (p.scene) {
p.calculateStats(); 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); return p.updateInfo(instant);
})).then(() => resolve()); })).then(() => resolve());

View File

@ -754,6 +754,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.stats[s] = value; 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 { getNature(): Nature {
@ -2287,9 +2290,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.loadAssets().then(() => { this.loadAssets().then(() => {
this.calculateStats(); this.calculateStats();
this.scene.updateModifiers(this.isPlayer(), true); 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()); Promise.all([ this.updateInfo(), this.scene.updateFieldScale() ]).then(() => resolve());
}); });
}); });
@ -3302,9 +3302,6 @@ export class PlayerPokemon extends Pokemon {
this.loadAssets().then(() => { this.loadAssets().then(() => {
this.calculateStats(); this.calculateStats();
this.scene.updateModifiers(true, true); 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()); this.updateInfo(true).then(() => resolve());
}); });
}; };

View File

@ -4576,9 +4576,6 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
this.scene.unshiftPhase(new EvolutionPhase(this.scene, pokemon as PlayerPokemon, evolution, this.lastLevel)); 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]];
}
} }
} }