Feat/bot core module - #2
Conversation
Added new TargetBot AI modules: core utilities, monster behavior analysis, spell optimizer, and movement coordinator. Updated documentation and code comments to reflect new features, dynamic scaling, and improved naming (SmartHunt → Hunt Analyzer, Smart Pull → Pull System, etc). Refactored imports and descriptions for clarity and consistency across modules.
Refactored the equipment manager to use a centralized EquipState and cached rules for improved performance. UI rule list refresh now avoids widget flicker and unnecessary recreation. Equipment macro now iterates over cached rules instead of UI children, reducing overhead and improving responsiveness. Added cache invalidation logic when rules change or priorities are updated.
There was a problem hiding this comment.
Pull request overview
This PR introduces a sophisticated bot core module system for TargetBot, featuring dynamic movement coordination, monster behavior analysis, and spell optimization. The changes aim to make the bot more reactive when surrounded by many monsters while remaining conservative in safer situations.
Key changes:
- New TargetCore module with pure utility functions for geometry and combat calculations
- MonsterAI module for behavior pattern recognition and attack prediction
- SpellOptimizer for calculating optimal AoE spell positions
- MovementCoordinator with dynamic confidence thresholds that scale based on monster count
- LRU caching implementation for creature data (50 entry limit)
- Documentation updates renaming "SmartHunt" to "Hunt Analyzer"
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| targetbot/core.lua | New pure utility functions module with geometry, distance, and combat helpers |
| targetbot/monster_ai.lua | Monster behavior tracking and attack prediction system |
| targetbot/spell_optimizer.lua | AoE spell position optimization with pattern matching |
| targetbot/movement_coordinator.lua | Unified movement system with dynamic scaling and intent voting |
| targetbot/target.lua | Added LRU eviction to creature cache with 50 entry limit |
| targetbot/creature_priority.lua | Updated to use TargetCore constants where available |
| targetbot/creature_attack.lua | Integrated MovementCoordinator with dynamic scaling based on monster count |
| targetbot/creature_editor.lua | Minor UI text changes (Smart Pull → Pull System) |
| docs/*.md | Updated documentation with new module descriptions and renamed Hunt Analyzer |
| core/smart_hunt.lua | Renamed from SmartHunt to HuntAnalyzer throughout |
| core/cavebot.lua | Added loading of new TargetBot modules |
| core/Equipper.lua | Optimized with rules caching to reduce UI iteration overhead |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| -- Check if monster is facing a position (pure function) | ||
| function MonsterAI.Predictor.isFacingPosition(monsterPos, monsterDir, targetPos) | ||
| local dirVec = TargetCore and TargetCore.CONSTANTS.DIR_VECTORS[monsterDir] |
There was a problem hiding this comment.
The comment references TargetCore.CONSTANTS.DIR_VECTORS but the actual check is for a non-existent TargetCore module. The fallback direction vectors will always be used since the check will fail.
| local WEIGHT_MEDIUM = 2 -- Distance <= 5 | ||
| local WEIGHT_CHASE_LOW = 10 -- Chase mode + low HP | ||
| -- Use TargetCore constants if available, otherwise define locally | ||
| local PRIO = (TargetCore and TargetCore.CONSTANTS and TargetCore.CONSTANTS.PRIORITY) or { |
There was a problem hiding this comment.
The variable name TargetBotCore is inconsistent with the actual module name TargetCore. This pattern appears multiple times in the PR. All references should use TargetCore consistently.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| addCheckBox("smartPull", "Smart Pull", false, [[When enabled, uses CaveBot to walk and pull more monsters if the current pack is too small. | ||
| Configure with: Smart Pull Range (how far to check), Min Monsters (threshold), and Shape (accuracy). | ||
| addCheckBox("smartPull", "Pull System", false, [[When enabled, uses CaveBot to walk and pull more monsters if the current pack is too small. | ||
| Configure with: Pull Range (how far to check), Min Monsters (threshold), and Shape (accuracy). |
There was a problem hiding this comment.
Typo in comment: "accurracy" should be "accuracy".
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.