Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
138 lines
6.4 KiB
C#
138 lines
6.4 KiB
C#
// AUTHORED SHIM (not copied). The VFX layer, headless. VfxBase mirrors the real
|
|
// public surface (see decomp Wizard.Battle.View.Vfx/VfxBase.cs) so the ~800 engine
|
|
// call sites that pass/return VfxBase compile unchanged. Containers preserve the
|
|
// CONTROL-FLOW contract (Register collects, IsVfxNonEmpty reflects child count) but
|
|
// perform NO rendering. InstantVfx stores its action and NEVER runs it: headless
|
|
// resolution runs with IsForecast=true so VFX is never played, and per design §3.3
|
|
// all state mutation happens synchronously in the skill methods BEFORE the VFX is
|
|
// built -- so a never-played VFX loses no game state.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Wizard.Battle.View.Vfx
|
|
{
|
|
public interface IEffectVfx { }
|
|
|
|
public class VfxBase
|
|
{
|
|
public virtual bool IsEnd { get; protected set; } = true;
|
|
public virtual void Update(float dt, List<IEffectVfx> effectVfxList) { }
|
|
public virtual void Play() { }
|
|
public virtual bool IsVfxNonEmpty() => false;
|
|
}
|
|
|
|
public sealed class NullVfx : VfxBase
|
|
{
|
|
private static readonly NullVfx _ins = new NullVfx();
|
|
public static NullVfx GetInstance() => _ins;
|
|
public override bool IsVfxNonEmpty() => false;
|
|
}
|
|
|
|
public sealed class InstantVfx : VfxBase
|
|
{
|
|
// 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
|
|
{
|
|
public static WaitVfx Create(float seconds) => new WaitVfx();
|
|
public override bool IsVfxNonEmpty() => false;
|
|
}
|
|
|
|
// Container players: collect children, report non-empty by count, render nothing.
|
|
public class SequentialVfxPlayer : VfxBase
|
|
{
|
|
protected readonly List<VfxBase> _children = new List<VfxBase>();
|
|
public static SequentialVfxPlayer Create() => new SequentialVfxPlayer();
|
|
public static SequentialVfxPlayer Create(IEnumerable<VfxBase> vfxCollection)
|
|
{ var p = new SequentialVfxPlayer(); if (vfxCollection != null) p._children.AddRange(vfxCollection); return p; }
|
|
public static SequentialVfxPlayer Create(params VfxBase[] vfxCollection)
|
|
{ var p = new SequentialVfxPlayer(); if (vfxCollection != null) p._children.AddRange(vfxCollection); return p; }
|
|
public void Register(VfxBase vfx) { if (vfx != null) _children.Add(vfx); }
|
|
public override bool IsVfxNonEmpty()
|
|
{
|
|
foreach (var c in _children) { if (c != null && c.IsVfxNonEmpty()) return true; }
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public class ParallelVfxPlayer : SequentialVfxPlayer
|
|
{
|
|
public static new ParallelVfxPlayer Create() => new ParallelVfxPlayer();
|
|
public static ParallelVfxPlayer Create(IEnumerable<VfxBase> vfxCollection)
|
|
{ var p = new ParallelVfxPlayer(); if (vfxCollection != null) p._children.AddRange(vfxCollection); return p; }
|
|
public static ParallelVfxPlayer Create(params VfxBase[] vfxCollection)
|
|
{ var p = new ParallelVfxPlayer(); if (vfxCollection != null) p._children.AddRange(vfxCollection); return p; }
|
|
public List<VfxBase> GetVfxList() => new List<VfxBase>(_children);
|
|
}
|
|
|
|
public class VfxWithLoading : SequentialVfxPlayer
|
|
{
|
|
public static new VfxWithLoading Create() => new VfxWithLoading();
|
|
public static VfxWithLoading Create(VfxBase mainVfx) => new VfxWithLoading();
|
|
public static VfxWithLoading Create(VfxBase loadingVfx, VfxBase mainVfx) => new VfxWithLoading();
|
|
public virtual VfxBase LoadingVfx => NullVfx.GetInstance();
|
|
public virtual VfxBase MainVfx => NullVfx.GetInstance();
|
|
}
|
|
|
|
public class VfxWithLoadingSequential : VfxWithLoading
|
|
{
|
|
public static new VfxWithLoadingSequential Create() => new VfxWithLoadingSequential();
|
|
public static VfxWithLoadingSequential Create(params VfxBase[] mainVfxCollection) => new VfxWithLoadingSequential();
|
|
public override VfxBase LoadingVfx => NullVfx.GetInstance();
|
|
public override VfxBase MainVfx => NullVfx.GetInstance();
|
|
public void RegisterToLoadingVfx(VfxBase vfxToRegister) { }
|
|
public void RegisterToMainVfx(VfxBase vfxToRegister) { }
|
|
public void RegisterVfxWithLoading(VfxWithLoading vfxWithLoadingToRegister) { }
|
|
}
|
|
|
|
// Non-generic base (engine references bare `VfxWith` as well as the generics).
|
|
public class VfxWith : VfxBase
|
|
{
|
|
public VfxBase Vfx { get; set; }
|
|
}
|
|
|
|
// One-value pair (engine reads .Value / .Vfx).
|
|
public class VfxWith<T> : VfxWith
|
|
{
|
|
public T Value { get; set; }
|
|
public VfxWith() { }
|
|
public VfxWith(VfxBase vfx, T value) { Vfx = vfx; Value = value; }
|
|
}
|
|
|
|
// Two-value pair (engine reads .Value_1 / .Value_2 / .Vfx).
|
|
public class VfxWith<T1, T2> : VfxWith
|
|
{
|
|
public T1 Value_1 { get; set; }
|
|
public T2 Value_2 { get; set; }
|
|
public VfxWith() { }
|
|
public VfxWith(VfxBase vfx, T1 value1, T2 value2) { Vfx = vfx; Value_1 = value1; Value_2 = value2; }
|
|
}
|
|
|
|
public class EvolveVfxBase : VfxBase { }
|
|
|
|
|
|
// The VFX manager: headless, registration is suppressed (real VfxMgr early-returns
|
|
// when IsForecast; we no-op unconditionally since we never pump the render loop).
|
|
public class VfxMgr
|
|
{
|
|
public virtual bool IsEnd => true;
|
|
public void RegisterImmediateVfx<T>(T vfx) where T : VfxBase { }
|
|
public virtual void RegisterSequentialVfx<T>(T vfx) where T : VfxBase { }
|
|
public List<VfxBase> GetVfxList<TType>() => new List<VfxBase>();
|
|
public virtual void Update(float dt) { }
|
|
public virtual void Cancel() { }
|
|
public void Dispose() { }
|
|
}
|
|
}
|