UNPKG

@zerospacegg/iolin

Version:

Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)

97 lines 2.31 kB
"use strict"; /** * Map - RTS map class for ZeroSpace maps * Using functional constructor pattern */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Map1p = exports.MapFFA = exports.Map2v2 = exports.Map1v1 = exports.Map = void 0; const entity_js_1 = require("./entity.cjs"); /** * RTS Map class - extends Entity with map-specific properties * Usage: new Map1v1("Ascension 1v1", (map) => { map.xpTowers = 3; }) * * This is abstract - you MUST use Map1v1, Map2v2, MapFFA, or Map1p subclasses */ class Map extends entity_js_1.Entity { get type() { return "map"; } constructor() { super(); this.mapSize = "normal"; this.inLadderPool = true; this.tier = ""; // Maps don't have tiers // Add dynamic tagger for ladder pool this.dynamicTaggers.push([(entity) => entity.inLadderPool, "ladder"]); } /** Public subtype getter - just for JSON serialization */ get subtype() { return this.mapType; } get id() { return `map/${this.subtype}/${this.slug}`; } /** * JSON.stringify() calls this automatically */ toJSON() { return { ...super.toJSON(), xpTowers: this.xpTowers, fluxDistance: this.fluxDistance, mapSize: this.mapSize, inLadderPool: this.inLadderPool, players: this.players, }; } } exports.Map = Map; class Map1v1 extends Map { get subtype() { return "1v1"; } get mapType() { return this.subtype; } get players() { return 2; } } exports.Map1v1 = Map1v1; class Map2v2 extends Map { get subtype() { return "2v2"; } get mapType() { return this.subtype; } get players() { return 4; } } exports.Map2v2 = Map2v2; class MapFFA extends Map { get subtype() { return "ffa"; } get mapType() { return this.subtype; } get players() { return 4; // technically 8 with AI but eh } } exports.MapFFA = MapFFA; class Map1p extends Map { get subtype() { return "1p"; } get mapType() { return this.subtype; } get players() { return 1; } } exports.Map1p = Map1p; //# sourceMappingURL=map.js.map