export interface ResourcePoolConfig { max: number; initial?: number; regenPerSecond?: number; decayPerSecond?: number; } /** Complete serializable state for a {@link ResourcePool}. */ export interface ResourcePoolSnapshot { current: number; max: number; regenPerSecond: number; decayPerSecond: number; } /** Runtime tuning patch for {@link ResourcePool.retune} — omitted fields keep their current value. */ export interface ResourcePoolRetune { max?: number; regenPerSecond?: number; decayPerSecond?: number; } export interface ResourcePool { current(): number; max(): number; setMax(value: number): void; fraction(): number; canSpend(amount: number): boolean; spend(amount: number): boolean; gain(amount: number): number; set(value: number): void; tick(dtSeconds: number): void; isFull(): boolean; isEmpty(): boolean; /** The whole pool as plain data — save it, ship it to a host, diff it in a test. */ snapshot(): ResourcePoolSnapshot; /** Adopt a snapshot, replacing current value and tuning. */ restore(state: ResourcePoolSnapshot): void; /** Change regen/decay/max mid-run (a buff, a difficulty change) without rebuilding the pool. */ retune(patch: ResourcePoolRetune): void; } /** * A regenerating resource pool — mana, stamina, energy — that actions spend from and that refills over time. * * @capability resource-pool a regenerating pool like mana or stamina that actions spend from */ export declare function createResourcePool(config: ResourcePoolConfig): ResourcePool;