warscript
Version:
A typescript library for Warcraft III using Warpack.
111 lines (110 loc) • 4.08 kB
TypeScript
/// <reference types="warpack-types/warpack" />
/** @noSelfInFile */
import { ObjectDefinition } from "./object";
import { Unit } from "../core/types/unit";
type Art = {
model: string;
attachmentPoint: string;
};
type ArtInput = string | Art;
export declare class BuffDefinition extends ObjectDefinition {
readonly id: string;
constructor(object: WarObject);
set name(v: string);
get name(): string;
set tooltip(v: string);
get tooltip(): string;
set tooltipExtended(v: string);
get tooltipExtended(): string;
set icon(v: string);
get icon(): string;
set effectArt(v: string);
get effectArt(): string;
set specialArt(v: ArtInput);
get specialArt(): Art;
set targetArt(v: ArtInput | [
...([
ArtInput,
...([
ArtInput,
...([
ArtInput,
...([
ArtInput,
...([ArtInput, ...([ArtInput] | [])] | [])
] | [])
] | [])
] | [])
] | [])
]);
get targetArt(): [
...([
Art,
...([Art, ...([Art, ...([Art, ...([Art, ...([Art] | [])] | [])] | [])] | [])] | [])
] | [])
];
set missileArt(v: string);
get missileArt(): string;
set missileArc(v: number);
get missileArc(): number;
set missileSpeed(v: number);
get missileSpeed(): number;
set missileHoming(v: boolean);
get missileHoming(): boolean;
set sound(v: string);
get sound(): string;
set soundLooping(v: string);
get soundLooping(): string;
static create<T extends BuffDefinition>(this: new (object: WarObject) => T, baseId: string | number, id?: string | number): T;
static of<T extends BuffDefinition>(this: new (object: WarObject) => T, id: string | number): T;
protected static createDerived<T extends BuffDefinition>(this: void, derived: new (object: WarObject) => T, baseId: string | number, id?: string | number): T;
}
export type BuffPresetData = {
readonly buffId: number;
readonly abilityId: number;
readonly positive: boolean;
readonly magic: boolean;
};
export declare class BuffPreset extends BuffDefinition implements Compiletime<BuffPresetData> {
private _positive;
private _magic;
private _visible;
levels: number;
constructor(object: WarObject);
private createInnerFireAbility;
private createCrippleAbility;
private createHealingSaveAbility;
private createSlowPoisonAbility;
compiletime(): BuffPresetData;
set positive(v: boolean);
get positive(): boolean;
set magic(v: boolean);
get magic(): boolean;
set visible(v: boolean);
get visible(): boolean;
static create<T extends BuffDefinition>(this: new (object: WarObject) => T, baseId?: string | number, id?: string | number): T;
}
type NonConstructorKeys<T> = {
[P in keyof T]: T[P] extends new () => any ? never : P;
}[keyof T];
type OmitConstructor<T> = Pick<T, NonConstructorKeys<T>>;
type BuffClass<T extends Buff, Args extends any[] = any[]> = OmitConstructor<typeof Buff> & (new (...args: Args) => T);
export declare abstract class Buff implements Destroyable {
readonly unit: Unit;
readonly source: Unit;
readonly duration: number;
readonly level: number;
private readonly preset?;
private readonly handle?;
private destroyed?;
private timer?;
constructor(unit: Unit, source?: Unit, duration?: number, level?: number, preset?: BuffPresetData | undefined);
static apply<T extends Buff, Args extends any[]>(this: BuffClass<T, Args>, ...args: Args): T | undefined;
static getInstance<T extends Buff>(this: BuffClass<T>, unit: Unit): T | undefined;
static isApplied<T extends Buff>(this: BuffClass<T>, unit: Unit): boolean;
static ifApplied<T extends Buff>(this: BuffClass<T>, unit: Unit, action: (buff: T) => void): void;
destroy(): void;
protected onDispel(source: Unit | undefined): void;
protected onExpire(): void;
}
export {};