UNPKG

fortel-ziweidoushu

Version:
86 lines 2.77 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Direction = exports.ShadowLight = exports.Luckiness = exports.Element = void 0; const util_1 = __importDefault(require("util")); var Luckiness; (function (Luckiness) { Luckiness[Luckiness["LUCK"] = 1] = "LUCK"; Luckiness[Luckiness["NEUTRAL"] = 0] = "NEUTRAL"; Luckiness[Luckiness["BAD_LUCK"] = -1] = "BAD_LUCK"; })(Luckiness || (exports.Luckiness = Luckiness = {})); class ShadowLight { displayName; constructor(displayName) { this.displayName = displayName; } toJSON() { return this.displayName; } toString() { return this.displayName; } static SHADOW = Object.freeze(new ShadowLight('陰')); static LIGHT = Object.freeze(new ShadowLight('陽')); } exports.ShadowLight = ShadowLight; class Direction { direction; constructor(direction) { this.direction = direction; } add(direction) { if (this.direction * direction.direction === 1) { return Direction.CLOCKWISE; } return Direction.ANTI_CLOCKWISE; } static CLOCKWISE = Object.freeze(new Direction(1)); static ANTI_CLOCKWISE = Object.freeze(new Direction(-1)); } exports.Direction = Direction; class Element { code; displayName; patternNumber; constructor(code, displayName, patternNumber) { this.code = code; this.displayName = displayName; this.patternNumber = patternNumber; } toJSON() { return this.displayName; } toString() { return this.displayName; } // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars [util_1.default.inspect.custom](depth, opts) { return this.toString(); } static get(code) { const element = Element.#ELEMENTS[code]; if (element) { return element; } else { throw new Error('Element not found'); } } static GOLD = Object.freeze(new Element('GOLD', '金四局', 4)); static WOOD = Object.freeze(new Element('WOOD', '木三局', 3)); static EARTH = Object.freeze(new Element('EARTH', '土五局', 5)); static WATER = Object.freeze(new Element('WATER', '水二局', 2)); static FIRE = Object.freeze(new Element('FIRE', '火六局', 6)); static #ELEMENTS = Object.freeze({ GOLD: Element.GOLD, WOOD: Element.WOOD, EARTH: Element.EARTH, WATER: Element.WATER, FIRE: Element.FIRE, }); } exports.Element = Element; //# sourceMappingURL=miscEnums.js.map