Skip to content

Improve combat-event compatibility and interrupt timing - #60

Open
Kaysur94 wants to merge 4 commits into
apoguita:mainfrom
Kaysur94:combat-event-interrupt-foundation
Open

Kaysur94 wants to merge 4 commits into
apoguita:mainfrom
Kaysur94:combat-event-interrupt-foundation

Conversation

@Kaysur94

@Kaysur94 Kaysur94 commented Aug 6, 2026

Copy link
Copy Markdown

Summary

This PR improves the combat-event bridge and interrupt timing without adding any build-specific targeting or team logic.

Changes

  • Adds compatibility support for native combat-event handling.
  • Normalizes skill activation, cast-time, finish, stop, and interrupt events.
  • Adds timed skill-activation tracking.
  • Uses native cast timing where available for more accurate interrupt feasibility checks.
  • Adds ReforgedSupport as a small shared observer for cast start and duration data.
  • Keeps the existing polling and skill-data logic as fallback.

Why

Static skill activation times are not always accurate after Fast Casting and other cast-time modifiers. Native cast-time events provide a more reliable interrupt window and reduce late or unnecessary interrupt attempts.

Safety

  • No damage telemetry is enabled.
  • No Keystone / HR KeySoJway-specific logic is included.
  • Existing behavior remains available as fallback if native events are unavailable.

Testing

  • All included Python files pass py_compile.
  • Tested with native cast start, finish, stop, and interrupt events.

@apoguita

apoguita commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Verdict for the original request: request changes — this PR starts fixing the existing combat-event path, then bypasses it with a second private implementation and silent fallbacks.

[BLOCKER] Py4GWCoreLib/Builds/Skills/ReforgedSupport.py creates another cast-tracking system after Py4GWCoreLib/CombatEventQueue_src/helpers.py has already been changed to receive the needed events.

helpers.py is the existing place that receives combat events and turns them into usable combat state. ReforgedSupport.py then keeps another list of active casts, durations, pending cast times, and outcomes, and HeroAI reads that private state separately.

As a result, the same cast can have different timing information depending on whether HeroAI reads the existing event path, ReforgedSupport, or its old observer.

[BLOCKER] HeroAI/interrupt.py silently ignores failure of the new path.

The three new try: import ReforgedSupport ... except Exception: pass blocks make HeroAI fall back to old timing when the new code cannot import, initialize, or return valid data.

As a result, a broken Reforged path does not fail visibly. HeroAI simply uses different timing data, so we cannot know which implementation made an interrupt decision.

[BLOCKER] CombatEvents.py treats missing event modules as an optional compatibility case.

Trying PyAgentEvents, then PyCombatEvents, then continuing with an unavailable queue or polling fallback does not fix the event source. It hides the fact that the supported Reforged event path has not been established.

As a result, the PR can appear to support Reforged while bypassing the code that actually needs to be fixed.

[P1] path_quality() and its PyPathing cache are unrelated to interrupt timing and are not used by this PR.

Required direction:

  1. Remove ReforgedSupport.py and remove the new dynamic imports from HeroAI/interrupt.py.
    Why: they create a second implementation of cast timing and allow HeroAI to silently switch between old and new behavior.

  2. Finish the cast-time work in Py4GWCoreLib/CombatEventQueue_src/helpers.py, then expose the result through Py4GWCoreLib/CombatEvents.py.
    Why: this is already the code that receives combat events. It must be the one place that provides cast start time, cast duration, and cast completion to every consumer.

  3. Make HeroAI read that CoreLib result directly.
    Why: HeroAI should consume one supported answer for interrupt timing, not import a private support module and not make CoreLib import HeroAI back again.

  4. Fix the actual Reforged game-event module if the required events are missing, incomplete, or unreliable. Remove the PyCombatEvents compatibility path and optional-import fallback.
    Why: a Python fallback cannot repair an event source that is not correctly exposed to Python. The source must be fixed where the game event enters the project.

  5. Remove path_quality() from this PR or submit it separately.
    Why: it is unrelated functionality and makes this interrupt-timing change harder to review.

  6. Provide focused Pyright, native-build, and injected-client evidence for the final path: cast-start event, cast duration, correct skill pairing, cast cleanup, and HeroAI’s interrupt decision.
    Why: static code does not prove that the running client provides the events required by this implementation.

The current implementation is a private rewrite with silent fallbacks, not a fix to the existing supported combat-event path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants