diff --git a/debug_loot_capture.png b/debug_loot_capture.png index 80cf44a..0241024 100644 Binary files a/debug_loot_capture.png and b/debug_loot_capture.png differ diff --git a/debug_loot_detected.png b/debug_loot_detected.png index af1c6d3..f275039 100644 Binary files a/debug_loot_detected.png and b/debug_loot_detected.png differ diff --git a/debug_loot_edges.png b/debug_loot_edges.png index 03da3c7..a6c011f 100644 Binary files a/debug_loot_edges.png and b/debug_loot_edges.png differ diff --git a/src/Poe2Trade.Bot/BossRunExecutor.cs b/src/Poe2Trade.Bot/BossRunExecutor.cs index ce28a32..9b7ccb2 100644 --- a/src/Poe2Trade.Bot/BossRunExecutor.cs +++ b/src/Poe2Trade.Bot/BossRunExecutor.cs @@ -236,7 +236,7 @@ public class BossRunExecutor : GameExecutor Log.Error("Could not find Waypoint nameplate"); return false; } - await Sleep(500); + await Sleep(1500); // Template match well-of-souls.png and click var match = await _screen.TemplateMatch(WellOfSoulsTemplate); @@ -512,7 +512,7 @@ public class BossRunExecutor : GameExecutor // -- Async combat: combat runs in background, checks run on main thread -- private volatile int _combatTargetX = 1280; - private volatile int _combatTargetY = 720; + private volatile int _combatTargetY = 660; private volatile int _combatJitter = 30; /// @@ -533,7 +533,7 @@ public class BossRunExecutor : GameExecutor /// Start background combat loop, returning the task and CTS. /// Caller must cancel + await + ReleaseAll when done. /// - private (Task combatTask, CancellationTokenSource cts) StartCombatLoop(int x = 1280, int y = 720, int jitter = 30) + private (Task combatTask, CancellationTokenSource cts) StartCombatLoop(int x = 1280, int y = 660, int jitter = 30) { _combatTargetX = x; _combatTargetY = y; @@ -617,7 +617,7 @@ public class BossRunExecutor : GameExecutor return null; const int screenCx = 1280; - const int screenCy = 720; + const int screenCy = 660; const double screenToWorld = 97.0 / 835.0; (double X, double Y)? lastBossWorldPos = null; var yoloLogCount = 0; @@ -685,9 +685,28 @@ public class BossRunExecutor : GameExecutor _lastDeathCheckMs = 0; if (await CheckDeath()) { healthbarMissCount = 0; continue; } - Log.Information("Healthbar gone for {N} checks, boss phase over after {Ms}ms, lastBossPos={Boss}", - healthbarMissCount, sw.ElapsedMilliseconds, - lastBossWorldPos != null ? $"({lastBossWorldPos.Value.X:F1},{lastBossWorldPos.Value.Y:F1})" : "null"); + Log.Information("Healthbar gone for {N} checks, boss phase over after {Ms}ms", + healthbarMissCount, sw.ElapsedMilliseconds); + + // Keep polling YOLO briefly — boss death animation can move it further. + // Use the LAST detection (not furthest) so we end up where the boss actually is. + var postDeathSw = Stopwatch.StartNew(); + while (postDeathSw.ElapsedMilliseconds < 2000) + { + if (_stopped) break; + var postSnapshot = _bossDetector.Latest; + if (postSnapshot.Bosses.Count > 0) + { + var boss = postSnapshot.Bosses[0]; + var wp = _nav.WorldPosition; + var bx = wp.X + (boss.Cx - screenCx) * screenToWorld; + var by = wp.Y + (boss.Cy - screenCy) * screenToWorld; + lastBossWorldPos = (bx, by); + FightPosition = lastBossWorldPos; + Log.Information("Post-death YOLO: bossWorld=({Bx:F1},{By:F1})", bx, by); + } + await Sleep(100); + } return lastBossWorldPos; } } @@ -754,8 +773,8 @@ public class BossRunExecutor : GameExecutor /// private async Task ClickClosestTemplateToCenter(string templatePath) { - const int screenCx = 2560 / 2; - const int screenCy = 1440 / 2; + const int screenCx = 1280; + const int screenCy = 660; // Search center region only to avoid clicking distant matches var centerRegion = new Region(850, 50, 860, 550); @@ -800,7 +819,7 @@ public class BossRunExecutor : GameExecutor Log.Information("Walking to world ({X:F0},{Y:F0})", worldX, worldY); const int screenCx = 1280; - const int screenCy = 720; + const int screenCy = 660; var sw = Stopwatch.StartNew(); var heldKeys = new HashSet(); diff --git a/src/Poe2Trade.Bot/CombatManager.cs b/src/Poe2Trade.Bot/CombatManager.cs index 91a2db4..2211dd7 100644 --- a/src/Poe2Trade.Bot/CombatManager.cs +++ b/src/Poe2Trade.Bot/CombatManager.cs @@ -42,7 +42,7 @@ public class CombatManager // Smoothed mouse position — lerps toward target to avoid jitter private double _smoothX = 1280; - private double _smoothY = 720; + private double _smoothY = 660; private const double SmoothFactor = 0.25; // 0=no movement, 1=instant snap public bool IsHolding => _holding; @@ -148,7 +148,7 @@ public class CombatManager _orbitIndex = -1; } - const int screenCx = 1280, screenCy = 720; + const int screenCx = 1280, screenCy = 660; var cx = _chaseX; var cy = _chaseY; var dx = cx - screenCx; @@ -256,7 +256,7 @@ public class CombatManager _holding = false; _manaStableCount = 0; _smoothX = 1280; - _smoothY = 720; + _smoothY = 660; await ReleaseOrbit(); await ReleaseChaseKeys(); _chaseX = -1;