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
Closed
Conversation
…or phase on same turn not working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes on top of YieldRework:
1. Event-driven interrupts
Event-driven interrupts. Replaces per-priority-pass polling of
shouldInterruptYieldwith one-shot break flags fired offGameEventsubscription. Interrupts now fire exactly once when the triggering event lands instead of re-firing every priority window for as long as the state holds.YieldControllergains abreakNextPriorityPassflag set byonAttackersDeclared/onSpellAbilityCasthandlers and consumed once at the top ofmayAutoPass. Yield modes clear unconditionally on consumption; APINA breaks only whenYIELD_AUTO_PASS_RESPECTS_INTERRUPTSis 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
EventBusdirectly viaFControlGameEventHandler.@Subscribe, while remote clients receive events throughIGuiGame.handleGameEvent. Both paths funnel throughFControlGameEventHandler.receiveGameEvent, so a singleAbstractGuiGame.notifyYieldEventcall from there reaches both.shouldInterruptYield,isBeingAttacked, andhasMassRemovalOnStackare 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.
setYieldMarkerInternalpreviously setatMarkerNow = 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) recordedhasLeftMarker=true, activationOnMarker=false, then the firing logic short-circuited viapastTargeton the next priority pass and cleared the marker immediately.Renaming to
isPriorityAtOrPastMarkerand broadening the predicate to "at or past the marker in the owner's current turn" forces a full cycle before firing in both cases.