[P2] Fix binding, etc. not being removed when switching with Baton Pass (#4709)
* Fix binding, etc. not being removed when switching with Baton Pass * New baton pass test
This commit is contained in:
parent
958d79140c
commit
c7e9eaf435
|
@ -65,8 +65,9 @@ export class SwitchSummonPhase extends SummonPhase {
|
||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
if (this.switchType === SwitchType.SWITCH) {
|
|
||||||
(this.player ? this.scene.getEnemyField() : this.scene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
(this.player ? this.scene.getEnemyField() : this.scene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
||||||
|
|
||||||
|
if (this.switchType === SwitchType.SWITCH) {
|
||||||
const substitute = pokemon.getTag(SubstituteTag);
|
const substitute = pokemon.getTag(SubstituteTag);
|
||||||
if (substitute) {
|
if (substitute) {
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe("Moves - Baton Pass", () => {
|
||||||
.disableCrits();
|
.disableCrits();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("transfers all stat stages when player uses it", async() => {
|
it("transfers all stat stages when player uses it", async () => {
|
||||||
// arrange
|
// arrange
|
||||||
await game.classicMode.startBattle([ Species.RAICHU, Species.SHUCKLE ]);
|
await game.classicMode.startBattle([ Species.RAICHU, Species.SHUCKLE ]);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ describe("Moves - Baton Pass", () => {
|
||||||
]);
|
]);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
it("doesn't transfer effects that aren't transferrable", async() => {
|
it("doesn't transfer effects that aren't transferrable", async () => {
|
||||||
game.override.enemyMoveset([ Moves.SALT_CURE ]);
|
game.override.enemyMoveset([ Moves.SALT_CURE ]);
|
||||||
await game.classicMode.startBattle([ Species.PIKACHU, Species.FEEBAS ]);
|
await game.classicMode.startBattle([ Species.PIKACHU, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
@ -106,4 +106,28 @@ describe("Moves - Baton Pass", () => {
|
||||||
|
|
||||||
expect(player2.findTag((t) => t.tagType === BattlerTagType.SALT_CURED)).toBeUndefined();
|
expect(player2.findTag((t) => t.tagType === BattlerTagType.SALT_CURED)).toBeUndefined();
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
|
it("doesn't allow binding effects from the user to persist", async () => {
|
||||||
|
game.override.moveset([ Moves.FIRE_SPIN, Moves.BATON_PASS ]);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.FIRE_SPIN);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.move.forceHit();
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemy.getTag(BattlerTagType.FIRE_SPIN)).toBeDefined();
|
||||||
|
|
||||||
|
game.move.select(Moves.BATON_PASS);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
|
||||||
|
game.doSelectPartyPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemy.getTag(BattlerTagType.FIRE_SPIN)).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue