/** * The Pilot — one competent Gen 3 heuristic policy, identical on both sides * (ADR 0002). Given the omniscient battle state and the current request, it * returns a Showdown choice string. * * Competence is layered as an ordered decision tree; each layer only fires when * the earlier, higher-priority ones decline: * 1. secure a KO we can safely land (max-damage core) * 2. pivot out of a losing matchup (matchup switching) * 3. heal when worn down and safe (recovery / stall) * 4. lay Spikes / spin them away (hazards) * 5. spread status on a fresh target (Toxic / paralysis / burn) * 6. set up when the foe can't pressure us (Dragon Dance, Calm Mind, ...) * 7. otherwise hit as hard as possible (max-damage fallback) * * Per ADR 0002 / the PRD, the Pilot is never asserted move-by-move: its * competence is judged only through outcome thresholds at the `evaluate` seam. */ import { BattleStreams } from '@pkmn/sim'; import type { Battle } from '@pkmn/sim'; export type SideID = 'p1' | 'p2'; type PlayerStream = ConstructorParameters[0]; interface RequestMove { move: string; id: string; pp?: number; disabled?: boolean | string; } interface RequestActive { moves: RequestMove[]; /** Known trap (e.g. Arena Trap / Magnet Pull): switching is forbidden. */ trapped?: boolean; /** Possible trap: switching may be rejected, so we treat it as forbidden. */ maybeTrapped?: boolean; } interface RequestPokemon { ident: string; details: string; condition: string; active?: boolean; } interface PlayerRequest { active?: RequestActive[]; side: { pokemon: RequestPokemon[]; }; forceSwitch?: boolean[]; wait?: boolean; teamPreview?: boolean; } export declare function chooseAction(battle: Battle, sideID: SideID, request: PlayerRequest): string; /** * A player that drives one side of a BattleStream with the heuristic Pilot. * It reads the shared omniscient {@link Battle} through `getBattle` (both sides * see the same information, so the contest stays fair). */ export declare class PilotPlayer extends BattleStreams.BattlePlayer { private readonly getBattle; private readonly sideID; /** Guards against re-entrant recovery within a single stuck decision. */ private recovering; constructor(playerStream: PlayerStream, getBattle: () => Battle | null, sideID: SideID); receiveRequest(request: PlayerRequest): void; /** * Safety net: if the heuristic ever produces an illegal choice (e.g. an * uncertain trap it mis-read), fall back to the safest legal action instead * of aborting the whole evaluation. Any other error still propagates. */ receiveError(error: Error): void; } export {};