Update doc comments and apply kev's suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Sirz Benjie 2025-03-29 22:56:27 -05:00
parent d6de20fc65
commit d367386da9
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
3 changed files with 10 additions and 12 deletions

View File

@ -3240,7 +3240,6 @@ export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
this.immuneEffects = immuneEffects; this.immuneEffects = immuneEffects;
} }
/** Determine whether the */
override canApplyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean { override canApplyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean {
return effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect); return effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect);
} }
@ -3307,7 +3306,7 @@ export class ConditionalUserFieldStatusEffectImmunityAbAttr extends UserFieldSta
* @param effect The status effect being applied * @param effect The status effect being applied
* @param cancelled Holds whether the status effect was cancelled by a prior effect * @param cancelled Holds whether the status effect was cancelled by a prior effect
* @param args `Args[0]` is the target of the status effect, `Args[1]` is the source. * @param args `Args[0]` is the target of the status effect, `Args[1]` is the source.
* @returns * @returns Whether the ability can be applied to cancel the status effect.
*/ */
override canApplyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: [Pokemon, Pokemon | null, ...any]): boolean { override canApplyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: [Pokemon, Pokemon | null, ...any]): boolean {
return (!cancelled.value && effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) && this.condition(args[0], args[1]); return (!cancelled.value && effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) && this.condition(args[0], args[1]);
@ -3441,13 +3440,13 @@ export class ConditionalUserFieldBattlerTagImmunityAbAttr extends UserFieldBattl
/** /**
* Determine whether the {@linkcode ConditionalUserFieldBattlerTagImmunityAbAttr} can be applied by passing the target pokemon to the condition. * Determine whether the {@linkcode ConditionalUserFieldBattlerTagImmunityAbAttr} can be applied by passing the target pokemon to the condition.
* @param pokemon * @param pokemon The pokemon owning the ability
* @param passive * @param passive unused
* @param simulated * @param simulated whether the ability is being simulated (unused)
* @param tag * @param tag The {@linkcode BattlerTag} being applied
* @param cancelled * @param cancelled Holds whether the tag was previously cancelled (unused)
* @param args * @param args Args[0] is the target that the tag is attempting to be applied to
* @returns * @returns Whether the ability can be used to cancel the battler tag
*/ */
override canApplyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: [Pokemon, ...any]): boolean { override canApplyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: [Pokemon, ...any]): boolean {
return super.canApplyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args) && this.condition(args[0]); return super.canApplyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args) && this.condition(args[0]);

View File

@ -12,7 +12,6 @@ import { StatusEffect } from "#enums/status-effect";
import type { BattlerIndex } from "#app/battle"; import type { BattlerIndex } from "#app/battle";
import { import {
BlockNonDirectDamageAbAttr, BlockNonDirectDamageAbAttr,
ConditionalUserFieldProtectStatAbAttr,
InfiltratorAbAttr, InfiltratorAbAttr,
PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr, PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr,
ProtectStatAbAttr, ProtectStatAbAttr,

View File

@ -76,8 +76,8 @@ describe("Abilities - Flower Veil", () => {
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
const user = game.scene.getPlayerPokemon()!; const user = game.scene.getPlayerPokemon()!;
expect(user.getTag(BattlerTagType.DROWSY)).toBeOneOf([false, undefined, null]); expect(user.getTag(BattlerTagType.DROWSY)).toBeFalsy();
expect(ally.getTag(BattlerTagType.DROWSY)).toBeOneOf([false, undefined, null]); expect(ally.getTag(BattlerTagType.DROWSY)).toBeFalsy();
}); });
it("should prevent status conditions from moves like Thunder Wave for a grass user and its grass allies", async () => { it("should prevent status conditions from moves like Thunder Wave for a grass user and its grass allies", async () => {