/** * Schema Shorthand Utilities * * TIER 2 Token Efficiency Optimization * * Provides parsing utilities for common input formats that reduce token overhead: * - Position: "10,5" or "10,5,0" -> { x: 10, y: 5, z: 0 } * - Damage: "2d6+3 fire" -> { dice: "2d6", modifier: 3, type: "fire" } * - Duration: "7d" / "3h" / "10r" -> { value: 7, unit: "days", rounds: 6720 } * - Range: "30/120" -> { normal: 30, long: 120 } * - Area: "20ft cone" -> { size: 20, shape: "cone" } */ export interface Position { x: number; y: number; z: number; } /** * Parse a position from various formats: * - String: "10,5" or "10,5,0" * - Object: { x: 10, y: 5 } or { x: 10, y: 5, z: 0 } * * @example * parsePosition("10,5") // { x: 10, y: 5, z: 0 } * parsePosition("10,5,3") // { x: 10, y: 5, z: 3 } * parsePosition({ x: 10, y: 5 }) // { x: 10, y: 5, z: 0 } */ export declare function parsePosition(input: string | { x: number; y: number; z?: number; }): Position; /** * Parse multiple positions from array of strings or objects */ export declare function parsePositions(inputs: (string | { x: number; y: number; z?: number; })[]): Position[]; /** * Format a position back to shorthand string */ export declare function formatPosition(pos: Position, includeZ?: boolean): string; export interface DamageNotation { dice: string; count: number; sides: number; modifier: number; type: string; average: number; min: number; max: number; } /** * Parse damage notation from shorthand * * Supported formats: * - "2d6" -> 2d6 untyped damage * - "2d6+3" -> 2d6+3 untyped damage * - "2d6-2" -> 2d6-2 untyped damage * - "2d6 fire" -> 2d6 fire damage * - "2d6+3 fire" -> 2d6+3 fire damage * - "1d8+5 slashing" -> 1d8+5 slashing damage * * @example * parseDamage("2d6+3 fire") * // { dice: "2d6", count: 2, sides: 6, modifier: 3, type: "fire", average: 10, min: 5, max: 15 } */ export declare function parseDamage(input: string): DamageNotation | null; /** * Format damage notation back to shorthand */ export declare function formatDamage(damage: DamageNotation): string; /** * Parse multiple damage expressions (e.g., for multi-attack) * Input: "2d6+3 slashing + 1d6 fire" */ export declare function parseMultiDamage(input: string): DamageNotation[]; export type DurationUnit = 'rounds' | 'minutes' | 'hours' | 'days' | 'instantaneous' | 'permanent' | 'concentration'; export interface Duration { value: number; unit: DurationUnit; rounds: number; display: string; } /** * Parse duration shorthand * * Supported formats: * - "10r" or "10 rounds" -> 10 rounds * - "1m" or "1 minute" or "1min" -> 1 minute (10 rounds) * - "1h" or "1 hour" -> 1 hour (600 rounds) * - "7d" or "7 days" -> 7 days (100,800 rounds) * - "instant" or "instantaneous" -> 0 rounds * - "permanent" or "perm" -> Infinity rounds * - "conc" or "concentration" -> Concentration (returns 0 rounds, flag in unit) * * @example * parseDuration("1h") * // { value: 1, unit: "hours", rounds: 600, display: "1 hour" } * * parseDuration("10r") * // { value: 10, unit: "rounds", rounds: 10, display: "10 rounds" } */ export declare function parseDuration(input: string): Duration | null; /** * Format duration to shorthand */ export declare function formatDuration(duration: Duration, short?: boolean): string; /** * Convert any duration to rounds */ export declare function toRounds(input: string | Duration | number): number; export interface Range { normal: number; long: number | null; type: 'melee' | 'ranged' | 'reach'; } /** * Parse range shorthand * * Supported formats: * - "5" or "5ft" -> 5ft melee range * - "30/120" -> 30ft normal, 120ft long (ranged) * - "reach 10" or "10 reach" -> 10ft reach * - "self" -> 0ft (self-target) * - "touch" -> 5ft melee * * @example * parseRange("30/120") * // { normal: 30, long: 120, type: "ranged" } */ export declare function parseRange(input: string): Range | null; /** * Format range to shorthand */ export declare function formatRange(range: Range): string; export type AoeShape = 'cone' | 'cube' | 'cylinder' | 'line' | 'sphere' | 'square'; export interface AreaOfEffect { size: number; shape: AoeShape; secondarySize?: number; } /** * Parse area of effect shorthand * * Supported formats: * - "20ft cone" or "20 cone" -> 20ft cone * - "15ft cube" -> 15ft cube * - "20ft radius" or "20ft sphere" -> 20ft radius sphere * - "30x5 line" or "30ft line 5ft wide" -> 30ft long, 5ft wide line * - "20ft cylinder 40ft high" -> 20ft radius, 40ft high cylinder * * @example * parseAreaOfEffect("60ft cone") * // { size: 60, shape: "cone" } */ export declare function parseAreaOfEffect(input: string): AreaOfEffect | null; /** * Format area of effect to shorthand */ export declare function formatAreaOfEffect(aoe: AreaOfEffect): string; /** * Roll dice based on notation string * * @param notation Dice notation like "2d6+3" or "1d20" * @param rng Optional random function (default: Math.random) * @returns Total rolled value */ export declare function rollDice(notation: string, rng?: () => number): number; /** * Calculate average value for dice notation */ export declare function averageDice(notation: string): number; import { z } from 'zod'; /** * Zod schema for position that accepts string or object */ export declare const PositionSchema: z.ZodEffects; }, "strip", z.ZodTypeAny, { x: number; y: number; z?: number | undefined; }, { x: number; y: number; z?: number | undefined; }>]>, Position, string | { x: number; y: number; z?: number | undefined; }>; /** * Zod schema for damage notation */ export declare const DamageSchema: z.ZodEffects, DamageNotation, string>; /** * Zod schema for duration */ export declare const DurationSchema: z.ZodEffects, Duration, string>; /** * Zod schema for range */ export declare const RangeSchema: z.ZodEffects, Range, string>; /** * Zod schema for area of effect */ export declare const AreaOfEffectSchema: z.ZodEffects, AreaOfEffect, string>; //# sourceMappingURL=schema-shorthand.d.ts.map