UNPKG

fortel-ziweidoushu

Version:
666 lines (628 loc) 23.7 kB
/// <reference types="node" /> import util from 'util'; export declare class BoardCriteria { #private; constructor(destinyBoard: DestinyBoard, baseCellGround?: Ground, cellsScope?: CellsScope); ofDestinyTemple(): BoardCriteria; ofTemple(temple: Temple): BoardCriteria; ofGroundCell(ground: Ground): BoardCriteria; ofCell(cell: Cell): BoardCriteria; ofStar(star: Star): BoardCriteria; withCellsType(cellsScope: CellsScope): BoardCriteria; static allStarsNameToKeyMap: Map<string, string>; hasStar(star: Star): boolean; hasAllStars(stars: Star[]): boolean; hasAnyStars(stars: Star[]): boolean; notFoundStar(star: Star): boolean; notFoundAllStars(stars: Star[]): boolean; notFoundAnyStars(stars: Star[]): boolean; static fromDescription(destinyBoard: DestinyBoard, description: string): boolean; } export declare class BorrowCell { cell: Cell; cellRatio: number; constructor(cell: Cell, cellRatio: number); } export declare type Calendar = { solar2lunar: (solarYear: number, solarMonth: number, solarDay: number) => { lunarYear: number; lunarMonth: number; lunarDay: number; isLeapMonth: boolean; yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; }; lunar2solar: (lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean) => { solarYear: number; solarMonth: number; solarDay: number; }; lunarSkyGround: (lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean) => { yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; }; lunarMonthDays: (year: number, month: number, leap: boolean) => number; solarMonthDays: (year: number, month: number) => number; }; export declare enum CalendarType { LUNAR = "LUNAR", SOLAR = "SOLAR" } export declare class Cell { #private; constructor(sky: Sky, ground: Ground); get sky(): Sky; get ground(): Ground; get temples(): Temple[]; get majorStars(): MajorStar[]; get minorStars(): MinorStar[]; get miniStars(): MiniStar[]; get allStars(): Star[]; get allMiniStars(): MiniStar[]; get borrowCells(): Readonly<BorrowCell>[]; get leaderStar(): MiniStar; set leaderStar(leaderStar: MiniStar); get yearGodStar(): MiniStar; set yearGodStar(yearGodStar: MiniStar); get scholarStar(): MiniStar; set scholarStar(scholarStar: MiniStar); get ageStart(): number; set ageStart(ageStart: number); get ageEnd(): number; get lifeStage(): LifeStage; set lifeStage(lifeStage: LifeStage); get cellIndex(): number; set cellIndex(cellIndex: number); get prevCell(): Cell; set prevCell(cell: Cell); get nextCell(): Cell; set nextCell(cell: Cell); get self(): Cell; getPrevICell(i: number): Cell; getNextICell(i: number): Cell; getCellNextDist(cell: Cell): number; getCellPrevDist(cell: Cell): number; getCellDist(cell: Cell): number; [util.inspect.custom](depth: number, opts: any): string; toJSON(): { sky: Sky; ground: Ground; temples: Temple[]; majorStars: MajorStar[]; minorStars: MinorStar[]; miniStars: MiniStar[]; miscStars: MiniStar[]; ageStart: number | undefined; ageEnd: number | undefined; lifeStage: LifeStage | undefined; }; toString(): string; equals(cell: Cell): boolean; get selfWithBorrow(): Cell[]; get oppositeCell(): Cell; get oppositeCellWithBorrow(): Cell[]; get selfOppositeCells(): [Cell, Cell]; get selfOppositeCellsWithBorrow(): Cell[]; get supportCells(): [Cell, Cell]; get supportCellsWithBorrow(): Cell[]; get triangleCells(): [Cell, Cell, Cell]; get triangleCellsWithBorrow(): Cell[]; get fourCells(): [Cell, Cell, Cell, Cell]; get fourCellsWithBorrow(): Cell[]; static cellsWithBorrowCells(cells: Cell[]): Cell[]; hasMajorMinorStar(targetStar: Star): boolean; hasStarInstance(targetStar: Star): boolean; hasStar(targetStar: Star): boolean; hasAllStars(targetStars: Star[]): boolean; hasAnyStars(targetStars: Star[]): boolean; hasTemple(targetTemple: Temple): boolean; } export declare enum CellsScope { SELF = "SELF", OPPOSITE = "OPPOSITE", SELF_OPPOSITE = "OPPOSITE", SUPPORT = "SUPPORT", TRIANGLE = "TRIANGLE", FOUR = "FOUR" } export declare enum ConfigType { GROUND = "GROUND", SKY = "SKY", HUMAN = "HUMAN" } export declare class DayTimeGround { index: number; displayName: string; ground: Ground; hourStart: number; hourEnd: number; constructor(index: number, displayName: string, ground: Ground, hourStart: number, hourEnd: number); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static get(i: number): DayTimeGround; static getByName(name: string): DayTimeGround; static getByStartHour(hour: number): DayTimeGround; static getByHour(hour: number): DayTimeGround; static values(): readonly Readonly<DayTimeGround>[]; } export declare const defaultCalendar: Calendar; export declare class DestinyBoard { #private; config: DestinyConfig; element: Element; constructor(destinyConfig: DestinyConfig); get destinyMaster(): MinorStar | MajorStar; get bodyMaster(): MinorStar | MajorStar; get startControl(): Ground; get destinyTempleCellGround(): Ground; get cells(): Cell[]; get bornStarDerivativeMap(): Map<StarDerivative, MinorStar | MajorStar>; getCellByGround(ground: Ground): Cell; getCellByTemple(temple: Temple): Cell; getCellByStar(star: Star): Cell; getTenYearSky(age: number): Sky; getTenYearCellGround(age: number): Ground; getRuntimContext({ lunarYear, lunarMonth, lunarDay, leap, calendar, }: { lunarYear: number; lunarMonth: number; lunarDay: number; leap: boolean; calendar?: Calendar; }): RuntimeContext; get shadowLight(): ShadowLight; get configDirection(): Direction; getMajorStarEnergyLevel(majorStar: MajorStar): number; getMajorStarDerivative(star: MajorStar | MinorStar): Readonly<StarDerivative> | null; [util.inspect.custom](depth: number, opts: any): string; toJSON(): { config: DestinyConfig; element: Element; destinyMaster: MinorStar | MajorStar | undefined; bodyMaster: MinorStar | MajorStar | undefined; startControl: Ground | undefined; cells: Cell[]; bornStarDerivativeMap: any; }; toString(): string; } export declare class DestinyConfig { year: number; month: number; day: number; isLeapMonth: boolean; yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; bornTimeGround: DayTimeGround; configType: ConfigType; gender: Gender; constructor(params: { year: number; month: number; day: number; isLeapMonth: boolean; yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; bornTimeGround: DayTimeGround; configType: ConfigType; gender: Gender; }); getLogicalMonth(): number; toJSON(): { year: number; month: number; day: number; isLeapMonth: boolean; yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; bornTimeGround: DayTimeGround; configType: string; gender: string; }; toString(): string; } export declare class DestinyConfigBuilder { static withSolar(params: { year: number; month: number; day: number; bornTimeHour?: number; bornTimeGround?: DayTimeGround; configType: ConfigType; gender: Gender; calendar?: Calendar; }): DestinyConfig; static withlunar(params: { year: number; month: number; day: number; isLeapMonth?: boolean; bornTimeHour?: number; bornTimeGround?: DayTimeGround; configType: ConfigType; gender: Gender; calendar?: Calendar; }): DestinyConfig; static withText(input: string, calendar?: Calendar): DestinyConfig; } export declare const destinyConfigTextParser: { parse: typeof text2DestinyConfig; }; export declare class Direction { direction: number; constructor(direction: number); add(direction: Direction): Direction; static CLOCKWISE: Readonly<Direction>; static ANTI_CLOCKWISE: Readonly<Direction>; } export declare class Element { #private; code: string; displayName: string; patternNumber: number; constructor(code: string, displayName: string, patternNumber: number); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static get(code: string): Element; static GOLD: Readonly<Element>; static WOOD: Readonly<Element>; static EARTH: Readonly<Element>; static WATER: Readonly<Element>; static FIRE: Readonly<Element>; } export declare enum Gender { M = "M", F = "F" } export declare class Ground { index: number; displayName: string; constructor(index: number, displayName: string); shift(i: number): Ground; toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static get(i: number): Ground; static getByName(name: string): Ground; static GROUNDS: readonly Readonly<Ground>[]; static values(): readonly Readonly<Ground>[]; equals(ground: Ground): boolean; } export declare class LifeStage { displayName: string; constructor(displayName: string); toJSON(): string; toString(): string; static getByName(name: string): Readonly<LifeStage> | undefined; [util.inspect.custom](depth: number, opts: any): string; static values: readonly Readonly<LifeStage>[]; } export declare enum Luckiness { LUCK = 1, NEUTRAL = 0, BAD_LUCK = -1 } /** * 主星 */ export declare class MajorStar implements Star { key: string; displayName: string; constructor(key: string, displayName: string); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static MAJOR_STAR_EMPEROR: Readonly<MajorStar>; static MAJOR_STAR_CHANGE: Readonly<MajorStar>; static MAJOR_STAR_SUN: Readonly<MajorStar>; static MAJOR_STAR_GOLD: Readonly<MajorStar>; static MAJOR_STAR_ENJOYMENT: Readonly<MajorStar>; static MAJOR_STAR_FIRE: Readonly<MajorStar>; static MAJOR_STAR_TREASURY: Readonly<MajorStar>; static MAJOR_STAR_MOON: Readonly<MajorStar>; static MAJOR_STAR_GREED: Readonly<MajorStar>; static MAJOR_STAR_ARGUMENT: Readonly<MajorStar>; static MAJOR_STAR_SUPPORT: Readonly<MajorStar>; static MAJOR_STAR_RULE: Readonly<MajorStar>; static MAJOR_STAR_GENERAL: Readonly<MajorStar>; static MAJOR_STAR_PIONEER: Readonly<MajorStar>; static stars: readonly Readonly<MajorStar>[]; static majorStarPlacers: Readonly<Map<MajorStar, MajorStarPlacer>>; getType(): string; getKey(): string; getDisplayName(): string; static getByKey(key: string): MajorStar | null; static getByName(name: string): Readonly<MajorStar> | null; equals(star: Star): boolean; } declare interface MajorStarPlacer { evalGround: (destinyBoard: DestinyBoard) => Ground; evalEnergyLevel: (ground: Ground) => number; } export declare class MiniStar implements Star { key: string; displayName: string; luck: Luckiness; constructor(key: string, displayName: string, luck: Luckiness); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static MINI_STAR_SKY_NOBLE: Readonly<MiniStar>; static MINI_STAR_SKY_HAPPINESS: Readonly<MiniStar>; static MINI_STAR_COOK: Readonly<MiniStar>; static MINI_STAR_CRY: Readonly<MiniStar>; static MINI_STAR_LOST: Readonly<MiniStar>; static MINI_STAR_SKILL: Readonly<MiniStar>; static MINI_STAR_ART: Readonly<MiniStar>; static MINI_STAR_FESTIVE: Readonly<MiniStar>; static MINI_STAR_HAPPINESS: Readonly<MiniStar>; static MINI_STAR_LONELY: Readonly<MiniStar>; static MINI_STAR_SINGLE: Readonly<MiniStar>; static MINI_STAR_DISSOLVE: Readonly<MiniStar>; static MINI_STAR_BROKEN: Readonly<MiniStar>; static MINI_STAR_BIG_LOST: Readonly<MiniStar>; static MINI_STAR_LITTLE_DISASTER: Readonly<MiniStar>; static MINI_STAR_LUST: Readonly<MiniStar>; static MINI_STAR_MOON_BENEFACTOR: Readonly<MiniStar>; static MINI_STAR_GENIUS: Readonly<MiniStar>; static MINI_STAR_LONGEVITY: Readonly<MiniStar>; static MINI_STAR_VOID_SKY: Readonly<MiniStar>; static MINI_STAR_EMPTY: Readonly<MiniStar>; static MINI_STAR_EMPTY2: Readonly<MiniStar>; static MINI_STAR_INTERUPTION: Readonly<MiniStar>; static MINI_STAR_INTERUPTION2: Readonly<MiniStar>; static MINI_STAR_PLATFORM: Readonly<MiniStar>; static MINI_STAR_FAME: Readonly<MiniStar>; static MINI_STAR_PUNISHMENT: Readonly<MiniStar>; static MINI_STAR_SEX: Readonly<MiniStar>; static MINI_STAR_WITCH: Readonly<MiniStar>; static MINI_STAR_ILLNESS: Readonly<MiniStar>; static MINI_STAR_GHOST: Readonly<MiniStar>; static MINI_STAR_DISSOLVE2: Readonly<MiniStar>; static MINI_STAR_BACKBITING: Readonly<MiniStar>; static MINI_STAR_SCHOLAR: Readonly<MiniStar>; static MINI_STAR_STRENGTH: Readonly<MiniStar>; static MINI_STAR_GREEN_DRAGON: Readonly<MiniStar>; static MINI_STAR_SMALL_LOST: Readonly<MiniStar>; static MINI_STAR_GENERAL: Readonly<MiniStar>; static MINI_STAR_LETTER: Readonly<MiniStar>; static MINI_STAR_BACKBITING2: Readonly<MiniStar>; static MINI_STAR_JOY: Readonly<MiniStar>; static MINI_STAR_SICK: Readonly<MiniStar>; static MINI_STAR_BIG_LOST2: Readonly<MiniStar>; static MINI_STAR_AMBUSH: Readonly<MiniStar>; static MINI_STAR_LITIGATION: Readonly<MiniStar>; static MINI_STAR_THREE_PODIUM: Readonly<MiniStar>; static MINI_STAR_EIGHT_SEAT: Readonly<MiniStar>; static MINI_STAR_HOLY_LIGHT: Readonly<MiniStar>; static MINI_STAR_NOBLE: Readonly<MiniStar>; static MINI_STAR_YEAR_GOD: Readonly<MiniStar>; static MINI_STAR_PESSIMISTIC: Readonly<MiniStar>; static MINI_STAR_BEREAVEMENT: Readonly<MiniStar>; static MINI_STAR_TRAP: Readonly<MiniStar>; static MINI_STAR_LAWSUIT: Readonly<MiniStar>; static MINI_STAR_SMALL_LOST2: Readonly<MiniStar>; static MINI_STAR_BROKEN_YEAR: Readonly<MiniStar>; static MINI_STAR_DRAGON_LUCK: Readonly<MiniStar>; static MINI_STAR_WHITE_TIGER: Readonly<MiniStar>; static MINI_STAR_GOD_LUCK: Readonly<MiniStar>; static MINI_STAR_FUNERAL: Readonly<MiniStar>; static MINI_STAR_SICK2: Readonly<MiniStar>; static MINI_STAR_ANGEL: Readonly<MiniStar>; static MINI_STAR_INJURY: Readonly<MiniStar>; static MINI_STAR_LEADER: Readonly<MiniStar>; static MINI_STAR_MOUNT: Readonly<MiniStar>; static MINI_STAR_TRANSITION: Readonly<MiniStar>; static MINI_STAR_IDLE: Readonly<MiniStar>; static MINI_STAR_MYSTIC: Readonly<MiniStar>; static MINI_STAR_LITTLE_DISASTER2: Readonly<MiniStar>; static MINI_STAR_DISASTER: Readonly<MiniStar>; static MINI_STAR_SKY_DISASTER: Readonly<MiniStar>; static MINI_STAR_BETRAY: Readonly<MiniStar>; static MINI_STAR_LUST2: Readonly<MiniStar>; static MINI_STAR_MOON_MONSTER: Readonly<MiniStar>; static MINI_STAR_DEAD: Readonly<MiniStar>; static doubleStars: readonly Readonly<MiniStar>[]; static stars: readonly Readonly<MiniStar>[]; static twelveScholarStars: readonly Readonly<MiniStar>[]; static twelveYearGodStars: readonly Readonly<MiniStar>[]; static twelveLeaderStars: readonly Readonly<MiniStar>[]; static allStars: readonly Readonly<MiniStar>[]; static miniStarPlacers: Readonly<Map<MiniStar, MiniStarPlacer>>; getType(): string; getKey(): string; getDisplayName(): string; static getByKey(key: string): MiniStar | null; static getByName(name: string): Readonly<MiniStar> | null; equals(star: Star): any; } declare interface MiniStarPlacer { evalGround: (destinyBoard: DestinyBoard) => Ground; } export declare class MinorStar implements Star { key: string; displayName: string; luck: Luckiness; constructor(key: string, displayName: string, luck: Luckiness); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static MINOR_STAR_EARN: Readonly<MinorStar>; static MINOR_STAR_BENEFACTOR_MAN: Readonly<MinorStar>; static MINOR_STAR_BENEFACTOR_WOMAN: Readonly<MinorStar>; static MINOR_STAR_CLEVER: Readonly<MinorStar>; static MINOR_STAR_SKILL: Readonly<MinorStar>; static MINOR_STAR_SUPPORT_LEFT: Readonly<MinorStar>; static MINOR_STAR_SUPPORT_RIGHT: Readonly<MinorStar>; static MINOR_STAR_VOID_GROUND: Readonly<MinorStar>; static MINOR_STAR_LOST: Readonly<MinorStar>; static MINOR_STAR_BURNING: Readonly<MinorStar>; static MINOR_STAR_HIDDEN_FIRE: Readonly<MinorStar>; static MINOR_STAR_COMPETITION: Readonly<MinorStar>; static MINOR_STAR_HINDRANCE: Readonly<MinorStar>; static MINOR_STAR_PEGASUS: Readonly<MinorStar>; static stars: readonly Readonly<MinorStar>[]; static minorStarPlacers: Readonly<Map<MinorStar, MinorStarPlacer>>; getType(): string; getKey(): string; getDisplayName(): string; static getByKey(key: string): MinorStar | null; static getByName(name: string): Readonly<MinorStar> | null; equals(star: Star): any; } declare interface MinorStarPlacer { evalGround: (destinyBoard: DestinyBoard) => Ground; hasRuntime: () => boolean; evalRuntimeGround: (sky: Sky) => Ground; } export declare class Runtime { static getRuntimeStars(): Readonly<MinorStar>[]; static getRuntimeStarsLocation(sky: Sky): Map<MinorStar, Ground>; static getRuntimeLocationStars(sky: Sky): Map<Ground, MinorStar[]>; static getDerivativeMapOf(sky: Sky): Map<StarDerivative, MajorStar | MinorStar>; static getStarToDerivativeMapOf(sky: Sky): Map<MajorStar | MinorStar, StarDerivative>; static getDerivativeOf(starDerivative: StarDerivative, sky: Sky): MajorStar | MinorStar; } export declare type RuntimeContext = { tenYear: { cellGround: Ground | null; groundStars: Map<Ground, MinorStar[]> | null; starDerivativeMap: Map<MajorStar | MinorStar, StarDerivative> | null; }; year: { cellGround: Ground | null; groundStars: Map<Ground, MinorStar[]> | null; starDerivativeMap: Map<MajorStar | MinorStar, StarDerivative> | null; }; month: { cellGround: Ground | null; groundStars: Map<Ground, MinorStar[]> | null; starDerivativeMap: Map<MajorStar | MinorStar, StarDerivative> | null; }; day: { cellGround: Ground | null; groundStars: Map<Ground, MinorStar[]> | null; starDerivativeMap: Map<MajorStar | MinorStar, StarDerivative> | null; }; yearSky: Sky; yearGround: Ground; monthSky: Sky; monthGround: Ground; daySky: Sky; dayGround: Ground; age: number; effectiveMonth: number; tenYearGround: Ground; tenYearSky: Sky; }; export declare class ShadowLight { displayName: string; constructor(displayName: string); toJSON(): string; toString(): string; static SHADOW: Readonly<ShadowLight>; static LIGHT: Readonly<ShadowLight>; } export declare class Sky { index: number; displayName: string; constructor(index: number, displayName: string); shift(i: number): Sky; toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; static get(i: number): Sky; static getByName(name: string): Sky; static SKYS: readonly Readonly<Sky>[]; static values(): readonly Readonly<Sky>[]; equals(sky: Sky): boolean; } declare interface Star { getType(): string; getKey(): string; getDisplayName(): string; equals(star: Star): boolean; } export declare const starByKey: (key: string) => Star; export declare const starByName: (name: string) => Star; export declare class StarDerivative { key: string; displayName: string; constructor(key: string, displayName: string); toJSON(): string; toString(): string; euqals(starDerivative: StarDerivative): boolean; [util.inspect.custom](depth: number, opts: any): string; static WEALTHINESS: Readonly<StarDerivative>; static POWER: Readonly<StarDerivative>; static FAME: Readonly<StarDerivative>; static PROBLEM: Readonly<StarDerivative>; static getWealthinessStar(sky: Sky): Readonly<MajorStar>; static getPowerStar(sky: Sky): Readonly<MajorStar>; static getFameStar(sky: Sky): Readonly<MajorStar | MinorStar>; static getProblemStar(sky: Sky): Readonly<MajorStar | MinorStar>; } export declare class Temple { key: string; displayName: string; formalName: string; index: number; constructor(key: string, displayName: string, formalName: string, index: number); toJSON(): string; toString(): string; [util.inspect.custom](depth: number, opts: any): string; getDisplayName(): string; getFormalName(): string; static getByKey(key: string): Temple | null; static getByName(name: string): Readonly<Temple> | undefined; static TEMPLE_DESTINY: Readonly<Temple>; static TEMPLE_BROTHER: Readonly<Temple>; static TEMPLE_MARRIAGE: Readonly<Temple>; static TEMPLE_CHILDREN: Readonly<Temple>; static TEMPLE_MONEY: Readonly<Temple>; static TEMPLE_ILLNESS: Readonly<Temple>; static TEMPLE_MOVE: Readonly<Temple>; static TEMPLE_FRIEND: Readonly<Temple>; static TEMPLE_CAREER: Readonly<Temple>; static TEMPLE_HOUSE: Readonly<Temple>; static TEMPLE_HAPPINESS: Readonly<Temple>; static TEMPLE_PARENT: Readonly<Temple>; static TEMPLE_BODY: Readonly<Temple>; static TEMPLES: readonly Readonly<Temple>[]; static LOOP_TEMPLES: readonly Readonly<Temple>[]; equals(temple: Temple): boolean; } declare function text2DestinyConfig(input: string, calendar?: Calendar): { calendarType: CalendarType | null; year: number | null; month: number | null; day: number | null; isLeapMonth: boolean; bornTimeGround: DayTimeGround | null; hour: number | null; minute: number | null; gender: Gender | null; configType: ConfigType | null; }; export { }