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