[Ability] fix damage taken by disguise (#2601)
This commit is contained in:
parent
eae2d0a144
commit
fd08983181
|
@ -333,7 +333,7 @@ export class PreDefendMoveDamageToOneAbAttr extends ReceivedMoveDamageMultiplier
|
||||||
|
|
||||||
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
if (this.condition(pokemon, attacker, move)) {
|
if (this.condition(pokemon, attacker, move)) {
|
||||||
(args[0] as Utils.NumberHolder).value = 1;
|
(args[0] as Utils.NumberHolder).value = Math.floor(pokemon.getMaxHp() / 8);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,4 +64,35 @@ describe("Abilities - DISGUISE", () => {
|
||||||
},
|
},
|
||||||
TIMEOUT
|
TIMEOUT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test(
|
||||||
|
"damage taken should be equal to 1/8 of its maximum HP, rounded down",
|
||||||
|
async () => {
|
||||||
|
const baseForm = 0,
|
||||||
|
bustedForm = 1;
|
||||||
|
|
||||||
|
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]);
|
||||||
|
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(20);
|
||||||
|
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20);
|
||||||
|
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP);
|
||||||
|
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({
|
||||||
|
[Species.MIMIKYU]: baseForm,
|
||||||
|
});
|
||||||
|
|
||||||
|
await game.startBattle([Species.MIMIKYU]);
|
||||||
|
|
||||||
|
const mimikyu = game.scene.getPlayerPokemon();
|
||||||
|
const damage = (Math.floor(mimikyu.getMaxHp()/8));
|
||||||
|
|
||||||
|
expect(mimikyu).not.toBe(undefined);
|
||||||
|
expect(mimikyu.formIndex).toBe(baseForm);
|
||||||
|
|
||||||
|
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
||||||
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
|
||||||
|
expect(mimikyu.formIndex).toBe(bustedForm);
|
||||||
|
expect(game.scene.getEnemyPokemon().turnData.currDamageDealt).toBe(damage);
|
||||||
|
},
|
||||||
|
TIMEOUT
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue