Skip to content

Make yield interrupts event-driven and fix small issue with ff not working to past phases in current turn#18

Closed
autumnmyst wants to merge 3 commits intoMostCromulent:YieldReworkfrom
autumnmyst:yield-rework-fixes
Closed

Make yield interrupts event-driven and fix small issue with ff not working to past phases in current turn#18
autumnmyst wants to merge 3 commits intoMostCromulent:YieldReworkfrom
autumnmyst:yield-rework-fixes

Conversation

@autumnmyst
Copy link
Copy Markdown

Two fixes on top of YieldRework:

1. Event-driven interrupts

Event-driven interrupts. Replaces per-priority-pass polling of shouldInterruptYield with one-shot break flags fired off GameEvent subscription. Interrupts now fire exactly once when the triggering event lands instead of re-firing every priority window for as long as the state holds.

YieldController gains a breakNextPriorityPass flag set by onAttackersDeclared / onSpellAbilityCast handlers and consumed once at the top of mayAutoPass. Yield modes clear unconditionally on consumption; APINA breaks only when YIELD_AUTO_PASS_RESPECTS_INTERRUPTS is on. After consumption the flag is cleared, so the next priority pass is unaffected unless a new event arrives.

Forge has two GUI event paths: a local desktop subscribes to the engine EventBus directly via FControlGameEventHandler.@Subscribe, while remote clients receive events through IGuiGame.handleGameEvent. Both paths funnel through FControlGameEventHandler.receiveGameEvent, so a single AbstractGuiGame.notifyYieldEvent call from there reaches both.

shouldInterruptYield, isBeingAttacked, and hasMassRemovalOnStack are removed as their job has been moved into the per-event handlers.

2. Past-phase marker fix

Past-phase marker fix. Right-clicking a phase indicator that's already past in the current turn (e.g. UPKEEP while in MAIN2) no longer clears the marker immediately, now waits for the next turn's pass through the marker phase.

setYieldMarkerInternal previously set atMarkerNow = isPriorityAt(marker), which only matched when the current phase equals the marker phase. Activating in a phase already past the marker (e.g. UPKEEP marker set during MAIN2) recorded hasLeftMarker=true, activationOnMarker=false, then the firing logic short-circuited via pastTarget on the next priority pass and cleared the marker immediately.

Renaming to isPriorityAtOrPastMarker and broadening the predicate to "at or past the marker in the owner's current turn" forces a full cycle before firing in both cases.

@autumnmyst autumnmyst closed this Apr 28, 2026
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.

1 participant