Fix merge issues

This commit is contained in:
NightKev 2024-09-05 18:41:41 -07:00
parent c4ecd12faa
commit 0d71b7008a
3 changed files with 13 additions and 9 deletions

View File

@ -4053,8 +4053,10 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
export class PreventPostFaintContactDamageAbAttr extends AbAttr {
showAbility: boolean = false;
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
cancelled.value = true;
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder | null, args: any[]): boolean | Promise<boolean> {
if (cancelled) {
cancelled.value = true;
}
return true;
}
}
@ -4131,9 +4133,11 @@ export class FieldPreventMovesAbAttr extends AbAttr {
}
/** @param args See {@linkcode FieldPreventMovesAbAttr}. */
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder | null, args: any[]): boolean | Promise<boolean> {
if (this.preventedMoves.includes((args[0] as Move).id)) {
cancelled.value = true;
if (cancelled) {
cancelled.value = true;
}
return true;
}

View File

@ -1,6 +1,6 @@
import BattleScene from "#app/battle-scene.js";
import { BattlerIndex } from "#app/battle.js";
import { applyPreAttackAbAttrs, AddSecondStrikeAbAttr, IgnoreMoveEffectsAbAttr, applyPostDefendAbAttrs, PostDefendAbAttr, applyPostAttackAbAttrs, PostAttackAbAttr, MaxMultiHitAbAttr, AlwaysHitAbAttr } from "#app/data/ability.js";
import { applyPreAttackAbAttrs, AddSecondStrikeAbAttr, IgnoreMoveEffectsAbAttr, applyPostDefendAbAttrs, PostDefendAbAttr, applyPostAttackAbAttrs, PostAttackAbAttr, MaxMultiHitAbAttr, AlwaysHitAbAttr, applyAbAttrs, FieldPreventMovesAbAttr } from "#app/data/ability.js";
import { ArenaTagSide, ConditionalProtectTag } from "#app/data/arena-tag.js";
import { MoveAnim } from "#app/data/battle-anims.js";
import { BattlerTagLapseType, ProtectedTag, SemiInvulnerableTag } from "#app/data/battler-tags.js";
@ -117,7 +117,7 @@ export class MoveEffectPhase extends PokemonPhase {
}
const prevented = new Utils.BooleanHolder(false);
this.scene.getField(true).forEach(p => applyAbAttrs(FieldPreventMovesAbAttr, p, prevented, move, user));
this.scene.getField(true).forEach(p => applyAbAttrs(FieldPreventMovesAbAttr, p, prevented, false, move, user));
if (prevented.value) {
moveHistoryEntry.result = MoveResult.FAIL;
return this.end();

View File

@ -42,11 +42,11 @@ describe("Abilities - Aftermath", () => {
game.move.select(Moves.TACKLE);
await game.phaseInterceptor.to("TurnEndPhase");
await game.phaseInterceptor.to("VictoryPhase");
expect(game.phaseInterceptor.log).toContain("FaintPhase");
expect(game.phaseInterceptor.log).toContain("ShowAbilityPhase");
expect(player.hp).toBeCloseTo(Math.floor(player.getMaxHp() * 0.75));
expect(player.hp).toBe(Math.ceil(player.getMaxHp() * 0.75));
}, TIMEOUT);
it("does not activate on non-contact moves", async () => {
@ -59,7 +59,7 @@ describe("Abilities - Aftermath", () => {
game.move.select(Moves.WATER_GUN);
await game.phaseInterceptor.to("TurnEndPhase");
await game.phaseInterceptor.to("VictoryPhase");
expect(game.phaseInterceptor.log).toContain("FaintPhase");
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");