Update to show ability even if opponent pokemon does not get statused

This commit is contained in:
Yiling Kang 2024-07-01 13:31:38 -07:00
parent aadc86dd19
commit ec82686305
2 changed files with 26 additions and 1 deletions

View File

@ -1678,7 +1678,8 @@ export class SynchronizeStatusAbAttr extends PostSetStatusAbAttr {
]);
if (sourcePokemon && syncStatuses.has(effect)) {
return sourcePokemon.trySetStatus(effect, true, pokemon);
sourcePokemon.trySetStatus(effect, true, pokemon);
return true;
}
return false;

View File

@ -210,6 +210,30 @@ describe("Abilities - Synchronize", () => {
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
}, 20000);
it("shows ability even if it fails to set the status of the opponent Pokemon", async () => {
// Arrange
const moveToUse = Moves.THUNDER_WAVE;
// Starter mocks
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PIKACHU);
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]);
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STATIC);
// Act
await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, moveToUse));
await game.phaseInterceptor.to(MoveEffectPhase, false);
vi.spyOn(game.scene.getCurrentPhase() as MoveEffectPhase, "hitCheck").mockReturnValue(true);
await game.phaseInterceptor.to(TurnEndPhase);
// Assert
expect(game.scene.getParty()[0].status?.effect).toBe(undefined);
expect(game.scene.getEnemyParty()[0].status?.effect).toBe(StatusEffect.PARALYSIS);
expect(game.phaseInterceptor.log).toContain("ShowAbilityPhase");
}, 20000);
it("should activate with Psycho Shift after the move clears the status", async () => {
// Arrange
const moveToUse = Moves.PSYCHO_SHIFT;