1.5 KiB
2024-12-18 - Fix Combat Skip Logic
Problem
The user could not "Skip Combat" (Move past Declare Attackers). The button action DECLARE_ATTACKERS with 0 attackers was working server-side (resetting priority to AP), but the client UI (SmartButton) remained stuck on "Skip Combat". This created a loop where the user clicked, action processed, priority returned, and the UI still asked them to declare attackers.
Root Cause
The SmartButton logic relied solely on gameState.step === 'declare_attackers'. It did not differentiate between "Need to Declare" (Start of Step) and "After Declaration / Priority Window" (Middle of Step).
Strict Rules State did not have a flag to indicate if the Turn-Based Action of declaring attackers had already occurred for the current step.
Solution
- Updated
Types: Added optionalattackersDeclared(andblockersDeclared) boolean flags toStrictGameState(Server + Client). - Updated
RulesEngine: IndeclareAttackers(), setattackersDeclared = true. IncleanupStep(), reset these flags tofalse. - Updated
SmartButton: Added a check. Ifstep === 'declare_attackers'ANDattackersDeclaredis true, display "Pass (to Blockers)" withPASS_PRIORITYaction instead of "Skip Combat" /DECLARE_ATTACKERS.
Outcome
When a user clicks "Skip Combat" (declares 0 attackers), the server updates the state flag. The UI then updates to show a "Pass" button, allowing the user to proceed to the next step.