Fix psycho shift interaction causing buggy behaviour
This commit is contained in:
parent
7067187532
commit
aadc86dd19
|
@ -1678,7 +1678,7 @@ export class SynchronizeStatusAbAttr extends PostSetStatusAbAttr {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (sourcePokemon && syncStatuses.has(effect)) {
|
if (sourcePokemon && syncStatuses.has(effect)) {
|
||||||
return sourcePokemon.trySetStatus(effect, true);
|
return sourcePokemon.trySetStatus(effect, true, pokemon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -4307,7 +4307,7 @@ export function initAbilities() {
|
||||||
new Ability(Abilities.SYNCHRONIZE, 3)
|
new Ability(Abilities.SYNCHRONIZE, 3)
|
||||||
.attr(SyncEncounterNatureAbAttr)
|
.attr(SyncEncounterNatureAbAttr)
|
||||||
.attr(SynchronizeStatusAbAttr)
|
.attr(SynchronizeStatusAbAttr)
|
||||||
.partial(), // interaction with psycho shift needs work
|
.partial(), // interaction with psycho shift needs work, keeping to old Gen interaction for now
|
||||||
new Ability(Abilities.CLEAR_BODY, 3)
|
new Ability(Abilities.CLEAR_BODY, 3)
|
||||||
.attr(ProtectStatAbAttr)
|
.attr(ProtectStatAbAttr)
|
||||||
.ignorable(),
|
.ignorable(),
|
||||||
|
|
|
@ -1761,13 +1761,14 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) {
|
if (!target.status || (target.status.effect === statusToApply && move.chance < 0)) {
|
||||||
const statusAfflictResult = target.trySetStatus(statusToApply, true, user);
|
const canSetStatus = target.canSetStatus(statusToApply, true, false, user);
|
||||||
if (statusAfflictResult) {
|
if (canSetStatus) {
|
||||||
user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect)));
|
user.scene.queueMessage(getPokemonMessage(user, getStatusEffectHealText(user.status.effect)));
|
||||||
user.resetStatus();
|
user.resetStatus();
|
||||||
user.updateInfo();
|
user.updateInfo();
|
||||||
|
target.trySetStatus(statusToApply, true, user);
|
||||||
}
|
}
|
||||||
return statusAfflictResult;
|
return canSetStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -209,4 +209,29 @@ describe("Abilities - Synchronize", () => {
|
||||||
expect(game.scene.getEnemyParty()[0].status?.effect).toBe(undefined);
|
expect(game.scene.getEnemyParty()[0].status?.effect).toBe(undefined);
|
||||||
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
||||||
}, 20000);
|
}, 20000);
|
||||||
|
|
||||||
|
it("should activate with Psycho Shift after the move clears the status", async () => {
|
||||||
|
// Arrange
|
||||||
|
const moveToUse = Moves.PSYCHO_SHIFT;
|
||||||
|
|
||||||
|
// Starter mocks
|
||||||
|
vi.spyOn(overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.HOOTHOOT);
|
||||||
|
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]);
|
||||||
|
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.KEEN_EYE);
|
||||||
|
vi.spyOn(overrides, "STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.PARALYSIS);
|
||||||
|
|
||||||
|
// 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(StatusEffect.PARALYSIS); // keeping old gen < V impl for now since it's buggy otherwise
|
||||||
|
expect(game.scene.getEnemyParty()[0].status?.effect).toBe(StatusEffect.PARALYSIS);
|
||||||
|
expect(game.phaseInterceptor.log).toContain("ShowAbilityPhase");
|
||||||
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue