@zerospacegg/iolin
Version:
Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)
114 lines • 3.73 kB
TypeScript
/**
* Unit - RTS unit class for ZeroSpace units
* Ported from unit.pkl with functional constructor pattern
*/
import { Entity } from "./entity.js";
export declare const InfuseState: {
readonly none: 0;
readonly single: 1;
readonly double: 2;
};
export declare const ReanimateState: {
readonly none: 0;
readonly alive: 1;
readonly zombie: 2;
};
export type UnitType = "army" | "hero" | "coop-commander" | "harvester" | "builder" | "special" | "ultimate" | "merc" | "merc-topbar" | "mobile-merc-outpost";
/**
* RTS Unit class base - extends Entity with unit-specific properties
* Usage: new ArmyUnit("Stinger", (unit) => { unit.hp = 100; })
*/
export declare abstract class Unit extends Entity {
get type(): string;
_infused: 0 | 1 | 2;
_reanimated: 0 | 1 | 2;
protected _getInfused(): 0 | 1 | 2;
protected _setInfused(value: 0 | 1 | 2): void;
protected _getReanimated(): 0 | 1 | 2;
protected _setReanimated(value: 0 | 1 | 2): void;
canBeInfusedOverride?: boolean;
constructingVersion?: {
name: string;
buildTime: number;
hp: number;
uuid: string;
};
vision: number;
pushability: number;
constructor(props?: Partial<Unit>);
abstract get unitType(): UnitType;
get subtype(): string;
get canBeInfused(): boolean;
get canBeReanimated(): boolean;
get canBeMindControlled(): boolean;
get reanimateCost(): number | undefined;
get infuseCost(): number | undefined;
/** Get all child entity IDs for ecosystem linking - includes upgrades */
get children(): Record<string, [string, string]>;
/**
* JSON.stringify() calls this automatically
*/
toJSON(): Record<string, any>;
protected _applyInfusion(value: 0 | 1 | 2): void;
protected _applyReanimation(value: 0 | 1 | 2): void;
/**
* Infuse this unit (chainable method)
* No-ops if unit is not infusable
*/
infuse(doubleInfuse?: boolean): this;
/**
* Reanimate this unit (chainable method)
* No-ops if unit is not reanimatable
*/
reanimate(zombieMode?: boolean): this;
}
export declare abstract class ArmyUnit extends Unit {
constructor(props?: Partial<ArmyUnit>);
get unitType(): UnitType;
}
export declare abstract class HeroUnit extends Unit {
supply: number;
buildTime: number;
rebuildable: boolean;
rebuildTime: number;
get unitType(): UnitType;
}
export declare abstract class CoopCommanderUnit extends Unit {
readonly tier = "T2";
get unitType(): UnitType;
maxLevel: number;
currentLevel: number;
commanderType?: string;
commanderFaction?: string[];
commanderTopbars: Record<string, any>;
levels: Record<string, any>;
constructor();
get children(): Record<string, [string, string]>;
/** Get topbars available at current level */
getAvailableTopbars(): Record<string, any>;
/** Set commander level (affects available topbars) - chainable! */
withLevel(level: number): this;
toJSON(): Record<string, any>;
}
export declare abstract class HarvesterUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class BuilderUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class SpecialUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class UltimateUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class MercUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class MercTopbarUnit extends Unit {
get unitType(): UnitType;
}
export declare abstract class MobileMercOutpostUnit extends Unit {
get unitType(): UnitType;
}
//# sourceMappingURL=unit.d.ts.map