UNPKG

@zsnout/ithkuil

Version:

A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.

104 lines (103 loc) 3.43 kB
import { WithWYAlternative } from "../../helpers/with-wy-alternative.js"; /** An effect. */ export type Effect = "1:BEN" | "2:BEN" | "3:BEN" | "SLF:BEN" | "UNK" | "SLF:DET" | "3:DET" | "2:DET" | "1:DET"; /** An array containing all effects. */ export declare const ALL_EFFECTS: readonly Effect[]; /** * An object mapping effects to their `WithWYAlternative` Ithkuilic * translations. */ export declare const EFFECT_TO_ITHKUIL_MAP: { readonly "1:BEN": WithWYAlternative; readonly "2:BEN": WithWYAlternative; readonly "3:BEN": WithWYAlternative; readonly "SLF:BEN": WithWYAlternative; readonly UNK: WithWYAlternative; readonly "SLF:DET": WithWYAlternative; readonly "3:DET": WithWYAlternative; readonly "2:DET": WithWYAlternative; readonly "1:DET": WithWYAlternative; }; /** An object mapping effects to their names. */ export declare const EFFECT_TO_NAME_MAP: { readonly "1:BEN": "Beneficial to Speaker"; readonly "2:BEN": "Beneficial to Addressee"; readonly "3:BEN": "Beneficial to 3rd Party"; readonly "SLF:BEN": "Beneficial to Self"; readonly UNK: "Unknown"; readonly "SLF:DET": "Detrimental to Self"; readonly "3:DET": "Detrimental to Third Party"; readonly "2:DET": "Detrimental to Addressee"; readonly "1:DET": "Detrimental to Speaker"; }; /** * Converts an effect into Ithkuil. * * @param effect The effect to be converted. * @returns A `WithWYAlternative` containing romanized Ithkuilic text * representing the effect. */ export declare function effectToIthkuil(effect: Effect): WithWYAlternative; /** An effect represented as an object. */ export type EffectObject = { /** The effect: beneficial, detrimental, or unknown. */ readonly effect: "BEN" | "DET"; /** The target of the effect. */ readonly target: 1 | 2 | 3 | "SLF"; } | { /** The effect: beneficial, detrimental, or unknown. */ readonly effect: "UNK"; readonly target?: undefined; }; /** An object mapping from effects to their deconstructed objects. */ export declare const EFFECT_TO_EFFECT_OBJECT_MAP: { readonly "1:BEN": { readonly effect: "BEN"; readonly target: 1; }; readonly "2:BEN": { readonly effect: "BEN"; readonly target: 2; }; readonly "3:BEN": { readonly effect: "BEN"; readonly target: 3; }; readonly "SLF:BEN": { readonly effect: "BEN"; readonly target: "SLF"; }; readonly UNK: { readonly effect: "UNK"; }; readonly "SLF:DET": { readonly effect: "DET"; readonly target: "SLF"; }; readonly "3:DET": { readonly effect: "DET"; readonly target: 3; }; readonly "2:DET": { readonly effect: "DET"; readonly target: 2; }; readonly "1:DET": { readonly effect: "DET"; readonly target: 1; }; }; /** * Deconstructs an effect into its separate components. * * @param effect The effect to be deconstructed. * @returns An object containing the effect and target of the original effect. */ export declare function effectToEffectObject(effect: Effect): EffectObject; /** * Reconstructs an effect object into a single effect. * * @param effectObject The effect to be reconstructed. * @returns A string representing the effect and target of the object. */ export declare function effectObjectToEffect(effectObject: EffectObject): Effect;