refactor(battle-node): generalise BuildMatched/BuildBattleStart for PvP
Both helpers now take the opponent's MatchContext + an explicit seed instead of pulling ScriptedProfiles.OpponentMatchedProfile / OpponentBattleStartProfile internally. ScriptedBotParticipant.Context fixture absorbs the cosmetic fields previously hardcoded in ScriptedProfiles so Scripted's wire bytes stay identical - verified by integration tests still green. Phase 2 prep: PvP arms will call the same helpers with the real opponent participant's Context. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -98,15 +98,19 @@ public sealed class BattleSession
|
||||
|
||||
case NetworkBattleUri.InitBattle when Phase == BattleSessionPhase.AwaitingInitBattle:
|
||||
// Phase 1: push Matched only to the "real" participant. The session reads
|
||||
// selfInfo from from.Context; opponent half currently comes from
|
||||
// ScriptedProfiles inside ScriptedLifecycle.BuildMatched (Phase 2 generalises
|
||||
// to use other.Context for per-perspective Matched).
|
||||
result.Add((from, ScriptedLifecycle.BuildMatched(from.Context, from.ViewerId, other.ViewerId, BattleId), false));
|
||||
// selfInfo from from.Context and oppoInfo from other.Context (the scripted
|
||||
// bot's Context fixture preserves the prod-captured cosmetics that previously
|
||||
// lived in ScriptedProfiles).
|
||||
result.Add((from, ScriptedLifecycle.BuildMatched(
|
||||
from.Context, other.Context,
|
||||
from.ViewerId, other.ViewerId,
|
||||
BattleId, ScriptedProfiles.BattleSeed), false));
|
||||
Phase = BattleSessionPhase.AwaitingLoaded;
|
||||
break;
|
||||
|
||||
case NetworkBattleUri.Loaded when Phase == BattleSessionPhase.AwaitingLoaded:
|
||||
result.Add((from, ScriptedLifecycle.BuildBattleStart(from.Context, from.ViewerId), false));
|
||||
result.Add((from, ScriptedLifecycle.BuildBattleStart(
|
||||
from.Context, other.Context, from.ViewerId), false));
|
||||
result.Add((from, ScriptedLifecycle.BuildDeal(), false));
|
||||
Phase = BattleSessionPhase.AwaitingSwap;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user