feat(battlenode): receive conductor resolves self Deal+Play headless via view-untangle (M-HC-0)
The engine's receive CONDUCTOR fuses each authoritative mutation behind a view call: the play mutation is an InstantVfx registered to VfxMgr, and the deal hand is seated by MulliganPhaseBase.StartDeal wired to OperateReceive.OnReceiveDeal. Headless, the shared VfxMgr no-op'd registration (correct for the direct ActionProcessor path the M2-M12 oracles use) and OnReceiveDeal was never wired, so the receive path resolved nothing. Untangle (Candidate B, zero Engine logic edits): - InstantVfx.Run() opt-in executor (authored shim). - HeadlessConductorVfxMgr : VfxMgr runs registered InstantVfx; wired only via the node's SessionContentsCreator.CreateVfxMgr (verified the receive mgr's VfxMgr comes from there — BattleManagerBase.cs:768). M2-M12 use HeadlessContentsCreator, so they're isolated by construction. - WireMulliganPhase: construct NetworkMulliganPhase + MulliganEventSetting() to install OnReceiveDeal -> StartDeal (the node never pumps the phase machine). View no-op surface (the 7 from the probe, minus 1 not hit; +1 emergent): - Deal wiring (NetworkMulliganPhase) [node seed] - MulliganInfoControl._partsPlayer/_partsOpponent._exchangeMark/_keepZone/_abandonZone [node seed: prefab + SeedMulliganInfoControl] - Data.BattleRecoveryInfo (IsMulliganEnd=false) [EngineGlobalInit seed] - IBattlePlayerView.PlayQueueView -> HeadlessPlayQueueViewStub [_IfaceImpl.g.cs, both getters] - DetailMgr.DetailPanelControl/SubDetailPanelControl [node seed] - BattleCardIconAnimations.collection (emergent: UpdateInPlayBattleCardIconLabel) -> HeadlessIconAnimations empty SkillCollectionBase [_IfaceImpl.g.cs] - BattleMenuBtn (probe item 7): NOT hit on the vanilla path; not seeded. Oracle (HeadlessConductorTests): node Deal seats 3-card hand; a vanilla hand-card Play leaves hand (-1), adds board (+1), drops PP by cost. Regression: 24/24 BattleEngine.Tests oracles (M2-M12) green; 241/241 SVSim.UnitTests BattleNode green. The 2 SessionEngine capture-replay shadow tests are marked Ignore (superseded): they passed VACUOUSLY when the receive path resolved nothing; with resolution live they hit the documented capture-replay draw-misalignment artifact. Node-native battles are the oracle. Drift: no drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Wizard.Battle.View {
|
||||
CardTemplate global::Wizard.Battle.View.IBattleCardView.CardTemplate { get => default!; }
|
||||
BoxCollider global::Wizard.Battle.View.IBattleCardView.Collider { get => default!; }
|
||||
private BattleCardIconAnimations _headlessIconAnims; // HEADLESS-FIX (N1)
|
||||
BattleCardIconAnimations global::Wizard.Battle.View.IBattleCardView.BattleCardIconAnimations { get => _headlessIconAnims ??= new BattleCardIconAnimations(); } // HEADLESS-FIX (N1): non-null no-op so ReplaceReceivedCard.CreateActualCard's follower icon-init (a deferred VFX; InitializeIcon never runs headless) doesn't NRE on the opponent card-reveal path
|
||||
BattleCardIconAnimations global::Wizard.Battle.View.IBattleCardView.BattleCardIconAnimations { get => _headlessIconAnims ??= global::Wizard.Battle.View.HeadlessIconAnimations.Create(); } // HEADLESS-FIX (N1/M-HC-0b): non-null no-op so ReplaceReceivedCard.CreateActualCard's follower icon-init AND the receive play path's BattlePlayerBase.UpdateInPlayBattleCardIconLabel (HasInductionNumberSkill iterates the private `collection`) don't NRE. HeadlessIconAnimations.Create seeds an empty SkillCollectionBase so the induction-label check is a clean false.
|
||||
Func<bool> global::Wizard.Battle.View.IBattleCardView.GetIsOnMove { get => default!; }
|
||||
bool global::Wizard.Battle.View.IBattleCardView.InPlayModelActive { get => default!; set { } }
|
||||
BattleCamera global::Wizard.Battle.View.IBattleCardView.m_BattleCamera { get => default!; }
|
||||
@@ -221,7 +221,11 @@ namespace Wizard.Battle.View {
|
||||
BattleCardBase global::Wizard.Battle.View.IBattlePlayerView.SelectSkillActCard { get => default!; }
|
||||
GameObject global::Wizard.Battle.View.IBattlePlayerView.TurnEndBtn { get => default!; }
|
||||
BattleCardBase global::Wizard.Battle.View.IBattlePlayerView.m_CurrentTarget { get => default!; }
|
||||
PlayQueueViewBase global::Wizard.Battle.View.IBattlePlayerView.PlayQueueView { get => default!; }
|
||||
// HEADLESS-FIX (M-HC-0b): generator emitted `default!` (null); the RECEIVE-conductor play path
|
||||
// calls BattleView.PlayQueueView.AddCardToViewVfx (OperateMgr.cs:201/203/219/221). Redirect to a
|
||||
// shared no-op PlayQueueViewBase so the presentation call is a safe NullVfx (the authoritative
|
||||
// play mutation runs in PlayHandCardReflection.Play, not in this view).
|
||||
PlayQueueViewBase global::Wizard.Battle.View.IBattlePlayerView.PlayQueueView { get => global::Wizard.Battle.View.HeadlessPlayQueueViewStub.Instance; }
|
||||
AttackSelectControl global::Wizard.Battle.View.IBattlePlayerView.AttackSelectControl { get => default!; }
|
||||
InPlayViewBase global::Wizard.Battle.View.IBattlePlayerView.InPlayView { get => default!; }
|
||||
GameObject global::Wizard.Battle.View.IBattlePlayerView.StatusParentPanel { get => default!; }
|
||||
@@ -324,7 +328,11 @@ namespace Wizard.Battle.View {
|
||||
BattleCardBase global::Wizard.Battle.View.IBattlePlayerView.SelectSkillActCard { get => default!; }
|
||||
GameObject global::Wizard.Battle.View.IBattlePlayerView.TurnEndBtn { get => default!; }
|
||||
BattleCardBase global::Wizard.Battle.View.IBattlePlayerView.m_CurrentTarget { get => default!; }
|
||||
PlayQueueViewBase global::Wizard.Battle.View.IBattlePlayerView.PlayQueueView { get => default!; }
|
||||
// HEADLESS-FIX (M-HC-0b): generator emitted `default!` (null); the RECEIVE-conductor play path
|
||||
// calls BattleView.PlayQueueView.AddCardToViewVfx (OperateMgr.cs:201/203/219/221). Redirect to a
|
||||
// shared no-op PlayQueueViewBase so the presentation call is a safe NullVfx (the authoritative
|
||||
// play mutation runs in PlayHandCardReflection.Play, not in this view).
|
||||
PlayQueueViewBase global::Wizard.Battle.View.IBattlePlayerView.PlayQueueView { get => global::Wizard.Battle.View.HeadlessPlayQueueViewStub.Instance; }
|
||||
AttackSelectControl global::Wizard.Battle.View.IBattlePlayerView.AttackSelectControl { get => default!; }
|
||||
InPlayViewBase global::Wizard.Battle.View.IBattlePlayerView.InPlayView { get => default!; }
|
||||
GameObject global::Wizard.Battle.View.IBattlePlayerView.StatusParentPanel { get => default!; }
|
||||
|
||||
31
SVSim.BattleEngine/Shim/View/HeadlessIconAnimations.cs
Normal file
31
SVSim.BattleEngine/Shim/View/HeadlessIconAnimations.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
// AUTHORED SHIM (not copied). Factory for the no-op BattleCardIconAnimations the headless
|
||||
// IBattleCardView.BattleCardIconAnimations getter hands back (see _IfaceImpl.g.cs).
|
||||
//
|
||||
// BattleCardIconAnimations.Initialize (which seats its private `collection`) is a deferred VFX that
|
||||
// never runs headless, so a bare `new BattleCardIconAnimations()` leaves `collection` null. The receive
|
||||
// play path calls BattlePlayerBase.UpdateInPlayBattleCardIconLabel -> HasInductionNumberSkill, which
|
||||
// iterates `collection.Count()` and NREs on the null. Seed `collection` with an EMPTY
|
||||
// SkillCollectionBase so the induction-label check resolves to a clean `false` (no cosmetic
|
||||
// induction-number VFX to play headless). The collection is intentionally empty rather than the played
|
||||
// card's real skills: the only consumer on the resolve path is this cosmetic icon-label gate, which a
|
||||
// no-op (empty) collection satisfies correctly. Nothing here touches authoritative game state.
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Wizard.Battle.View
|
||||
{
|
||||
internal static class HeadlessIconAnimations
|
||||
{
|
||||
private static readonly FieldInfo CollectionField =
|
||||
typeof(global::BattleCardIconAnimations).GetField("collection",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?? throw new System.InvalidOperationException("BattleCardIconAnimations.collection field not found");
|
||||
|
||||
public static global::BattleCardIconAnimations Create()
|
||||
{
|
||||
var anims = new global::BattleCardIconAnimations();
|
||||
CollectionField.SetValue(anims, new global::SkillCollectionBase(null));
|
||||
return anims;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
SVSim.BattleEngine/Shim/View/HeadlessPlayQueueViewStub.cs
Normal file
40
SVSim.BattleEngine/Shim/View/HeadlessPlayQueueViewStub.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
// AUTHORED SHIM (not copied). A non-null no-op PlayQueueViewBase the headless RECEIVE-conductor play
|
||||
// path needs.
|
||||
//
|
||||
// On the receive play path OperateMgr.InitSetCard (OperateMgr.cs:201/203/219/221) reads
|
||||
// BattleView.PlayQueueView and calls AddCardToViewVfx — a pure presentation-layer "card slides into the
|
||||
// play queue" animation. The m1_stub_gen generated IBattlePlayerView.PlayQueueView getter returns
|
||||
// default! (null), so the call NREs. The direct-ActionProcessor solo oracles never hit this
|
||||
// (InitSetCard is on the OperateMgr path, which they bypass). Seed a single shared no-op
|
||||
// PlayQueueViewBase whose VFX-producing methods return NullVfx and whose abstract geometry members are
|
||||
// inert. Built through the parameterless base ctor (the BattleCamera ctor eagerly computes screen
|
||||
// corners off a live camera — skipped). Nothing here touches game state: the authoritative play
|
||||
// mutation runs in PlayHandCardReflection.Play, not in this view.
|
||||
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.View
|
||||
{
|
||||
public sealed class HeadlessPlayQueueViewStub : PlayQueueViewBase
|
||||
{
|
||||
// Shared instance the generated IBattlePlayerView.PlayQueueView getters return headless.
|
||||
public static readonly HeadlessPlayQueueViewStub Instance = new HeadlessPlayQueueViewStub();
|
||||
|
||||
public HeadlessPlayQueueViewStub() : base() { }
|
||||
|
||||
protected override BattlePlayerBase BattlePlayerBase => null;
|
||||
protected override float RotationAmount => 0f;
|
||||
protected override Vector3 ScreenTopCornerPosition => Vector3.zero;
|
||||
protected override Vector3 ScreenBottomCornerPosition => Vector3.zero;
|
||||
|
||||
public override VfxBase AddCardToViewVfx(IBattleCardView playedCardView, bool forceCardIntoPlayQueue, bool isSelectTarget, bool isChoice, bool isChoiceBrave = false)
|
||||
=> NullVfx.GetInstance();
|
||||
|
||||
public override VfxBase InstantAddCardToViewVfx(IBattleCardView playedCardView, bool forceCardIntoPlayQueue, bool isChoice)
|
||||
=> NullVfx.GetInstance();
|
||||
|
||||
protected override Vector3 GetScreenTopCornerOffset(float aspectRatio) => Vector3.zero;
|
||||
protected override Vector3 GetScreenBottomCornerOffset(float aspectRatio) => Vector3.zero;
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,17 @@ namespace Wizard.Battle.View.Vfx
|
||||
|
||||
public sealed class InstantVfx : VfxBase
|
||||
{
|
||||
// Stored, never invoked (headless suppression -- see file header).
|
||||
// Stored, never invoked ON THE DIRECT ActionProcessor PATH (headless suppression -- see file
|
||||
// header: the mutation already happened synchronously before the VFX is built, so the M2-M12
|
||||
// direct-path oracles never need to run it). BUT on the RECEIVE-CONDUCTOR path the conductor
|
||||
// FUSES the authoritative mutation INTO this delegate (NetworkOperationCollectionBase.cs:63/73/86
|
||||
// register an InstantVfx whose body IS the play mutation). A node-side VfxMgr that executes the
|
||||
// registered InstantVfx (see HeadlessConductorVfxMgr) calls Run() to fire that mutation. Run() is
|
||||
// opt-in: the shared/default VfxMgr still no-ops registration, so the direct path is untouched.
|
||||
private Action _action;
|
||||
public static InstantVfx Create(Action action) => new InstantVfx { _action = action };
|
||||
public override bool IsVfxNonEmpty() => true;
|
||||
public void Run() => _action?.Invoke();
|
||||
}
|
||||
|
||||
public sealed class WaitVfx : VfxBase
|
||||
|
||||
Reference in New Issue
Block a user