import type { DirectionOptions, Language, Side, Sport } from "./types.ts"; import type { DriveResult, Situation, SituationTeam } from "./situation.types.ts"; export type { BaseballSituation, DriveLeg, DriveResult, FootballSituation, HockeySituation, ShootoutAttempt, ShootoutRound, Situation, SituationTeam } from "./situation.types.ts"; /** The most rounds of a shootout that are drawn. */ export declare const SHOOTOUT_MAX = 12; /** The rounds that are regular: the rounds after them are sudden death. */ export declare const SHOOTOUT_REGULAR = 3; /** The most drives drawn in a drive chart. */ export declare const DRIVES_MAX = 24; /** The red zone: the yards before the goal line the offence attacks. */ export declare const RED_ZONE_YARDS = 20; /** The yards to a first down. */ export declare const FIRST_DOWN_YARDS = 10; /** The short code each drive result is written with at the head of its arrow. */ export declare const DRIVE_CODES: Readonly>; /** What a reading needs to know of the drawing it is for. */ export interface SituationContext { /** The sport as drawn (`chooseLeague(o).sport`): `nhl`, `mlb`, `nfl`, `cfl` or `ifaf`; a situation is for these only. */ sport: Sport; /** The side the home team's banner is on. */ homeSide: Side; /** The attack arrows' options, which say which end each team attacks. */ direction?: DirectionOptions; /** The football field: the yards between the goal lines and the downs a team has. */ football?: { yards: number; downs: number; }; /** The teams' names, when the drawing has teams. */ names?: { home: string; away: string; }; /** The league's id as the options name it (`iihf`, `olympic`), when they name one. */ league?: string; } /** Hockey, read. */ export interface HockeyRead { kind: "hockey"; /** The skaters, when known. */ away?: number; home?: number; /** The team that is attacking (more skaters, or the goalkeeper pulled, or the other team of a delayed penalty), and the end it heads for. */ attacker?: SituationTeam; toward?: "left" | "right"; /** The attacker's skaters and the other team's, in that order, when both are known. */ strength?: [number, number]; /** More skaters than the other team. */ powerPlay: boolean; emptyNet?: SituationTeam; delayed?: SituationTeam; clock?: string; /** The shootout is called the game winning shots (GWS) in this league. */ gws: boolean; shootout?: { rounds: [boolean | null, boolean | null][]; goals: [number, number]; sudden: number; }; } /** Baseball, read. */ export interface BaseballRead { kind: "baseball"; bases?: [boolean, boolean, boolean]; outs?: number; inning?: number; half?: "top" | "bottom"; balls?: number; strikes?: number; } /** A drive, read: in yards from the team's own goal line, and the end it heads for. */ export interface DriveRead { team: SituationTeam; from: number; to: number; result?: DriveResult; toward: "left" | "right"; } /** Football, read. */ export interface FootballRead { kind: "football"; yards: number; downs: number; ballOn?: number; toGo?: number | "goal"; down?: number; possession?: SituationTeam; /** The end zone the offence heads for. */ toward: "left" | "right"; redZone: boolean; drive: DriveRead[]; } /** A situation, read. */ export type SituationRead = HockeyRead | BaseballRead | FootballRead; /** `m:ss`, `m:ss.s`, or a whole number of seconds written as `m:ss`; anything else is left out. */ export declare function clockText(value: unknown): string | undefined; /** * The situation a drawing's options ask for, decided: which team attacks and which end, what is lit. `undefined` when the options have none, when the sport has no situation (only * hockey, baseball and football do), or when nothing in it is a value the sport can have. */ export declare function readSituation(situation: unknown, ctx: SituationContext): SituationRead | undefined; /** A yard line as the tag writes it: `OWN 35`, `OPP 12`, or the middle of the field. */ export declare function yardLineText(ballOn: number, yards: number, language: Language): string; /** The down and distance as the tag writes it (`3rd & 7`, `1st & Goal`), or `undefined` when there is no down. */ export declare function downTag(read: FootballRead, language: Language): string | undefined; /** The strength of a hockey situation on the pill: `5v4 PP`, `6v5 EN`, `4v4`, `DEL PEN`, with the clock after it; `undefined` when there is nothing to say (5 against 5). */ export declare function hockeyPill(read: HockeyRead, language: Language): string | undefined; /** * The short label of a situation as the drawing writes it: hockey's `5v4 PP 1:42`, baseball's `Top 7 · 2 out · 3-2`, football's `3rd & 7`. `undefined` when there is none to write. * @example * ```ts * import { situationText } from "@johnmorrisdotca/kyogijo-stadiums"; * console.log(situationText({ sport: "nhl", situation: { awaySkaters: 5, homeSkaters: 4, clock: "1:42" } })); * console.log(situationText({ sport: "mlb", situation: { inning: 7, half: "top", outs: 2, balls: 3, strikes: 2 } })); * console.log(situationText({ sport: "nfl", situation: { ballOn: 88, down: 3, toGo: 7 } })); * // 5v4 PP 1:42 * // Top 7 · 2 out · 3-2 * // 3rd & 7 · OPP 12 * ``` */ export declare function situationText(options: { sport: Sport; league?: string; homeSide?: Side; direction?: DirectionOptions; language?: Language; situation?: Situation; }, language?: Language): string | undefined; /** The short label of a reading, in a language. */ export declare function tagOf(read: SituationRead, language: Language): string | undefined; /** The sentences a description adds for a situation, each beginning with a capital. */ export declare function situationSentences(read: SituationRead, language: Language, names?: { home: string; away: string; }): string[];