Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ nExBot/
| **Multi-Factor Scoring** | Tile evaluation for repositioning |
| **Intent Voting** | MovementCoordinator confidence-based decisions |
| **Behavior Analysis** | Monster pattern recognition |
| **Pure Functions** | TargetBotCore geometry/combat utilities |
| **Pure Functions** | TargetCore geometry/combat utilities |

---

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
- Confidence voting system (0.0-1.0)
- Anti-oscillation tracking
- Emergency/wave_avoid/finish_kill/spell_position priorities
- [x] **TargetBotCore** - Pure utility functions
- [x] **TargetCore** - Pure utility functions
- Geometry calculations (Manhattan, Chebyshev, Euclidean)
- Combat helpers (danger zones, facing direction)
- Monster utilities (target scoring, health checks)
Expand Down
4 changes: 2 additions & 2 deletions docs/PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ end

</details>

### TargetBotCore Pure Functions
### TargetCore Pure Functions

<details>
<summary><b>📊 Reusable Geometry Calculations</b></summary>

```lua
-- All geometry functions are pure (no side effects)
TargetBotCore.Geometry = {
TargetCore.Geometry = {
manhattan = function(p1, p2) return abs(p1.x - p2.x) + abs(p1.y - p2.y) end,
chebyshev = function(p1, p2) return max(abs(p1.x - p2.x), abs(p1.y - p2.y)) end,
euclidean = function(p1, p2) return sqrt((p1.x - p2.x)^2 + (p1.y - p2.y)^2) end,
Expand Down
2 changes: 1 addition & 1 deletion docs/TARGETBOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Moves to tiles with better tactical advantage using multi-factor scoring.
- Dynamic thresholds based on monster count
- SpellOptimizer integration for AoE considerations
- LRU creature config cache (50 entries max)
- Pure function scoring via TargetBotCore
- Pure function scoring via TargetCore
- More reactive when surrounded, conservative when safe

---
Expand Down
8 changes: 4 additions & 4 deletions targetbot/creature_attack.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--------------------------------------------------------------------------------
-- TARGETBOT CREATURE ATTACK v1.0
-- Uses TargetBotCore for shared pure functions (DRY, SRP)
-- Uses TargetCore for shared pure functions (DRY, SRP)
-- Dynamic scaling based on monster count for better reactivity
--------------------------------------------------------------------------------

Expand Down Expand Up @@ -44,7 +44,7 @@ local DIR_VECTORS = Geometry.DIR_VECTORS or {
--------------------------------------------------------------------------------
-- IMPROVED WAVE AVOIDANCE SYSTEM
--
-- Uses TargetBotCore pure functions and improved scoring algorithm.
-- Uses TargetCore pure functions and improved scoring algorithm.
-- Key improvements:
-- 1. Dynamic scaling based on monster count (more reactive when surrounded)
-- 2. Better front arc detection with configurable width
Expand Down Expand Up @@ -464,11 +464,11 @@ nExBot.analyzePositionDanger = analyzePositionDanger
nExBot.findSafeAdjacentTile = findSafeAdjacentTile

--------------------------------------------------------------------------------
-- UTILITY FUNCTIONS (Optimized with TargetBotCore integration)
-- UTILITY FUNCTIONS (Optimized with TargetCore integration)
--------------------------------------------------------------------------------

-- Pure function: Count walkable tiles around a position
-- Uses TargetBotCore.Geometry if available
-- Uses TargetCore.Geometry if available
-- @param position: center position
-- @return number
local function countWalkableTiles(position)
Expand Down
4 changes: 2 additions & 2 deletions targetbot/target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local looterStatus = ""
TargetBot = TargetBot or {}
TargetBot.smartPullActive = false -- When true, CaveBot pauses waypoint walking

-- Use TargetBotCore if available (DRY principle)
-- Use TargetCore if available (DRY principle)
local Core = TargetCore or {}

-- Creature type constants for clarity
Expand Down Expand Up @@ -143,7 +143,7 @@ local function updateCreatureInCache(creature)
local pos = player:getPosition()
local cpos = creature:getPosition()

-- Use TargetBotCore distance if available, otherwise calculate
-- Use TargetCore distance if available, otherwise calculate
local dist
if Core.Geometry and Core.Geometry.chebyshevDistance then
dist = Core.Geometry.chebyshevDistance(pos, cpos)
Expand Down