feat(battle-node): scripted opponent turn loop pushes TurnStart + TurnEnd

The TurnEnd/TurnEndFinal case in ComputeResponses now returns two envelopes
back-to-back — opponent TurnStart followed by opponent TurnEnd. Phase enters
OpponentTurn transiently then resets to AfterReady within the same call so
the next player TurnEnd can fire the cycle again. Closes the v1 'stays at
Opponent's turn… forever' stall.
This commit is contained in:
gamer147
2026-06-01 14:57:49 -04:00
parent 96ae090a3a
commit e30fdb7570

View File

@@ -257,11 +257,15 @@ public sealed class BattleSession
}
case NetworkBattleUri.TurnEnd when Phase == BattleSessionPhase.AfterReady:
case NetworkBattleUri.TurnEndFinal when Phase == BattleSessionPhase.AfterReady:
// Push a minimal opponent TurnStart so the client transitions to "Opponent's turn…"
// display. v1 doesn't simulate the opponent — once this lands, the client sits
// there indefinitely (this IS the documented v1 stopping point).
result.Add((ScriptedLifecycle.BuildOpponentTurnStart(), NoStock: false));
// Scripted opponent: opens its turn, immediately ends it, hands control back.
// Two-frame burst — see docs/superpowers/specs/2026-06-01-battle-node-opponent-turn-loop-design.md.
// OpponentTurn is set then cleared within the same call to document intent;
// the only externally-observable phase after the call is AfterReady, ready for
// the next player TurnEnd to fire the cycle again.
Phase = BattleSessionPhase.OpponentTurn;
result.Add((ScriptedLifecycle.BuildOpponentTurnStart(), NoStock: false));
result.Add((ScriptedLifecycle.BuildOpponentTurnEnd(), NoStock: false));
Phase = BattleSessionPhase.AfterReady;
break;
case NetworkBattleUri.Retire:
case NetworkBattleUri.Kill: