From 134bf76d44391915be8fdf7e8674ddc4236d12ed Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Wed, 11 Jun 2025 11:28:18 -0400 Subject: [PATCH] Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/abilities/ability.ts | 4 ---- src/modifier/modifier.ts | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 5f4e505e15b..2efe3607b4f 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -102,10 +102,6 @@ export class Ability implements Localizable { this.attrs = []; this.conditions = []; - this.isSuppressable = true; - this.isCopiable = true; - this.isReplaceable = true; - this.localize(); } diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 1c82fc19d91..e11f2c07ce8 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -158,7 +158,15 @@ export abstract class Modifier { this.type = type; } - /** */ + /** + * Return whether this modifier is of the given class + * + * @remarks + * Used to avoid requiring the caller to have imported the specific modifier class, avoiding circular dependencies. + * + * @param modifier - The modifier to check against + * @returns Whether the modiifer is an instance of the given type + */ public is(modifier: T): this is ModifierInstanceMap[T] { const targetModifier = ModifierClassMap[modifier]; if (!targetModifier) { @@ -191,7 +199,9 @@ export abstract class PersistentModifier extends Modifier { public stackCount: number; public virtualStackCount: number; - /** */ + /** This field does not exist at runtime and must not be used. + * Its sole purpose is to ensure that typescript is able to properly narrow when the `is` method is called. + */ private declare _: never; constructor(type: ModifierType, stackCount = 1) {