Using leaveField(true) so that stat changes are correctly applied by Baton Pass

This commit is contained in:
Wlowscha 2025-02-20 09:47:21 +01:00
parent abee0a696f
commit f2d7bcb29f
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -146,7 +146,8 @@ export class SwitchSummonPhase extends SummonPhase {
} else {
switchedInPokemon.resetSummonData();
}
this.lastPokemon.leaveField();
// We cannot clear stat changes yet because they are applied after the new mon is summoned
this.lastPokemon.leaveField(this.switchType === SwitchType.BATON_PASS || this.switchType === SwitchType.SHED_TAIL ? false : true);
this.summon();
};
if (this.player) {
@ -184,11 +185,13 @@ export class SwitchSummonPhase extends SummonPhase {
if (this.switchType === SwitchType.BATON_PASS && pokemon) {
pokemon.transferSummon(this.lastPokemon);
this.lastPokemon.resetSummonData();
} else if (this.switchType === SwitchType.SHED_TAIL && pokemon) {
const subTag = this.lastPokemon.getTag(SubstituteTag);
if (subTag) {
pokemon.summonData.tags.push(subTag);
}
this.lastPokemon.resetSummonData();
}
if (this.switchType !== SwitchType.INITIAL_SWITCH) {