@zerospacegg/iolin
Version:
Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)
122 lines (109 loc) • 6.13 kB
JavaScript
import { GameMechanic } from "../../engine/mechanic.js";
import ProtectorateFactionEntity from "../faction/protectorate.js";
// Import main faction entities
import Grell from "../faction/grell.js";
import LegionFactionEntity from "../faction/legion.js";
// Import mercenary faction entities
import Arandi from "../mercenary/arandi.js";
import Chakru from "../mercenary/chakru.js";
import DreadRaiders from "../mercenary/dread.js";
import Marran from "../mercenary/marran.js";
import Valkaru from "../mercenary/valkaru.js";
// import Sanctuary from "../mercenary/sanctuary.js";
// import Koru from "../mercenary/koru.js";
export class TopbarAbilities extends GameMechanic {
constructor() {
super();
this.name = "Topbar Abilities";
this.uuid = "b5d54656-c982-4b01-b78d-1879a0703159";
// Instantiate all factions to get their topbar data dynamically
const protectorate = new ProtectorateFactionEntity();
const grell = new Grell();
const legion = new LegionFactionEntity();
const arandi = new Arandi();
const chakru = new Chakru();
const dreadRaiders = new DreadRaiders();
const marran = new Marran();
const valkaru = new Valkaru();
// const sanctuary = new Sanctuary();
// const koru = new Koru();
// Build dynamic topbar analysis
const mainFactions = [
{ name: protectorate.name, topbars: protectorate.topbars, talents: protectorate.talents },
{ name: grell.name, topbars: grell.topbars, talents: grell.talents },
{ name: legion.name, topbars: legion.topbars, talents: legion.talents },
];
const mercFactions = [
{ name: arandi.name, topbars: arandi.topbars },
{ name: chakru.name, topbars: chakru.topbars },
{ name: dreadRaiders.name, topbars: dreadRaiders.topbars },
{ name: marran.name, topbars: marran.topbars },
{ name: valkaru.name, topbars: valkaru.topbars },
// { name: sanctuary.name, topbars: sanctuary.topbars },
// { name: koru.name, topbars: koru.topbars }
].filter(faction => faction.topbars && Object.keys(faction.topbars).length > 0);
// Analyze main faction topbar patterns
const mainFactionAnalysis = mainFactions
.map(faction => {
const topbarEntries = Object.entries(faction.topbars);
const recall = topbarEntries.find(([key, topbar]) => topbar.topbarType === "recall" || topbar.slot === 1);
const special = topbarEntries.find(([key, topbar]) => topbar.topbarType === "special" || topbar.slot === 2);
const ultimates = topbarEntries.filter(([key, topbar]) => topbar.topbarType === "ultimate" || (topbar.slot >= 3 && topbar.slot <= 4));
// Find level 5 talents that unlock topbars
const level5Talents = Object.entries(faction.talents || {}).filter(([key, talent]) => talent.level === 5);
return `
**${faction.name}:**
- **Recall (Slot 1):** ${recall ? `${recall[1].name} - ${recall[1].description}` : "Unknown"}
- **Core Ability (Slot 2):** ${special ? `${special[1].name} - ${special[1].description}` : "Unknown"}
- **Level 5 Talents:** ${level5Talents.map(([key, talent]) => `${talent.name} (unlocks topbar abilities)`).join(", ") || "None found"}
- **Ultimate Abilities (Slots 3-4):** ${ultimates.map(([key, topbar]) => `Slot ${topbar.slot}: ${topbar.name}`).join(", ") || "None"}`;
})
.join("\n");
// Analyze mercenary faction topbars
const mercAnalysis = mercFactions.length > 0
? mercFactions
.map(faction => {
const topbarEntries = Object.entries(faction.topbars);
return `
**${faction.name}:** ${topbarEntries.map(([key, topbar]) => `${topbar.name} (Slot ${topbar.slot || "Unknown"})`).join(", ")}`;
})
.join("\n")
: "\n*No mercenary factions with topbar abilities found.*";
// Simple description for API/JSON usage
this.description =
"Topbar abilities are powerful faction-specific powers activated via a 4-slot action bar system, with recall, core abilities, and talent-unlocked ultimates that define faction identity.";
// Rich wiki content with {{box}} components
this.wiki = `
## Overview
Each faction in ZeroSpace has access to topbar abilities - powerful faction-specific powers activated via the top action bar using a consistent 4-slot structure.
{{box-grid}}
{{box header="Slot Structure" icon="mdi-view-grid"}}
**Universal 4-Slot Layout**
1. **Slot 1 (Q):** Faction-specific recall ability
2. **Slot 2 (W):** Core faction mechanic ability
3. **Slot 3 (E):** Ultimate ability (talent unlock)
4. **Slot 4 (R):** Ultimate ability (talent unlock)
- **Choice System**: Level 5 talents unlock slots 3-4 (choose one)
{{/box}}
{{box header="Energy System" icon="mdi-battery-charging"}}
**Topbar Energy Management**
- **Separate Pool**: Independent from unit energy systems
- **Generation**: Slow passive gain + bonus when your units die
- **Cooldowns**: Abilities have faction-specific cooldown periods
- **Strategic Resource**: Must manage energy for optimal timing
{{/box}}
{{/box-grid}}
## Main Faction Topbars
All main factions follow the standardized slot pattern:
### Current Main Faction Analysis
${mainFactionAnalysis}
## Mercenary Faction Topbars
Mercenary factions may provide additional topbar abilities when chosen as your mercenary ally:
${mercAnalysis}
## Strategic Impact
Topbar abilities are crucial for faction identity and provide significant tactical advantages when used effectively in combination with your faction's core strategies and unit compositions.
`;
}
}
TopbarAbilities.src = "src/zerospace/mechanic/topbar-abilities.ts";
//# sourceMappingURL=topbar-abilities.js.map