idlerpg.sh 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/dist/affix/AffixRegistry.d.ts +68 -0
- package/dist/affix/AffixRegistry.d.ts.map +1 -0
- package/dist/affix/AffixRegistry.js +245 -0
- package/dist/affix/AffixRegistry.js.map +1 -0
- package/dist/affix/PluginLoader.d.ts +66 -0
- package/dist/affix/PluginLoader.d.ts.map +1 -0
- package/dist/affix/PluginLoader.js +321 -0
- package/dist/affix/PluginLoader.js.map +1 -0
- package/dist/affix/builtin.d.ts +6 -0
- package/dist/affix/builtin.d.ts.map +1 -0
- package/dist/affix/builtin.js +311 -0
- package/dist/affix/builtin.js.map +1 -0
- package/dist/affix/index.d.ts +8 -0
- package/dist/affix/index.d.ts.map +1 -0
- package/dist/affix/index.js +11 -0
- package/dist/affix/index.js.map +1 -0
- package/dist/affix/types.d.ts +152 -0
- package/dist/affix/types.d.ts.map +1 -0
- package/dist/affix/types.js +8 -0
- package/dist/affix/types.js.map +1 -0
- package/dist/ai/PlayKitClient.d.ts +208 -0
- package/dist/ai/PlayKitClient.d.ts.map +1 -0
- package/dist/ai/PlayKitClient.js +721 -0
- package/dist/ai/PlayKitClient.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/app/App.d.ts +85 -0
- package/dist/app/App.d.ts.map +1 -0
- package/dist/app/App.js +296 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/EventBus.d.ts +222 -0
- package/dist/app/EventBus.d.ts.map +1 -0
- package/dist/app/EventBus.js +88 -0
- package/dist/app/EventBus.js.map +1 -0
- package/dist/app/Keybind.d.ts +83 -0
- package/dist/app/Keybind.d.ts.map +1 -0
- package/dist/app/Keybind.js +184 -0
- package/dist/app/Keybind.js.map +1 -0
- package/dist/app/Router.d.ts +123 -0
- package/dist/app/Router.d.ts.map +1 -0
- package/dist/app/Router.js +142 -0
- package/dist/app/Router.js.map +1 -0
- package/dist/app/ScreenManager.d.ts +97 -0
- package/dist/app/ScreenManager.d.ts.map +1 -0
- package/dist/app/ScreenManager.js +216 -0
- package/dist/app/ScreenManager.js.map +1 -0
- package/dist/app/index.d.ts +14 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +19 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/screens/BaseScreen.d.ts +101 -0
- package/dist/app/screens/BaseScreen.d.ts.map +1 -0
- package/dist/app/screens/BaseScreen.js +132 -0
- package/dist/app/screens/BaseScreen.js.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts +42 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.js +467 -0
- package/dist/app/screens/CharacterCreationScreen.js.map +1 -0
- package/dist/app/screens/CombatScreen.d.ts +30 -0
- package/dist/app/screens/CombatScreen.d.ts.map +1 -0
- package/dist/app/screens/CombatScreen.js +309 -0
- package/dist/app/screens/CombatScreen.js.map +1 -0
- package/dist/app/screens/DialogScreen.d.ts +29 -0
- package/dist/app/screens/DialogScreen.d.ts.map +1 -0
- package/dist/app/screens/DialogScreen.js +295 -0
- package/dist/app/screens/DialogScreen.js.map +1 -0
- package/dist/app/screens/ExploreScreen.d.ts +50 -0
- package/dist/app/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/app/screens/ExploreScreen.js +308 -0
- package/dist/app/screens/ExploreScreen.js.map +1 -0
- package/dist/app/screens/HelpScreen.d.ts +12 -0
- package/dist/app/screens/HelpScreen.d.ts.map +1 -0
- package/dist/app/screens/HelpScreen.js +155 -0
- package/dist/app/screens/HelpScreen.js.map +1 -0
- package/dist/app/screens/InventoryScreen.d.ts +27 -0
- package/dist/app/screens/InventoryScreen.d.ts.map +1 -0
- package/dist/app/screens/InventoryScreen.js +326 -0
- package/dist/app/screens/InventoryScreen.js.map +1 -0
- package/dist/app/screens/PrologueScreen.d.ts +24 -0
- package/dist/app/screens/PrologueScreen.d.ts.map +1 -0
- package/dist/app/screens/PrologueScreen.js +176 -0
- package/dist/app/screens/PrologueScreen.js.map +1 -0
- package/dist/app/screens/TitleScreen.d.ts +42 -0
- package/dist/app/screens/TitleScreen.d.ts.map +1 -0
- package/dist/app/screens/TitleScreen.js +380 -0
- package/dist/app/screens/TitleScreen.js.map +1 -0
- package/dist/app/screens/TravelScreen.d.ts +22 -0
- package/dist/app/screens/TravelScreen.d.ts.map +1 -0
- package/dist/app/screens/TravelScreen.js +122 -0
- package/dist/app/screens/TravelScreen.js.map +1 -0
- package/dist/app/screens/index.d.ts +14 -0
- package/dist/app/screens/index.d.ts.map +1 -0
- package/dist/app/screens/index.js +17 -0
- package/dist/app/screens/index.js.map +1 -0
- package/dist/commands/CommandRegistry.d.ts +91 -0
- package/dist/commands/CommandRegistry.d.ts.map +1 -0
- package/dist/commands/CommandRegistry.js +159 -0
- package/dist/commands/CommandRegistry.js.map +1 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +10 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/Actor.d.ts +103 -0
- package/dist/core/Actor.d.ts.map +1 -0
- package/dist/core/Actor.js +409 -0
- package/dist/core/Actor.js.map +1 -0
- package/dist/core/Combat.d.ts +37 -0
- package/dist/core/Combat.d.ts.map +1 -0
- package/dist/core/Combat.js +294 -0
- package/dist/core/Combat.js.map +1 -0
- package/dist/core/DungeonRunner.d.ts +169 -0
- package/dist/core/DungeonRunner.d.ts.map +1 -0
- package/dist/core/DungeonRunner.js +627 -0
- package/dist/core/DungeonRunner.js.map +1 -0
- package/dist/core/Game.d.ts +133 -0
- package/dist/core/Game.d.ts.map +1 -0
- package/dist/core/Game.js +644 -0
- package/dist/core/Game.js.map +1 -0
- package/dist/core/IdleCombat.d.ts +61 -0
- package/dist/core/IdleCombat.d.ts.map +1 -0
- package/dist/core/IdleCombat.js +461 -0
- package/dist/core/IdleCombat.js.map +1 -0
- package/dist/core/IdleGameManager.d.ts +198 -0
- package/dist/core/IdleGameManager.d.ts.map +1 -0
- package/dist/core/IdleGameManager.js +688 -0
- package/dist/core/IdleGameManager.js.map +1 -0
- package/dist/core/IdleSaveManager.d.ts +109 -0
- package/dist/core/IdleSaveManager.d.ts.map +1 -0
- package/dist/core/IdleSaveManager.js +296 -0
- package/dist/core/IdleSaveManager.js.map +1 -0
- package/dist/core/NewGameFlowManager.d.ts +64 -0
- package/dist/core/NewGameFlowManager.d.ts.map +1 -0
- package/dist/core/NewGameFlowManager.js +153 -0
- package/dist/core/NewGameFlowManager.js.map +1 -0
- package/dist/core/Player.d.ts +65 -0
- package/dist/core/Player.d.ts.map +1 -0
- package/dist/core/Player.js +261 -0
- package/dist/core/Player.js.map +1 -0
- package/dist/core/RoomHandlers.d.ts +75 -0
- package/dist/core/RoomHandlers.d.ts.map +1 -0
- package/dist/core/RoomHandlers.js +383 -0
- package/dist/core/RoomHandlers.js.map +1 -0
- package/dist/core/SaveManager.d.ts +84 -0
- package/dist/core/SaveManager.d.ts.map +1 -0
- package/dist/core/SaveManager.js +281 -0
- package/dist/core/SaveManager.js.map +1 -0
- package/dist/core/SaveMigration.d.ts +69 -0
- package/dist/core/SaveMigration.d.ts.map +1 -0
- package/dist/core/SaveMigration.js +408 -0
- package/dist/core/SaveMigration.js.map +1 -0
- package/dist/core/StateAdapter.d.ts +79 -0
- package/dist/core/StateAdapter.d.ts.map +1 -0
- package/dist/core/StateAdapter.js +397 -0
- package/dist/core/StateAdapter.js.map +1 -0
- package/dist/core/Team.d.ts +145 -0
- package/dist/core/Team.d.ts.map +1 -0
- package/dist/core/Team.js +371 -0
- package/dist/core/Team.js.map +1 -0
- package/dist/core/TeamCombat.d.ts +88 -0
- package/dist/core/TeamCombat.d.ts.map +1 -0
- package/dist/core/TeamCombat.js +405 -0
- package/dist/core/TeamCombat.js.map +1 -0
- package/dist/core/TeamDungeonRunner.d.ts +186 -0
- package/dist/core/TeamDungeonRunner.d.ts.map +1 -0
- package/dist/core/TeamDungeonRunner.js +758 -0
- package/dist/core/TeamDungeonRunner.js.map +1 -0
- package/dist/core/TimeManager.d.ts +114 -0
- package/dist/core/TimeManager.d.ts.map +1 -0
- package/dist/core/TimeManager.js +318 -0
- package/dist/core/TimeManager.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/timeConstants.d.ts +135 -0
- package/dist/core/timeConstants.d.ts.map +1 -0
- package/dist/core/timeConstants.js +157 -0
- package/dist/core/timeConstants.js.map +1 -0
- package/dist/core/types.d.ts +780 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/data/continents/index.d.ts +163 -0
- package/dist/data/continents/index.d.ts.map +1 -0
- package/dist/data/continents/index.js +31 -0
- package/dist/data/continents/index.js.map +1 -0
- package/dist/data/continents/verdantia.d.ts +294 -0
- package/dist/data/continents/verdantia.d.ts.map +1 -0
- package/dist/data/continents/verdantia.js +327 -0
- package/dist/data/continents/verdantia.js.map +1 -0
- package/dist/handlers/DialogHandler.d.ts +95 -0
- package/dist/handlers/DialogHandler.d.ts.map +1 -0
- package/dist/handlers/DialogHandler.js +450 -0
- package/dist/handlers/DialogHandler.js.map +1 -0
- package/dist/handlers/SaveLoadHandler.d.ts +60 -0
- package/dist/handlers/SaveLoadHandler.d.ts.map +1 -0
- package/dist/handlers/SaveLoadHandler.js +187 -0
- package/dist/handlers/SaveLoadHandler.js.map +1 -0
- package/dist/handlers/TitleScreenHandler.d.ts +43 -0
- package/dist/handlers/TitleScreenHandler.d.ts.map +1 -0
- package/dist/handlers/TitleScreenHandler.js +508 -0
- package/dist/handlers/TitleScreenHandler.js.map +1 -0
- package/dist/handlers/WorkshopHandler.d.ts +75 -0
- package/dist/handlers/WorkshopHandler.d.ts.map +1 -0
- package/dist/handlers/WorkshopHandler.js +401 -0
- package/dist/handlers/WorkshopHandler.js.map +1 -0
- package/dist/handlers/index.d.ts +12 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +14 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/types.d.ts +34 -0
- package/dist/handlers/types.d.ts.map +1 -0
- package/dist/handlers/types.js +8 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +130 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +40 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +105 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/types.d.ts +133 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +8 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/zh.d.ts +3 -0
- package/dist/i18n/zh.d.ts.map +1 -0
- package/dist/i18n/zh.js +130 -0
- package/dist/i18n/zh.js.map +1 -0
- package/dist/instrument.d.ts +8 -0
- package/dist/instrument.d.ts.map +1 -0
- package/dist/instrument.js +33 -0
- package/dist/instrument.js.map +1 -0
- package/dist/main-new.d.ts +12 -0
- package/dist/main-new.d.ts.map +1 -0
- package/dist/main-new.js +32 -0
- package/dist/main-new.js.map +1 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +2816 -0
- package/dist/main.js.map +1 -0
- package/dist/map/ContinentManager.d.ts +88 -0
- package/dist/map/ContinentManager.d.ts.map +1 -0
- package/dist/map/ContinentManager.js +241 -0
- package/dist/map/ContinentManager.js.map +1 -0
- package/dist/map/DungeonGenerator.d.ts +32 -0
- package/dist/map/DungeonGenerator.d.ts.map +1 -0
- package/dist/map/DungeonGenerator.js +615 -0
- package/dist/map/DungeonGenerator.js.map +1 -0
- package/dist/map/MapGenerator.d.ts +27 -0
- package/dist/map/MapGenerator.d.ts.map +1 -0
- package/dist/map/MapGenerator.js +485 -0
- package/dist/map/MapGenerator.js.map +1 -0
- package/dist/map/index.d.ts +5 -0
- package/dist/map/index.d.ts.map +1 -0
- package/dist/map/index.js +8 -0
- package/dist/map/index.js.map +1 -0
- package/dist/npc/NPCGenerator.d.ts +68 -0
- package/dist/npc/NPCGenerator.d.ts.map +1 -0
- package/dist/npc/NPCGenerator.js +468 -0
- package/dist/npc/NPCGenerator.js.map +1 -0
- package/dist/npc/NPCManager.d.ts +86 -0
- package/dist/npc/NPCManager.d.ts.map +1 -0
- package/dist/npc/NPCManager.js +217 -0
- package/dist/npc/NPCManager.js.map +1 -0
- package/dist/npc/fixedNPCs.d.ts +7 -0
- package/dist/npc/fixedNPCs.d.ts.map +1 -0
- package/dist/npc/fixedNPCs.js +196 -0
- package/dist/npc/fixedNPCs.js.map +1 -0
- package/dist/npc/index.d.ts +9 -0
- package/dist/npc/index.d.ts.map +1 -0
- package/dist/npc/index.js +12 -0
- package/dist/npc/index.js.map +1 -0
- package/dist/npc/traits.d.ts +33 -0
- package/dist/npc/traits.d.ts.map +1 -0
- package/dist/npc/traits.js +795 -0
- package/dist/npc/traits.js.map +1 -0
- package/dist/npc/types.d.ts +193 -0
- package/dist/npc/types.d.ts.map +1 -0
- package/dist/npc/types.js +9 -0
- package/dist/npc/types.js.map +1 -0
- package/dist/quest/QuestManager.d.ts +79 -0
- package/dist/quest/QuestManager.d.ts.map +1 -0
- package/dist/quest/QuestManager.js +273 -0
- package/dist/quest/QuestManager.js.map +1 -0
- package/dist/quest/index.d.ts +6 -0
- package/dist/quest/index.d.ts.map +1 -0
- package/dist/quest/index.js +9 -0
- package/dist/quest/index.js.map +1 -0
- package/dist/quest/types.d.ts +81 -0
- package/dist/quest/types.d.ts.map +1 -0
- package/dist/quest/types.js +8 -0
- package/dist/quest/types.js.map +1 -0
- package/dist/strategy/StrategyExecutor.d.ts +159 -0
- package/dist/strategy/StrategyExecutor.d.ts.map +1 -0
- package/dist/strategy/StrategyExecutor.js +479 -0
- package/dist/strategy/StrategyExecutor.js.map +1 -0
- package/dist/strategy/StrategyParser.d.ts +48 -0
- package/dist/strategy/StrategyParser.d.ts.map +1 -0
- package/dist/strategy/StrategyParser.js +321 -0
- package/dist/strategy/StrategyParser.js.map +1 -0
- package/dist/strategy/defaultStrategy.d.ts +40 -0
- package/dist/strategy/defaultStrategy.d.ts.map +1 -0
- package/dist/strategy/defaultStrategy.js +254 -0
- package/dist/strategy/defaultStrategy.js.map +1 -0
- package/dist/strategy/index.d.ts +8 -0
- package/dist/strategy/index.d.ts.map +1 -0
- package/dist/strategy/index.js +14 -0
- package/dist/strategy/index.js.map +1 -0
- package/dist/tui/ExploreMenu.d.ts +106 -0
- package/dist/tui/ExploreMenu.d.ts.map +1 -0
- package/dist/tui/ExploreMenu.js +282 -0
- package/dist/tui/ExploreMenu.js.map +1 -0
- package/dist/tui/GameUI.d.ts +313 -0
- package/dist/tui/GameUI.d.ts.map +1 -0
- package/dist/tui/GameUI.js +2116 -0
- package/dist/tui/GameUI.js.map +1 -0
- package/dist/tui/GameUIAdapter.d.ts +207 -0
- package/dist/tui/GameUIAdapter.d.ts.map +1 -0
- package/dist/tui/GameUIAdapter.js +1342 -0
- package/dist/tui/GameUIAdapter.js.map +1 -0
- package/dist/tui/Input.d.ts +139 -0
- package/dist/tui/Input.d.ts.map +1 -0
- package/dist/tui/Input.js +278 -0
- package/dist/tui/Input.js.map +1 -0
- package/dist/tui/Menu.d.ts +110 -0
- package/dist/tui/Menu.d.ts.map +1 -0
- package/dist/tui/Menu.js +365 -0
- package/dist/tui/Menu.js.map +1 -0
- package/dist/tui/Screen.d.ts +228 -0
- package/dist/tui/Screen.d.ts.map +1 -0
- package/dist/tui/Screen.js +502 -0
- package/dist/tui/Screen.js.map +1 -0
- package/dist/tui/components/Box.d.ts +36 -0
- package/dist/tui/components/Box.d.ts.map +1 -0
- package/dist/tui/components/Box.js +43 -0
- package/dist/tui/components/Box.js.map +1 -0
- package/dist/tui/components/List.d.ts +69 -0
- package/dist/tui/components/List.d.ts.map +1 -0
- package/dist/tui/components/List.js +136 -0
- package/dist/tui/components/List.js.map +1 -0
- package/dist/tui/components/ProgressBar.d.ts +42 -0
- package/dist/tui/components/ProgressBar.d.ts.map +1 -0
- package/dist/tui/components/ProgressBar.js +75 -0
- package/dist/tui/components/ProgressBar.js.map +1 -0
- package/dist/tui/components/index.d.ts +8 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js +11 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/core/BaseSection.d.ts +98 -0
- package/dist/tui/core/BaseSection.d.ts.map +1 -0
- package/dist/tui/core/BaseSection.js +174 -0
- package/dist/tui/core/BaseSection.js.map +1 -0
- package/dist/tui/core/Component.d.ts +61 -0
- package/dist/tui/core/Component.d.ts.map +1 -0
- package/dist/tui/core/Component.js +32 -0
- package/dist/tui/core/Component.js.map +1 -0
- package/dist/tui/core/Section.d.ts +101 -0
- package/dist/tui/core/Section.d.ts.map +1 -0
- package/dist/tui/core/Section.js +24 -0
- package/dist/tui/core/Section.js.map +1 -0
- package/dist/tui/core/SectionManager.d.ts +108 -0
- package/dist/tui/core/SectionManager.d.ts.map +1 -0
- package/dist/tui/core/SectionManager.js +258 -0
- package/dist/tui/core/SectionManager.js.map +1 -0
- package/dist/tui/core/index.d.ts +9 -0
- package/dist/tui/core/index.d.ts.map +1 -0
- package/dist/tui/core/index.js +12 -0
- package/dist/tui/core/index.js.map +1 -0
- package/dist/tui/index.d.ts +15 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +23 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screens/BaseScreen.d.ts +62 -0
- package/dist/tui/screens/BaseScreen.d.ts.map +1 -0
- package/dist/tui/screens/BaseScreen.js +55 -0
- package/dist/tui/screens/BaseScreen.js.map +1 -0
- package/dist/tui/screens/CombatScreen.d.ts +43 -0
- package/dist/tui/screens/CombatScreen.d.ts.map +1 -0
- package/dist/tui/screens/CombatScreen.js +125 -0
- package/dist/tui/screens/CombatScreen.js.map +1 -0
- package/dist/tui/screens/DialogScreen.d.ts +53 -0
- package/dist/tui/screens/DialogScreen.d.ts.map +1 -0
- package/dist/tui/screens/DialogScreen.js +90 -0
- package/dist/tui/screens/DialogScreen.js.map +1 -0
- package/dist/tui/screens/DungeonScreen.d.ts +80 -0
- package/dist/tui/screens/DungeonScreen.d.ts.map +1 -0
- package/dist/tui/screens/DungeonScreen.js +317 -0
- package/dist/tui/screens/DungeonScreen.js.map +1 -0
- package/dist/tui/screens/ExploreScreen.d.ts +69 -0
- package/dist/tui/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/tui/screens/ExploreScreen.js +224 -0
- package/dist/tui/screens/ExploreScreen.js.map +1 -0
- package/dist/tui/screens/SectionScreen.d.ts +84 -0
- package/dist/tui/screens/SectionScreen.d.ts.map +1 -0
- package/dist/tui/screens/SectionScreen.js +156 -0
- package/dist/tui/screens/SectionScreen.js.map +1 -0
- package/dist/tui/screens/TitleScreen.d.ts +40 -0
- package/dist/tui/screens/TitleScreen.d.ts.map +1 -0
- package/dist/tui/screens/TitleScreen.js +253 -0
- package/dist/tui/screens/TitleScreen.js.map +1 -0
- package/dist/tui/screens/TownScreen.d.ts +98 -0
- package/dist/tui/screens/TownScreen.d.ts.map +1 -0
- package/dist/tui/screens/TownScreen.js +370 -0
- package/dist/tui/screens/TownScreen.js.map +1 -0
- package/dist/tui/screens/TravelScreen.d.ts +67 -0
- package/dist/tui/screens/TravelScreen.d.ts.map +1 -0
- package/dist/tui/screens/TravelScreen.js +286 -0
- package/dist/tui/screens/TravelScreen.js.map +1 -0
- package/dist/tui/screens/index.d.ts +8 -0
- package/dist/tui/screens/index.d.ts.map +1 -0
- package/dist/tui/screens/index.js +17 -0
- package/dist/tui/screens/index.js.map +1 -0
- package/dist/tui/sections/ActionsSection.d.ts +71 -0
- package/dist/tui/sections/ActionsSection.d.ts.map +1 -0
- package/dist/tui/sections/ActionsSection.js +184 -0
- package/dist/tui/sections/ActionsSection.js.map +1 -0
- package/dist/tui/sections/DungeonSection.d.ts +65 -0
- package/dist/tui/sections/DungeonSection.d.ts.map +1 -0
- package/dist/tui/sections/DungeonSection.js +144 -0
- package/dist/tui/sections/DungeonSection.js.map +1 -0
- package/dist/tui/sections/EventsSection.d.ts +50 -0
- package/dist/tui/sections/EventsSection.d.ts.map +1 -0
- package/dist/tui/sections/EventsSection.js +134 -0
- package/dist/tui/sections/EventsSection.js.map +1 -0
- package/dist/tui/sections/MapSection.d.ts +66 -0
- package/dist/tui/sections/MapSection.d.ts.map +1 -0
- package/dist/tui/sections/MapSection.js +669 -0
- package/dist/tui/sections/MapSection.js.map +1 -0
- package/dist/tui/sections/StatusSection.d.ts +47 -0
- package/dist/tui/sections/StatusSection.d.ts.map +1 -0
- package/dist/tui/sections/StatusSection.js +133 -0
- package/dist/tui/sections/StatusSection.js.map +1 -0
- package/dist/tui/sections/TeamSection.d.ts +71 -0
- package/dist/tui/sections/TeamSection.d.ts.map +1 -0
- package/dist/tui/sections/TeamSection.js +224 -0
- package/dist/tui/sections/TeamSection.js.map +1 -0
- package/dist/tui/sections/TravelingSection.d.ts +51 -0
- package/dist/tui/sections/TravelingSection.d.ts.map +1 -0
- package/dist/tui/sections/TravelingSection.js +106 -0
- package/dist/tui/sections/TravelingSection.js.map +1 -0
- package/dist/tui/sections/index.d.ts +9 -0
- package/dist/tui/sections/index.d.ts.map +1 -0
- package/dist/tui/sections/index.js +12 -0
- package/dist/tui/sections/index.js.map +1 -0
- package/dist/ui/Terminal.d.ts +68 -0
- package/dist/ui/Terminal.d.ts.map +1 -0
- package/dist/ui/Terminal.js +297 -0
- package/dist/ui/Terminal.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +8 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/utils/configMigration.d.ts +14 -0
- package/dist/utils/configMigration.d.ts.map +1 -0
- package/dist/utils/configMigration.js +92 -0
- package/dist/utils/configMigration.js.map +1 -0
- package/dist/utils/errorHandler.d.ts +86 -0
- package/dist/utils/errorHandler.d.ts.map +1 -0
- package/dist/utils/errorHandler.js +224 -0
- package/dist/utils/errorHandler.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/weapon/WeaponFactory.d.ts +32 -0
- package/dist/weapon/WeaponFactory.d.ts.map +1 -0
- package/dist/weapon/WeaponFactory.js +216 -0
- package/dist/weapon/WeaponFactory.js.map +1 -0
- package/dist/weapon/index.d.ts +5 -0
- package/dist/weapon/index.d.ts.map +1 -0
- package/dist/weapon/index.js +8 -0
- package/dist/weapon/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy Parser
|
|
3
|
+
* Uses AI to parse natural language strategy descriptions into StrategyStateMachine
|
|
4
|
+
*
|
|
5
|
+
* NO FALLBACKS - All AI errors prompt for retry
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="790bc4da-3898-55f5-a846-d7508cda23fb")}catch(e){}}();
|
|
9
|
+
import { getAIClient, MODELS } from '../ai/PlayKitClient.js';
|
|
10
|
+
import { createError, getErrorHandler, } from '../utils/errorHandler.js';
|
|
11
|
+
import { DEFAULT_STRATEGY } from './defaultStrategy.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// AI Prompts
|
|
14
|
+
// ============================================================================
|
|
15
|
+
const STRATEGY_PARSE_PROMPT = `You are a strategy parser for an IdleRPG game. Convert the player's natural language strategy into a JSON state machine.
|
|
16
|
+
|
|
17
|
+
The output MUST be a valid JSON object with this exact structure:
|
|
18
|
+
{
|
|
19
|
+
"combat": {
|
|
20
|
+
"targetPriority": ["healer", "caster", "ranged", "lowest_hp", "highest_damage", "boss", "minion", "tank"],
|
|
21
|
+
"itemUsage": [
|
|
22
|
+
{ "itemType": "health_potion", "condition": "hp_below", "threshold": 0.3, "priority": 10 }
|
|
23
|
+
],
|
|
24
|
+
"retreatCondition": {
|
|
25
|
+
"enabled": true,
|
|
26
|
+
"hpThreshold": 0.15,
|
|
27
|
+
"partyWipeRisk": true,
|
|
28
|
+
"bossExempt": true
|
|
29
|
+
},
|
|
30
|
+
"skillPriority": [],
|
|
31
|
+
"focusTarget": "highest_damage"
|
|
32
|
+
},
|
|
33
|
+
"exploration": {
|
|
34
|
+
"roomPriority": ["treasure", "rest", "shop", "combat", "event", "exit"],
|
|
35
|
+
"deadEndBehavior": "rest_if_needed",
|
|
36
|
+
"treasureHunting": true,
|
|
37
|
+
"thoroughExploration": false,
|
|
38
|
+
"avoidTraps": false,
|
|
39
|
+
"avoidElites": false,
|
|
40
|
+
"restThreshold": 0.5
|
|
41
|
+
},
|
|
42
|
+
"resource": {
|
|
43
|
+
"hpThreshold": 0.5,
|
|
44
|
+
"hpAction": "use_item",
|
|
45
|
+
"mpThreshold": 0.3,
|
|
46
|
+
"mpAction": "use_item",
|
|
47
|
+
"goldReserve": 100,
|
|
48
|
+
"sellJunk": true,
|
|
49
|
+
"repairThreshold": 0.3
|
|
50
|
+
},
|
|
51
|
+
"encounter": {
|
|
52
|
+
"npcBehavior": "always_talk",
|
|
53
|
+
"eventRiskTolerance": 0.5,
|
|
54
|
+
"acceptQuests": true,
|
|
55
|
+
"shopBehavior": "buy_consumables"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Valid values:
|
|
60
|
+
- targetPriority: "healer", "ranged", "caster", "tank", "lowest_hp", "highest_damage", "boss", "minion"
|
|
61
|
+
- focusTarget: "highest_damage", "lowest_hp", "highest_threat", "random"
|
|
62
|
+
- itemType: "health_potion", "mana_potion", "buff", "debuff", "revive"
|
|
63
|
+
- condition: "hp_below", "mp_below", "status_effect", "enemy_count", "turn_count"
|
|
64
|
+
- deadEndBehavior: "retreat_immediately", "search_thoroughly", "rest_if_needed"
|
|
65
|
+
- hpAction/mpAction: "use_item", "rest", "retreat_to_town", "continue"
|
|
66
|
+
- npcBehavior: "always_talk", "quest_givers_only", "skip"
|
|
67
|
+
- shopBehavior: "buy_upgrades", "sell_only", "buy_consumables", "skip"
|
|
68
|
+
- roomPriority: "combat", "treasure", "event", "shop", "rest", "exit"
|
|
69
|
+
|
|
70
|
+
IMPORTANT:
|
|
71
|
+
- Output ONLY the JSON object, no markdown, no explanation
|
|
72
|
+
- All threshold values should be between 0 and 1 (percentages)
|
|
73
|
+
- Arrays should be ordered by priority (first = highest priority)
|
|
74
|
+
|
|
75
|
+
Player's strategy description:
|
|
76
|
+
`;
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Parser Class
|
|
79
|
+
// ============================================================================
|
|
80
|
+
export class StrategyParser {
|
|
81
|
+
aiClient = getAIClient();
|
|
82
|
+
errorHandler = getErrorHandler();
|
|
83
|
+
/**
|
|
84
|
+
* Parse natural language strategy into StrategyStateMachine
|
|
85
|
+
* Returns error if AI fails - NO FALLBACK
|
|
86
|
+
*/
|
|
87
|
+
async parseStrategy(description) {
|
|
88
|
+
if (!description.trim()) {
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: createError('PARSE_ERROR', 'Strategy description is empty'),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const prompt = STRATEGY_PARSE_PROMPT + description;
|
|
95
|
+
// SENTRY ADD HERE - Log strategy parse attempt
|
|
96
|
+
const result = await this.errorHandler.executeWithRetry(async () => {
|
|
97
|
+
const client = this.aiClient.getSDK().createChatClient(MODELS.text.balanced);
|
|
98
|
+
const response = await client.chat(prompt);
|
|
99
|
+
const responseText = typeof response === 'string' ? response : response.content || '';
|
|
100
|
+
return responseText;
|
|
101
|
+
}, 'strategy_parse');
|
|
102
|
+
if (!result.success) {
|
|
103
|
+
// SENTRY ADD HERE - Log AI failure for strategy parsing
|
|
104
|
+
return {
|
|
105
|
+
success: false,
|
|
106
|
+
error: result.error,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Try to parse the JSON response
|
|
110
|
+
const parseResult = this.parseJSONResponse(result.data);
|
|
111
|
+
if (!parseResult.success) {
|
|
112
|
+
// SENTRY ADD HERE - Log JSON parse failure
|
|
113
|
+
return {
|
|
114
|
+
success: false,
|
|
115
|
+
error: parseResult.error,
|
|
116
|
+
rawResponse: result.data,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Validate the parsed strategy
|
|
120
|
+
const validation = this.validateStrategy(parseResult.data);
|
|
121
|
+
if (!validation.isValid) {
|
|
122
|
+
// SENTRY ADD HERE - Log validation failure
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
error: createError('PARSE_ERROR', 'Invalid strategy structure', {
|
|
126
|
+
validationErrors: validation.errors,
|
|
127
|
+
}),
|
|
128
|
+
rawResponse: result.data,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
success: true,
|
|
133
|
+
data: parseResult.data,
|
|
134
|
+
rawResponse: result.data,
|
|
135
|
+
parseWarnings: validation.warnings,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Parse JSON response from AI
|
|
140
|
+
*/
|
|
141
|
+
parseJSONResponse(response) {
|
|
142
|
+
// Try to extract JSON from response (in case AI added markdown or explanation)
|
|
143
|
+
let jsonStr = response.trim();
|
|
144
|
+
// Remove markdown code block if present
|
|
145
|
+
if (jsonStr.startsWith('```json')) {
|
|
146
|
+
jsonStr = jsonStr.slice(7);
|
|
147
|
+
}
|
|
148
|
+
else if (jsonStr.startsWith('```')) {
|
|
149
|
+
jsonStr = jsonStr.slice(3);
|
|
150
|
+
}
|
|
151
|
+
if (jsonStr.endsWith('```')) {
|
|
152
|
+
jsonStr = jsonStr.slice(0, -3);
|
|
153
|
+
}
|
|
154
|
+
jsonStr = jsonStr.trim();
|
|
155
|
+
// Try to find JSON object in response
|
|
156
|
+
const jsonMatch = jsonStr.match(/\{[\s\S]*\}/);
|
|
157
|
+
if (jsonMatch) {
|
|
158
|
+
jsonStr = jsonMatch[0];
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
const parsed = JSON.parse(jsonStr);
|
|
162
|
+
return { success: true, data: parsed };
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
error: createError('PARSE_ERROR', 'Failed to parse AI response as JSON', { response: response.substring(0, 500) }, error),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Validate parsed strategy structure
|
|
173
|
+
*/
|
|
174
|
+
validateStrategy(strategy) {
|
|
175
|
+
const errors = [];
|
|
176
|
+
const warnings = [];
|
|
177
|
+
// Validate combat strategy
|
|
178
|
+
if (!strategy.combat) {
|
|
179
|
+
errors.push('Missing combat strategy');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
if (!Array.isArray(strategy.combat.targetPriority)) {
|
|
183
|
+
errors.push('Invalid targetPriority');
|
|
184
|
+
}
|
|
185
|
+
if (!strategy.combat.retreatCondition) {
|
|
186
|
+
warnings.push('Missing retreatCondition, using default');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Validate exploration strategy
|
|
190
|
+
if (!strategy.exploration) {
|
|
191
|
+
errors.push('Missing exploration strategy');
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
if (!Array.isArray(strategy.exploration.roomPriority)) {
|
|
195
|
+
errors.push('Invalid roomPriority');
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Validate resource strategy
|
|
199
|
+
if (!strategy.resource) {
|
|
200
|
+
errors.push('Missing resource strategy');
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (typeof strategy.resource.hpThreshold !== 'number') {
|
|
204
|
+
errors.push('Invalid hpThreshold');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Validate encounter strategy
|
|
208
|
+
if (!strategy.encounter) {
|
|
209
|
+
errors.push('Missing encounter strategy');
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
isValid: errors.length === 0,
|
|
213
|
+
errors,
|
|
214
|
+
warnings,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Merge partial strategy with defaults
|
|
219
|
+
*/
|
|
220
|
+
mergeWithDefaults(partial) {
|
|
221
|
+
return {
|
|
222
|
+
combat: { ...DEFAULT_STRATEGY.combat, ...partial.combat },
|
|
223
|
+
exploration: { ...DEFAULT_STRATEGY.exploration, ...partial.exploration },
|
|
224
|
+
resource: { ...DEFAULT_STRATEGY.resource, ...partial.resource },
|
|
225
|
+
encounter: { ...DEFAULT_STRATEGY.encounter, ...partial.encounter },
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Update a specific part of the strategy via natural language
|
|
230
|
+
*/
|
|
231
|
+
async updateStrategyPart(currentStrategy, updateDescription, part) {
|
|
232
|
+
const partPrompts = {
|
|
233
|
+
combat: `Update the combat strategy based on: "${updateDescription}"
|
|
234
|
+
Current combat strategy: ${JSON.stringify(currentStrategy.combat)}
|
|
235
|
+
Output ONLY the updated combat JSON object.`,
|
|
236
|
+
exploration: `Update the exploration strategy based on: "${updateDescription}"
|
|
237
|
+
Current exploration strategy: ${JSON.stringify(currentStrategy.exploration)}
|
|
238
|
+
Output ONLY the updated exploration JSON object.`,
|
|
239
|
+
resource: `Update the resource strategy based on: "${updateDescription}"
|
|
240
|
+
Current resource strategy: ${JSON.stringify(currentStrategy.resource)}
|
|
241
|
+
Output ONLY the updated resource JSON object.`,
|
|
242
|
+
encounter: `Update the encounter strategy based on: "${updateDescription}"
|
|
243
|
+
Current encounter strategy: ${JSON.stringify(currentStrategy.encounter)}
|
|
244
|
+
Output ONLY the updated encounter JSON object.`,
|
|
245
|
+
};
|
|
246
|
+
const prompt = partPrompts[part];
|
|
247
|
+
// SENTRY ADD HERE - Log strategy update attempt
|
|
248
|
+
const result = await this.errorHandler.executeWithRetry(async () => {
|
|
249
|
+
const client = this.aiClient.getSDK().createChatClient(MODELS.text.fast);
|
|
250
|
+
const response = await client.chat(prompt);
|
|
251
|
+
return typeof response === 'string' ? response : response.content || '';
|
|
252
|
+
}, `strategy_update_${part}`);
|
|
253
|
+
if (!result.success) {
|
|
254
|
+
// SENTRY ADD HERE - Log AI failure for strategy update
|
|
255
|
+
return {
|
|
256
|
+
success: false,
|
|
257
|
+
error: result.error,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const parseResult = this.parseJSONResponse(`{"${part}": ${result.data}}`);
|
|
261
|
+
if (!parseResult.success) {
|
|
262
|
+
return {
|
|
263
|
+
success: false,
|
|
264
|
+
error: parseResult.error,
|
|
265
|
+
rawResponse: result.data,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
// Merge with current strategy
|
|
269
|
+
const updatedStrategy = {
|
|
270
|
+
...currentStrategy,
|
|
271
|
+
[part]: parseResult.data[part],
|
|
272
|
+
};
|
|
273
|
+
return {
|
|
274
|
+
success: true,
|
|
275
|
+
data: updatedStrategy,
|
|
276
|
+
rawResponse: result.data,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// Singleton
|
|
282
|
+
// ============================================================================
|
|
283
|
+
let strategyParserInstance = null;
|
|
284
|
+
export function getStrategyParser() {
|
|
285
|
+
if (!strategyParserInstance) {
|
|
286
|
+
strategyParserInstance = new StrategyParser();
|
|
287
|
+
}
|
|
288
|
+
return strategyParserInstance;
|
|
289
|
+
}
|
|
290
|
+
// ============================================================================
|
|
291
|
+
// Utility Functions
|
|
292
|
+
// ============================================================================
|
|
293
|
+
/**
|
|
294
|
+
* Convert strategy to human-readable description
|
|
295
|
+
*/
|
|
296
|
+
export function strategyToDescription(strategy) {
|
|
297
|
+
const lines = [];
|
|
298
|
+
// Combat
|
|
299
|
+
lines.push('【战斗策略】');
|
|
300
|
+
lines.push(` 目标优先级: ${strategy.combat.targetPriority.join(' > ')}`);
|
|
301
|
+
lines.push(` 专注目标: ${strategy.combat.focusTarget}`);
|
|
302
|
+
if (strategy.combat.retreatCondition.enabled) {
|
|
303
|
+
lines.push(` 撤退条件: HP < ${strategy.combat.retreatCondition.hpThreshold * 100}%`);
|
|
304
|
+
}
|
|
305
|
+
// Exploration
|
|
306
|
+
lines.push('【探索策略】');
|
|
307
|
+
lines.push(` 房间优先级: ${strategy.exploration.roomPriority.join(' > ')}`);
|
|
308
|
+
lines.push(` 死路处理: ${strategy.exploration.deadEndBehavior}`);
|
|
309
|
+
lines.push(` 休息阈值: HP < ${strategy.exploration.restThreshold * 100}%`);
|
|
310
|
+
// Resource
|
|
311
|
+
lines.push('【资源策略】');
|
|
312
|
+
lines.push(` HP 阈值: ${strategy.resource.hpThreshold * 100}% → ${strategy.resource.hpAction}`);
|
|
313
|
+
lines.push(` MP 阈值: ${strategy.resource.mpThreshold * 100}% → ${strategy.resource.mpAction}`);
|
|
314
|
+
// Encounter
|
|
315
|
+
lines.push('【遭遇策略】');
|
|
316
|
+
lines.push(` NPC 行为: ${strategy.encounter.npcBehavior}`);
|
|
317
|
+
lines.push(` 商店行为: ${strategy.encounter.shopBehavior}`);
|
|
318
|
+
return lines.join('\n');
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=StrategyParser.js.map
|
|
321
|
+
//# debugId=790bc4da-3898-55f5-a846-d7508cda23fb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StrategyParser.js","sources":["strategy/StrategyParser.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Strategy Parser\r\n * Uses AI to parse natural language strategy descriptions into StrategyStateMachine\r\n *\r\n * NO FALLBACKS - All AI errors prompt for retry\r\n */\r\n\r\nimport type {\r\n StrategyStateMachine,\r\n CombatStrategyConfig,\r\n ExplorationStrategy,\r\n ResourceStrategy,\r\n EncounterStrategy,\r\n TargetPriority,\r\n ItemUsageRule,\r\n RoomPriority,\r\n DeadEndBehavior,\r\n ResourceAction,\r\n NPCBehavior,\r\n ShopBehavior,\r\n} from '../core/types.js';\r\nimport { getAIClient, MODELS } from '../ai/PlayKitClient.js';\r\nimport {\r\n type OperationResult,\r\n type OperationError,\r\n withRetry,\r\n createError,\r\n getErrorHandler,\r\n} from '../utils/errorHandler.js';\r\nimport { DEFAULT_STRATEGY } from './defaultStrategy.js';\r\n\r\n// ============================================================================\r\n// Types\r\n// ============================================================================\r\n\r\nexport interface StrategyParseResult extends OperationResult<StrategyStateMachine> {\r\n rawResponse?: string;\r\n parseWarnings?: string[];\r\n}\r\n\r\nexport interface StrategyValidationResult {\r\n isValid: boolean;\r\n errors: string[];\r\n warnings: string[];\r\n}\r\n\r\n// ============================================================================\r\n// AI Prompts\r\n// ============================================================================\r\n\r\nconst STRATEGY_PARSE_PROMPT = `You are a strategy parser for an IdleRPG game. Convert the player's natural language strategy into a JSON state machine.\r\n\r\nThe output MUST be a valid JSON object with this exact structure:\r\n{\r\n \"combat\": {\r\n \"targetPriority\": [\"healer\", \"caster\", \"ranged\", \"lowest_hp\", \"highest_damage\", \"boss\", \"minion\", \"tank\"],\r\n \"itemUsage\": [\r\n { \"itemType\": \"health_potion\", \"condition\": \"hp_below\", \"threshold\": 0.3, \"priority\": 10 }\r\n ],\r\n \"retreatCondition\": {\r\n \"enabled\": true,\r\n \"hpThreshold\": 0.15,\r\n \"partyWipeRisk\": true,\r\n \"bossExempt\": true\r\n },\r\n \"skillPriority\": [],\r\n \"focusTarget\": \"highest_damage\"\r\n },\r\n \"exploration\": {\r\n \"roomPriority\": [\"treasure\", \"rest\", \"shop\", \"combat\", \"event\", \"exit\"],\r\n \"deadEndBehavior\": \"rest_if_needed\",\r\n \"treasureHunting\": true,\r\n \"thoroughExploration\": false,\r\n \"avoidTraps\": false,\r\n \"avoidElites\": false,\r\n \"restThreshold\": 0.5\r\n },\r\n \"resource\": {\r\n \"hpThreshold\": 0.5,\r\n \"hpAction\": \"use_item\",\r\n \"mpThreshold\": 0.3,\r\n \"mpAction\": \"use_item\",\r\n \"goldReserve\": 100,\r\n \"sellJunk\": true,\r\n \"repairThreshold\": 0.3\r\n },\r\n \"encounter\": {\r\n \"npcBehavior\": \"always_talk\",\r\n \"eventRiskTolerance\": 0.5,\r\n \"acceptQuests\": true,\r\n \"shopBehavior\": \"buy_consumables\"\r\n }\r\n}\r\n\r\nValid values:\r\n- targetPriority: \"healer\", \"ranged\", \"caster\", \"tank\", \"lowest_hp\", \"highest_damage\", \"boss\", \"minion\"\r\n- focusTarget: \"highest_damage\", \"lowest_hp\", \"highest_threat\", \"random\"\r\n- itemType: \"health_potion\", \"mana_potion\", \"buff\", \"debuff\", \"revive\"\r\n- condition: \"hp_below\", \"mp_below\", \"status_effect\", \"enemy_count\", \"turn_count\"\r\n- deadEndBehavior: \"retreat_immediately\", \"search_thoroughly\", \"rest_if_needed\"\r\n- hpAction/mpAction: \"use_item\", \"rest\", \"retreat_to_town\", \"continue\"\r\n- npcBehavior: \"always_talk\", \"quest_givers_only\", \"skip\"\r\n- shopBehavior: \"buy_upgrades\", \"sell_only\", \"buy_consumables\", \"skip\"\r\n- roomPriority: \"combat\", \"treasure\", \"event\", \"shop\", \"rest\", \"exit\"\r\n\r\nIMPORTANT:\r\n- Output ONLY the JSON object, no markdown, no explanation\r\n- All threshold values should be between 0 and 1 (percentages)\r\n- Arrays should be ordered by priority (first = highest priority)\r\n\r\nPlayer's strategy description:\r\n`;\r\n\r\n// ============================================================================\r\n// Parser Class\r\n// ============================================================================\r\n\r\nexport class StrategyParser {\r\n private aiClient = getAIClient();\r\n private errorHandler = getErrorHandler();\r\n\r\n /**\r\n * Parse natural language strategy into StrategyStateMachine\r\n * Returns error if AI fails - NO FALLBACK\r\n */\r\n async parseStrategy(description: string): Promise<StrategyParseResult> {\r\n if (!description.trim()) {\r\n return {\r\n success: false,\r\n error: createError('PARSE_ERROR', 'Strategy description is empty'),\r\n };\r\n }\r\n\r\n const prompt = STRATEGY_PARSE_PROMPT + description;\r\n\r\n // SENTRY ADD HERE - Log strategy parse attempt\r\n\r\n const result = await this.errorHandler.executeWithRetry(\r\n async () => {\r\n const client = this.aiClient.getSDK().createChatClient(MODELS.text.balanced);\r\n const response = await client.chat(prompt);\r\n const responseText = typeof response === 'string' ? response : (response as { content?: string }).content || '';\r\n return responseText;\r\n },\r\n 'strategy_parse'\r\n );\r\n\r\n if (!result.success) {\r\n // SENTRY ADD HERE - Log AI failure for strategy parsing\r\n return {\r\n success: false,\r\n error: result.error,\r\n };\r\n }\r\n\r\n // Try to parse the JSON response\r\n const parseResult = this.parseJSONResponse(result.data!);\r\n\r\n if (!parseResult.success) {\r\n // SENTRY ADD HERE - Log JSON parse failure\r\n return {\r\n success: false,\r\n error: parseResult.error,\r\n rawResponse: result.data,\r\n };\r\n }\r\n\r\n // Validate the parsed strategy\r\n const validation = this.validateStrategy(parseResult.data!);\r\n\r\n if (!validation.isValid) {\r\n // SENTRY ADD HERE - Log validation failure\r\n return {\r\n success: false,\r\n error: createError('PARSE_ERROR', 'Invalid strategy structure', {\r\n validationErrors: validation.errors,\r\n }),\r\n rawResponse: result.data,\r\n };\r\n }\r\n\r\n return {\r\n success: true,\r\n data: parseResult.data,\r\n rawResponse: result.data,\r\n parseWarnings: validation.warnings,\r\n };\r\n }\r\n\r\n /**\r\n * Parse JSON response from AI\r\n */\r\n private parseJSONResponse(response: string): OperationResult<StrategyStateMachine> {\r\n // Try to extract JSON from response (in case AI added markdown or explanation)\r\n let jsonStr = response.trim();\r\n\r\n // Remove markdown code block if present\r\n if (jsonStr.startsWith('```json')) {\r\n jsonStr = jsonStr.slice(7);\r\n } else if (jsonStr.startsWith('```')) {\r\n jsonStr = jsonStr.slice(3);\r\n }\r\n if (jsonStr.endsWith('```')) {\r\n jsonStr = jsonStr.slice(0, -3);\r\n }\r\n jsonStr = jsonStr.trim();\r\n\r\n // Try to find JSON object in response\r\n const jsonMatch = jsonStr.match(/\\{[\\s\\S]*\\}/);\r\n if (jsonMatch) {\r\n jsonStr = jsonMatch[0];\r\n }\r\n\r\n try {\r\n const parsed = JSON.parse(jsonStr) as StrategyStateMachine;\r\n return { success: true, data: parsed };\r\n } catch (error) {\r\n return {\r\n success: false,\r\n error: createError(\r\n 'PARSE_ERROR',\r\n 'Failed to parse AI response as JSON',\r\n { response: response.substring(0, 500) },\r\n error\r\n ),\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Validate parsed strategy structure\r\n */\r\n private validateStrategy(strategy: StrategyStateMachine): StrategyValidationResult {\r\n const errors: string[] = [];\r\n const warnings: string[] = [];\r\n\r\n // Validate combat strategy\r\n if (!strategy.combat) {\r\n errors.push('Missing combat strategy');\r\n } else {\r\n if (!Array.isArray(strategy.combat.targetPriority)) {\r\n errors.push('Invalid targetPriority');\r\n }\r\n if (!strategy.combat.retreatCondition) {\r\n warnings.push('Missing retreatCondition, using default');\r\n }\r\n }\r\n\r\n // Validate exploration strategy\r\n if (!strategy.exploration) {\r\n errors.push('Missing exploration strategy');\r\n } else {\r\n if (!Array.isArray(strategy.exploration.roomPriority)) {\r\n errors.push('Invalid roomPriority');\r\n }\r\n }\r\n\r\n // Validate resource strategy\r\n if (!strategy.resource) {\r\n errors.push('Missing resource strategy');\r\n } else {\r\n if (typeof strategy.resource.hpThreshold !== 'number') {\r\n errors.push('Invalid hpThreshold');\r\n }\r\n }\r\n\r\n // Validate encounter strategy\r\n if (!strategy.encounter) {\r\n errors.push('Missing encounter strategy');\r\n }\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n warnings,\r\n };\r\n }\r\n\r\n /**\r\n * Merge partial strategy with defaults\r\n */\r\n mergeWithDefaults(partial: Partial<StrategyStateMachine>): StrategyStateMachine {\r\n return {\r\n combat: { ...DEFAULT_STRATEGY.combat, ...partial.combat },\r\n exploration: { ...DEFAULT_STRATEGY.exploration, ...partial.exploration },\r\n resource: { ...DEFAULT_STRATEGY.resource, ...partial.resource },\r\n encounter: { ...DEFAULT_STRATEGY.encounter, ...partial.encounter },\r\n };\r\n }\r\n\r\n /**\r\n * Update a specific part of the strategy via natural language\r\n */\r\n async updateStrategyPart(\r\n currentStrategy: StrategyStateMachine,\r\n updateDescription: string,\r\n part: 'combat' | 'exploration' | 'resource' | 'encounter'\r\n ): Promise<StrategyParseResult> {\r\n const partPrompts: Record<string, string> = {\r\n combat: `Update the combat strategy based on: \"${updateDescription}\"\r\nCurrent combat strategy: ${JSON.stringify(currentStrategy.combat)}\r\nOutput ONLY the updated combat JSON object.`,\r\n exploration: `Update the exploration strategy based on: \"${updateDescription}\"\r\nCurrent exploration strategy: ${JSON.stringify(currentStrategy.exploration)}\r\nOutput ONLY the updated exploration JSON object.`,\r\n resource: `Update the resource strategy based on: \"${updateDescription}\"\r\nCurrent resource strategy: ${JSON.stringify(currentStrategy.resource)}\r\nOutput ONLY the updated resource JSON object.`,\r\n encounter: `Update the encounter strategy based on: \"${updateDescription}\"\r\nCurrent encounter strategy: ${JSON.stringify(currentStrategy.encounter)}\r\nOutput ONLY the updated encounter JSON object.`,\r\n };\r\n\r\n const prompt = partPrompts[part];\r\n\r\n // SENTRY ADD HERE - Log strategy update attempt\r\n\r\n const result = await this.errorHandler.executeWithRetry(\r\n async () => {\r\n const client = this.aiClient.getSDK().createChatClient(MODELS.text.fast);\r\n const response = await client.chat(prompt);\r\n return typeof response === 'string' ? response : (response as { content?: string }).content || '';\r\n },\r\n `strategy_update_${part}`\r\n );\r\n\r\n if (!result.success) {\r\n // SENTRY ADD HERE - Log AI failure for strategy update\r\n return {\r\n success: false,\r\n error: result.error,\r\n };\r\n }\r\n\r\n const parseResult = this.parseJSONResponse(`{\"${part}\": ${result.data}}`);\r\n\r\n if (!parseResult.success) {\r\n return {\r\n success: false,\r\n error: parseResult.error,\r\n rawResponse: result.data,\r\n };\r\n }\r\n\r\n // Merge with current strategy\r\n const updatedStrategy: StrategyStateMachine = {\r\n ...currentStrategy,\r\n [part]: parseResult.data![part as keyof StrategyStateMachine],\r\n };\r\n\r\n return {\r\n success: true,\r\n data: updatedStrategy,\r\n rawResponse: result.data,\r\n };\r\n }\r\n}\r\n\r\n// ============================================================================\r\n// Singleton\r\n// ============================================================================\r\n\r\nlet strategyParserInstance: StrategyParser | null = null;\r\n\r\nexport function getStrategyParser(): StrategyParser {\r\n if (!strategyParserInstance) {\r\n strategyParserInstance = new StrategyParser();\r\n }\r\n return strategyParserInstance;\r\n}\r\n\r\n// ============================================================================\r\n// Utility Functions\r\n// ============================================================================\r\n\r\n/**\r\n * Convert strategy to human-readable description\r\n */\r\nexport function strategyToDescription(strategy: StrategyStateMachine): string {\r\n const lines: string[] = [];\r\n\r\n // Combat\r\n lines.push('【战斗策略】');\r\n lines.push(` 目标优先级: ${strategy.combat.targetPriority.join(' > ')}`);\r\n lines.push(` 专注目标: ${strategy.combat.focusTarget}`);\r\n if (strategy.combat.retreatCondition.enabled) {\r\n lines.push(` 撤退条件: HP < ${strategy.combat.retreatCondition.hpThreshold * 100}%`);\r\n }\r\n\r\n // Exploration\r\n lines.push('【探索策略】');\r\n lines.push(` 房间优先级: ${strategy.exploration.roomPriority.join(' > ')}`);\r\n lines.push(` 死路处理: ${strategy.exploration.deadEndBehavior}`);\r\n lines.push(` 休息阈值: HP < ${strategy.exploration.restThreshold * 100}%`);\r\n\r\n // Resource\r\n lines.push('【资源策略】');\r\n lines.push(` HP 阈值: ${strategy.resource.hpThreshold * 100}% → ${strategy.resource.hpAction}`);\r\n lines.push(` MP 阈值: ${strategy.resource.mpThreshold * 100}% → ${strategy.resource.mpAction}`);\r\n\r\n // Encounter\r\n lines.push('【遭遇策略】');\r\n lines.push(` NPC 行为: ${strategy.encounter.npcBehavior}`);\r\n lines.push(` 商店行为: ${strategy.encounter.shopBehavior}`);\r\n\r\n return lines.join('\\n');\r\n}\r\n"],"names":[],"mappings":"AAAA;;;;;GAKG;;;AAgBH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAIL,WAAW,EACX,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAiBxD,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6D7B,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,OAAO,cAAc;IACjB,QAAQ,GAAG,WAAW,EAAE,CAAC;IACzB,YAAY,GAAG,eAAe,EAAE,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;YACxB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,WAAW,CAAC,aAAa,EAAE,+BAA+B,CAAC;aACnE,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,qBAAqB,GAAG,WAAW,CAAC;QAEnD,+CAA+C;QAE/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,CACrD,KAAK,IAAI,EAAE;YACT,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CA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AG,GAAG,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE/F,YAAY;IACZ,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,KAAK,CAAC,IAAI,CAAC,aAAa,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1D,KAAK,CAAC,IAAI,CAAC,WAAW,QAAQ,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","debug_id":"790bc4da-3898-55f5-a846-d7508cda23fb"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Strategy Configuration
|
|
3
|
+
* Used when AI parsing is unavailable or as a fallback
|
|
4
|
+
*/
|
|
5
|
+
import type { StrategyStateMachine, CombatStrategyConfig, ExplorationStrategy, ResourceStrategy, EncounterStrategy } from '../core/types.js';
|
|
6
|
+
export declare const DEFAULT_COMBAT_STRATEGY: CombatStrategyConfig;
|
|
7
|
+
export declare const DEFAULT_EXPLORATION_STRATEGY: ExplorationStrategy;
|
|
8
|
+
export declare const DEFAULT_RESOURCE_STRATEGY: ResourceStrategy;
|
|
9
|
+
export declare const DEFAULT_ENCOUNTER_STRATEGY: EncounterStrategy;
|
|
10
|
+
export declare const DEFAULT_STRATEGY: StrategyStateMachine;
|
|
11
|
+
/**
|
|
12
|
+
* Aggressive strategy - prioritize damage and speed
|
|
13
|
+
*/
|
|
14
|
+
export declare const AGGRESSIVE_STRATEGY: StrategyStateMachine;
|
|
15
|
+
/**
|
|
16
|
+
* Defensive strategy - prioritize survival
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFENSIVE_STRATEGY: StrategyStateMachine;
|
|
19
|
+
/**
|
|
20
|
+
* Balanced strategy - good for most situations
|
|
21
|
+
*/
|
|
22
|
+
export declare const BALANCED_STRATEGY: StrategyStateMachine;
|
|
23
|
+
/**
|
|
24
|
+
* Speedrun strategy - rush to boss
|
|
25
|
+
*/
|
|
26
|
+
export declare const SPEEDRUN_STRATEGY: StrategyStateMachine;
|
|
27
|
+
/**
|
|
28
|
+
* Treasure hunter strategy - find all loot
|
|
29
|
+
*/
|
|
30
|
+
export declare const TREASURE_HUNTER_STRATEGY: StrategyStateMachine;
|
|
31
|
+
export declare const STRATEGY_PRESETS: Record<string, StrategyStateMachine>;
|
|
32
|
+
/**
|
|
33
|
+
* Get a strategy preset by name
|
|
34
|
+
*/
|
|
35
|
+
export declare function getStrategyPreset(name: string): StrategyStateMachine;
|
|
36
|
+
/**
|
|
37
|
+
* Get list of available preset names
|
|
38
|
+
*/
|
|
39
|
+
export declare function getAvailablePresets(): string[];
|
|
40
|
+
//# sourceMappingURL=defaultStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultStrategy.d.ts","sourceRoot":"/","sources":["strategy/defaultStrategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAM1B,eAAO,MAAM,uBAAuB,EAAE,oBAwBrC,CAAC;AAMF,eAAO,MAAM,4BAA4B,EAAE,mBAQ1C,CAAC;AAMF,eAAO,MAAM,yBAAyB,EAAE,gBAQvC,CAAC;AAMF,eAAO,MAAM,0BAA0B,EAAE,iBAKxC,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,oBAK9B,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,oBA6BjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,oBAoDhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,oBAAuC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,oBAgC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBAiBtC,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAOjE,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAEpE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Strategy Configuration
|
|
3
|
+
* Used when AI parsing is unavailable or as a fallback
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Default Combat Strategy
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="11654ef7-f09a-56ad-aa76-313d19e7483e")}catch(e){}}();
|
|
10
|
+
export const DEFAULT_COMBAT_STRATEGY = {
|
|
11
|
+
targetPriority: ['healer', 'caster', 'ranged', 'lowest_hp'],
|
|
12
|
+
itemUsage: [
|
|
13
|
+
{
|
|
14
|
+
itemType: 'health_potion',
|
|
15
|
+
condition: 'hp_below',
|
|
16
|
+
threshold: 0.3, // Use health potion when HP < 30%
|
|
17
|
+
priority: 10,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
itemType: 'mana_potion',
|
|
21
|
+
condition: 'mp_below',
|
|
22
|
+
threshold: 0.2, // Use mana potion when MP < 20%
|
|
23
|
+
priority: 5,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
retreatCondition: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
hpThreshold: 0.15, // Retreat when HP < 15%
|
|
29
|
+
partyWipeRisk: true,
|
|
30
|
+
bossExempt: true, // Don't retreat from boss fights
|
|
31
|
+
},
|
|
32
|
+
skillPriority: [], // Will use default skill order
|
|
33
|
+
focusTarget: 'highest_damage',
|
|
34
|
+
};
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Default Exploration Strategy
|
|
37
|
+
// ============================================================================
|
|
38
|
+
export const DEFAULT_EXPLORATION_STRATEGY = {
|
|
39
|
+
roomPriority: ['treasure', 'rest', 'shop', 'combat', 'event', 'exit'],
|
|
40
|
+
deadEndBehavior: 'rest_if_needed',
|
|
41
|
+
treasureHunting: true,
|
|
42
|
+
thoroughExploration: false, // Prefer efficient path to exit
|
|
43
|
+
avoidTraps: false, // Will try to handle traps
|
|
44
|
+
avoidElites: false, // Will fight elites
|
|
45
|
+
restThreshold: 0.5, // Rest when HP < 50%
|
|
46
|
+
};
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// Default Resource Strategy
|
|
49
|
+
// ============================================================================
|
|
50
|
+
export const DEFAULT_RESOURCE_STRATEGY = {
|
|
51
|
+
hpThreshold: 0.5, // Act when HP < 50%
|
|
52
|
+
hpAction: 'use_item',
|
|
53
|
+
mpThreshold: 0.3, // Act when MP < 30%
|
|
54
|
+
mpAction: 'use_item',
|
|
55
|
+
goldReserve: 100, // Keep 100 gold in reserve
|
|
56
|
+
sellJunk: true,
|
|
57
|
+
repairThreshold: 0.3, // Repair when durability < 30%
|
|
58
|
+
};
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Default Encounter Strategy
|
|
61
|
+
// ============================================================================
|
|
62
|
+
export const DEFAULT_ENCOUNTER_STRATEGY = {
|
|
63
|
+
npcBehavior: 'always_talk',
|
|
64
|
+
eventRiskTolerance: 0.5, // Medium risk tolerance
|
|
65
|
+
acceptQuests: true,
|
|
66
|
+
shopBehavior: 'buy_consumables',
|
|
67
|
+
};
|
|
68
|
+
// ============================================================================
|
|
69
|
+
// Complete Default Strategy
|
|
70
|
+
// ============================================================================
|
|
71
|
+
export const DEFAULT_STRATEGY = {
|
|
72
|
+
combat: DEFAULT_COMBAT_STRATEGY,
|
|
73
|
+
exploration: DEFAULT_EXPLORATION_STRATEGY,
|
|
74
|
+
resource: DEFAULT_RESOURCE_STRATEGY,
|
|
75
|
+
encounter: DEFAULT_ENCOUNTER_STRATEGY,
|
|
76
|
+
};
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Preset Strategies
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Aggressive strategy - prioritize damage and speed
|
|
82
|
+
*/
|
|
83
|
+
export const AGGRESSIVE_STRATEGY = {
|
|
84
|
+
combat: {
|
|
85
|
+
...DEFAULT_COMBAT_STRATEGY,
|
|
86
|
+
targetPriority: ['highest_damage', 'caster', 'healer', 'ranged'],
|
|
87
|
+
retreatCondition: {
|
|
88
|
+
enabled: false,
|
|
89
|
+
hpThreshold: 0.1,
|
|
90
|
+
partyWipeRisk: false,
|
|
91
|
+
bossExempt: true,
|
|
92
|
+
},
|
|
93
|
+
focusTarget: 'highest_damage',
|
|
94
|
+
},
|
|
95
|
+
exploration: {
|
|
96
|
+
...DEFAULT_EXPLORATION_STRATEGY,
|
|
97
|
+
roomPriority: ['combat', 'treasure', 'exit', 'event'],
|
|
98
|
+
thoroughExploration: false,
|
|
99
|
+
avoidElites: false,
|
|
100
|
+
restThreshold: 0.3,
|
|
101
|
+
},
|
|
102
|
+
resource: {
|
|
103
|
+
...DEFAULT_RESOURCE_STRATEGY,
|
|
104
|
+
hpThreshold: 0.3,
|
|
105
|
+
hpAction: 'use_item',
|
|
106
|
+
},
|
|
107
|
+
encounter: {
|
|
108
|
+
...DEFAULT_ENCOUNTER_STRATEGY,
|
|
109
|
+
npcBehavior: 'skip',
|
|
110
|
+
eventRiskTolerance: 0.8,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Defensive strategy - prioritize survival
|
|
115
|
+
*/
|
|
116
|
+
export const DEFENSIVE_STRATEGY = {
|
|
117
|
+
combat: {
|
|
118
|
+
...DEFAULT_COMBAT_STRATEGY,
|
|
119
|
+
targetPriority: ['healer', 'caster', 'lowest_hp'],
|
|
120
|
+
itemUsage: [
|
|
121
|
+
{
|
|
122
|
+
itemType: 'health_potion',
|
|
123
|
+
condition: 'hp_below',
|
|
124
|
+
threshold: 0.5, // Use health potion when HP < 50%
|
|
125
|
+
priority: 10,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
itemType: 'mana_potion',
|
|
129
|
+
condition: 'mp_below',
|
|
130
|
+
threshold: 0.4,
|
|
131
|
+
priority: 5,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
itemType: 'buff',
|
|
135
|
+
condition: 'turn_count',
|
|
136
|
+
threshold: 1, // Use buff on first turn
|
|
137
|
+
priority: 8,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
retreatCondition: {
|
|
141
|
+
enabled: true,
|
|
142
|
+
hpThreshold: 0.3, // Retreat when HP < 30%
|
|
143
|
+
partyWipeRisk: true,
|
|
144
|
+
bossExempt: false, // Can retreat even from boss
|
|
145
|
+
},
|
|
146
|
+
focusTarget: 'lowest_hp',
|
|
147
|
+
},
|
|
148
|
+
exploration: {
|
|
149
|
+
...DEFAULT_EXPLORATION_STRATEGY,
|
|
150
|
+
roomPriority: ['rest', 'treasure', 'shop', 'exit', 'combat'],
|
|
151
|
+
deadEndBehavior: 'retreat_immediately',
|
|
152
|
+
avoidTraps: true,
|
|
153
|
+
avoidElites: true,
|
|
154
|
+
restThreshold: 0.7, // Rest when HP < 70%
|
|
155
|
+
},
|
|
156
|
+
resource: {
|
|
157
|
+
...DEFAULT_RESOURCE_STRATEGY,
|
|
158
|
+
hpThreshold: 0.7,
|
|
159
|
+
hpAction: 'rest',
|
|
160
|
+
mpThreshold: 0.5,
|
|
161
|
+
mpAction: 'rest',
|
|
162
|
+
},
|
|
163
|
+
encounter: {
|
|
164
|
+
...DEFAULT_ENCOUNTER_STRATEGY,
|
|
165
|
+
eventRiskTolerance: 0.2, // Low risk tolerance
|
|
166
|
+
shopBehavior: 'buy_consumables',
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Balanced strategy - good for most situations
|
|
171
|
+
*/
|
|
172
|
+
export const BALANCED_STRATEGY = DEFAULT_STRATEGY;
|
|
173
|
+
/**
|
|
174
|
+
* Speedrun strategy - rush to boss
|
|
175
|
+
*/
|
|
176
|
+
export const SPEEDRUN_STRATEGY = {
|
|
177
|
+
combat: {
|
|
178
|
+
...DEFAULT_COMBAT_STRATEGY,
|
|
179
|
+
targetPriority: ['lowest_hp', 'minion', 'boss'],
|
|
180
|
+
retreatCondition: {
|
|
181
|
+
enabled: true,
|
|
182
|
+
hpThreshold: 0.2,
|
|
183
|
+
partyWipeRisk: true,
|
|
184
|
+
bossExempt: true,
|
|
185
|
+
},
|
|
186
|
+
focusTarget: 'lowest_hp',
|
|
187
|
+
},
|
|
188
|
+
exploration: {
|
|
189
|
+
roomPriority: ['exit', 'treasure', 'rest'],
|
|
190
|
+
deadEndBehavior: 'retreat_immediately',
|
|
191
|
+
treasureHunting: false,
|
|
192
|
+
thoroughExploration: false,
|
|
193
|
+
avoidTraps: true,
|
|
194
|
+
avoidElites: true,
|
|
195
|
+
restThreshold: 0.4,
|
|
196
|
+
},
|
|
197
|
+
resource: {
|
|
198
|
+
...DEFAULT_RESOURCE_STRATEGY,
|
|
199
|
+
hpThreshold: 0.4,
|
|
200
|
+
hpAction: 'use_item',
|
|
201
|
+
},
|
|
202
|
+
encounter: {
|
|
203
|
+
npcBehavior: 'skip',
|
|
204
|
+
eventRiskTolerance: 0.3,
|
|
205
|
+
acceptQuests: false,
|
|
206
|
+
shopBehavior: 'skip',
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Treasure hunter strategy - find all loot
|
|
211
|
+
*/
|
|
212
|
+
export const TREASURE_HUNTER_STRATEGY = {
|
|
213
|
+
combat: DEFAULT_COMBAT_STRATEGY,
|
|
214
|
+
exploration: {
|
|
215
|
+
...DEFAULT_EXPLORATION_STRATEGY,
|
|
216
|
+
roomPriority: ['treasure', 'shop', 'event', 'combat', 'rest', 'exit'],
|
|
217
|
+
deadEndBehavior: 'search_thoroughly',
|
|
218
|
+
treasureHunting: true,
|
|
219
|
+
thoroughExploration: true,
|
|
220
|
+
avoidElites: false,
|
|
221
|
+
},
|
|
222
|
+
resource: DEFAULT_RESOURCE_STRATEGY,
|
|
223
|
+
encounter: {
|
|
224
|
+
...DEFAULT_ENCOUNTER_STRATEGY,
|
|
225
|
+
npcBehavior: 'always_talk',
|
|
226
|
+
eventRiskTolerance: 0.6,
|
|
227
|
+
shopBehavior: 'buy_upgrades',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
// ============================================================================
|
|
231
|
+
// Strategy Presets Map
|
|
232
|
+
// ============================================================================
|
|
233
|
+
export const STRATEGY_PRESETS = {
|
|
234
|
+
default: DEFAULT_STRATEGY,
|
|
235
|
+
balanced: BALANCED_STRATEGY,
|
|
236
|
+
aggressive: AGGRESSIVE_STRATEGY,
|
|
237
|
+
defensive: DEFENSIVE_STRATEGY,
|
|
238
|
+
speedrun: SPEEDRUN_STRATEGY,
|
|
239
|
+
treasure_hunter: TREASURE_HUNTER_STRATEGY,
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Get a strategy preset by name
|
|
243
|
+
*/
|
|
244
|
+
export function getStrategyPreset(name) {
|
|
245
|
+
return STRATEGY_PRESETS[name.toLowerCase()] || DEFAULT_STRATEGY;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get list of available preset names
|
|
249
|
+
*/
|
|
250
|
+
export function getAvailablePresets() {
|
|
251
|
+
return Object.keys(STRATEGY_PRESETS);
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=defaultStrategy.js.map
|
|
254
|
+
//# debugId=11654ef7-f09a-56ad-aa76-313d19e7483e
|