import Signal from "@rbxts/sleitnick-signal"; import type { AffectableHumanoidProps, Character, DamageContainer } from "./character"; import type { UnknownSkill } from "./skill"; import { type DeepReadonly } from "./utility"; export interface StatusData { className: string; state: _internal_StatusEffectState; endTimestamp?: number; metadata?: unknown; humanoidData?: HumanoidData; constructorArgs: unknown[]; } /** @hidden */ interface _internal_StatusEffectState extends StatusEffectState { _timerEndTimestamp?: number; _startTimestamp?: number; } export interface StatusEffectState { IsActive: boolean; } export interface HumanoidData { Props: Partial<{ [P in keyof AffectableHumanoidProps]: [ AffectableHumanoidProps[P], "Set" | "Increment" ]; }>; Priority: number; } type StatusEffectConstructor = new (...args: [Character, ...constructorArgs: any[]]) => UnknownStatus; type ReadonlyState = DeepReadonly; export type AnyStatus = StatusEffect; export type UnknownStatus = StatusEffect; /** * A status effect class. */ export declare class StatusEffect { private readonly _internal_janitor; protected readonly Janitor: import("@rbxts/janitor").Janitor; readonly MetadataChanged: Signal<[NewMeta: Metadata | undefined, PreviousMeta: Metadata | undefined]>; readonly StateChanged: Signal<[State: { readonly IsActive: boolean; }, PreviousState: { readonly IsActive: boolean; }]>; readonly HumanoidDataChanged: Signal<[Data: HumanoidData | undefined, PreviousData: HumanoidData | undefined]>; readonly Destroyed: Signal<[]>; readonly Started: Signal<[]>; readonly Ended: Signal<[]>; readonly Player?: Player; readonly Name: string; /** * A number value. Determines the position in which `HandleDamage()` is applied. * The higher the value, the later it applies. */ protected DamageModificationPriority: number; readonly Character: Character; DestroyOnEnd: boolean; private _internal_state; private _internal_metadata?; private _internal_humanoidData?; private _internal_executionThread?; private _internal_isDestroyed; private readonly _internal_timer; private readonly _internal_id; protected readonly ConstructorArguments: ConstructorArguments; constructor(Character: Character, ...Args: ConstructorArguments); /** * Starts the status effect. */ Start(Time?: number): void; GetEndTimestamp(): number | undefined; /** * Ends the status effect. */ Stop(): void; /** * Pauses the status effect. */ Pause(): void; /** * Resumes the status effect. */ Resume(): void; /** * Ends the status effect. */ End(): void; GetStartTimestamp(): number | undefined; /** * Sets the humanoid data that is going to be applied to the character while the status effect is active. */ SetHumanoidData(Props: HumanoidData["Props"], Priority?: number): void; /** * Clears the humanoid data. */ ClearHumanoidData(): void; /** * Clears the metadata */ protected ClearMetadata(): void; /** * Sets the state of the status effect. */ protected setState(Patch: Partial<_internal_StatusEffectState>): void; /** * Sets the metadata of the status effect. */ protected SetMetadata(NewMeta: Metadata): void; /** * Gets the state of the status effect * */ GetState(): ReadonlyState; /** * Gets the humanoid data of the status effect */ GetHumanoidData(): HumanoidData | undefined; /** * Gets the metadata of the status effect */ GetMetadata(): Metadata | undefined; /** * Returns true if the status effect is destroyed */ IsDestroyed(): boolean; /** * A method that is used to modify damage applied to a character */ HandleDamage(Modified: number, Original: number, Source: UnknownSkill | UnknownStatus | undefined): number; /** * Returns the value of DamageMoficicationPriority. */ GetModificationPriority(): number; /** * Destroys the status effect and removes it from the character */ Destroy(): void; /** * A shortcut for creating a damage container */ protected CreateDamageContainer(Damage: number): DamageContainer; private _internal_stateDependentCallbacks; private _internal_startReplicationClient; /** Called after class gets instantiated (both client and server) */ protected OnConstruct(...Args: ConstructorArguments): void; /** Called after class gets instantiated on client */ protected OnConstructClient(...Args: ConstructorArguments): void; /** Called after class gets instantiated on server */ protected OnConstructServer(...Args: ConstructorArguments): void; protected OnStartServer(): void; protected OnStartClient(): void; protected OnEndClient(): void; protected OnEndServer(): void; } export declare function StatusEffectDecorator(Constructor: T): void; export declare function GetRegisteredStatusEffectConstructor(Name: string): StatusEffectConstructor | undefined; export {};