fix(a5): restore real A5 waypoint template and bound the WP scan to the game world

assets/templates/a5_wp.png (commit 14f5876) was a crop of the blue mana globe,
not the Harrogath waypoint. It matched the HUD at 0.98-0.99 on every frame, so
A5.open_wp() teleported the character to the bottom-right of the screen and
clicked there; WaypointLabel never appeared and each anchor retry pushed the
character further out until it was stranded on top of the town wall. From there
Larzuk, Qual-Kehk and every town marker were off-screen, which cascaded into
repair/resurrect failures and 5 consecutive run_trav approach failures that
self-disabled all routes.

- restore the pre-14f5876 template (201x120, the real stone arch); it scores
  ~0.30 on the stranded-on-the-wall screenshots instead of 0.99
- scan only Config().ui_roi["town_world"], the already-defined ROI that excludes
  the HUD band and the party/chat column, so a bad template can never again move
  the character into the globes
- add an roi parameter to IChar.select_by_template() to support the above

Co-Authored-By: Claude Opus 5 <[email protected]>
(cherry picked from commit a066d511ca)
This commit is contained in:
alexpolo1
2026-09-04 13:03:12 +02:00
parent b5afd8e663
commit 6ab0807a42
2 changed files with 29 additions and 1 deletions
+29 -1
View File
@@ -862,7 +862,35 @@ ls -t log/stats/mini_stats_*.json | head -1 | xargs python -c "import json,sys;d
after changing `src/`, kill and restart `main.py` — otherwise you are testing the old code and
the log will show messages that no longer exist in the source.
### Bug 25: an empty rejuv column chickened the game at safe HP (2026-09-04)
### Bug 33: main's recaptured `a5_wp.png` was a crop of the mana globe (2026-09-04)
**File:** `assets/templates/a5_wp.png`
Commit `14f5876` ("recapture A5 waypoint template") replaced the real Harrogath waypoint with a
112x125 crop of the **blue mana globe**, so it matched the HUD at **0.966-0.99 on every frame**,
anywhere in the game — which is the template half of Bug 23/27. `A5.open_wp()` walked the
(teleporting) char to the bottom-right of the screen and clicked; `WaypointLabel` never appeared,
so `select_by_template` logged `Wanted to select A5_WP, but could not find it` **despite a 98%
match**, and each anchor retry pushed the char further out until it was stranded on top of the
Harrogath wall, outside walkable town. From there Larzuk, Qual-Kehk and every town marker were
off-screen, so repair, resurrect and `detect_current_act` failed too.
`a5.py` already defends against this with `roi=cut_skill_bar` plus a best-match over
`["A5_WP", "A5_WP_2"]`, which is why the symptom was survivable on main — but the bad capture was
still one of the two candidates. Restored `a5_wp.png` to the pre-`14f5876` capture (201x120, the
real stone arch with two blue flames): it scores **0.30** on frames where the waypoint is absent,
versus 0.966 for the globe crop. Both WP templates are now genuine, so the dual search is a real
fallback rather than a workaround.
**Diagnostic for this whole class** — a template that matches the HUD matches *everything*; score
it against a frame where the target is absent and look at WHERE it matched:
```python
import cv2
img = cv2.imread("log/screenshots/error/<any>.png"); t = cv2.imread("assets/templates/a5_wp.png")
print(cv2.minMaxLoc(cv2.matchTemplate(img, t, cv2.TM_CCOEFF_NORMED))[1::2]) # score, location
```
A high score at a bottom-corner location (x>880, y>580 = the globes) means the template is HUD.
Only `a5_wp.png` was affected; every other `*_wp*.png` scores <0.46 on the same frame.
### Bug 32: an empty rejuv column chickened the game at safe HP (2026-09-04)
**File:** `src/health_manager.py` — rejuv branch of the potion ladder
`take_rejuv_potion_health=0.45` triggers a rejuv attempt at 45% HP, but the real chicken line is
`chicken=0.40`. When `belt.drink_potion("rejuv")` returned False the code chickened **immediately**,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 66 KiB