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>
154 lines
10 KiB
C#
154 lines
10 KiB
C#
// AUTHORED SHIM (not copied). Minimal no-op UnityEngine value-type surface. Grows via
|
|
// the M1 compile loop -- members added are exactly those the copied engine references
|
|
// (geometry/math used inside never-run VFX/layout code; IsForecast suppresses playback,
|
|
// so numeric results here never feed authoritative game state).
|
|
using System;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
public struct Vector2
|
|
{
|
|
public float x, y;
|
|
public Vector2(float x, float y) { this.x = x; this.y = y; }
|
|
public static Vector2 zero => new Vector2(0, 0);
|
|
public static Vector2 one => new Vector2(1, 1);
|
|
public static Vector2 up => new Vector2(0, 1);
|
|
public static Vector2 right => new Vector2(1, 0);
|
|
public float magnitude => (float)Math.Sqrt(x * x + y * y);
|
|
public float sqrMagnitude => x * x + y * y;
|
|
public Vector2 normalized { get { float m = magnitude; return m > 1e-6f ? new Vector2(x / m, y / m) : zero; } }
|
|
public static float Distance(Vector2 a, Vector2 b) => (a - b).magnitude;
|
|
public static float Angle(Vector2 from, Vector2 to) => 0f;
|
|
public void Normalize() { var n = normalized; x = n.x; y = n.y; }
|
|
public static Vector2 Lerp(Vector2 a, Vector2 b, float t) => new Vector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
|
|
public static Vector2 operator +(Vector2 a, Vector2 b) => new Vector2(a.x + b.x, a.y + b.y);
|
|
public static Vector2 operator -(Vector2 a, Vector2 b) => new Vector2(a.x - b.x, a.y - b.y);
|
|
public static Vector2 operator -(Vector2 a) => new Vector2(-a.x, -a.y);
|
|
public static Vector2 operator *(Vector2 a, float s) => new Vector2(a.x * s, a.y * s);
|
|
public static Vector2 operator *(float s, Vector2 a) => new Vector2(a.x * s, a.y * s);
|
|
public static Vector2 operator /(Vector2 a, float s) => new Vector2(a.x / s, a.y / s);
|
|
public static Vector2 operator *(Vector2 a, Vector2 b) => new Vector2(a.x * b.x, a.y * b.y);
|
|
public static bool operator ==(Vector2 a, Vector2 b) => a.x == b.x && a.y == b.y;
|
|
public static bool operator !=(Vector2 a, Vector2 b) => !(a == b);
|
|
public override bool Equals(object o) => o is Vector2 v && this == v;
|
|
public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2);
|
|
public static implicit operator Vector2(Vector3 v) => new Vector2(v.x, v.y);
|
|
public static implicit operator Vector3(Vector2 v) => new Vector3(v.x, v.y, 0);
|
|
}
|
|
|
|
public struct Vector3
|
|
{
|
|
public float x, y, z;
|
|
public Vector3(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
|
|
public Vector3(float x, float y) { this.x = x; this.y = y; this.z = 0; }
|
|
public static Vector3 zero => new Vector3(0, 0, 0);
|
|
public static Vector3 one => new Vector3(1, 1, 1);
|
|
public static Vector3 up => new Vector3(0, 1, 0);
|
|
public static Vector3 down => new Vector3(0, -1, 0);
|
|
public static Vector3 left => new Vector3(-1, 0, 0);
|
|
public static Vector3 right => new Vector3(1, 0, 0);
|
|
public static Vector3 forward => new Vector3(0, 0, 1);
|
|
public static Vector3 back => new Vector3(0, 0, -1);
|
|
public float magnitude => (float)Math.Sqrt(x * x + y * y + z * z);
|
|
public float sqrMagnitude => x * x + y * y + z * z;
|
|
public Vector3 normalized { get { float m = magnitude; return m > 1e-6f ? new Vector3(x / m, y / m, z / m) : zero; } }
|
|
public static float Distance(Vector3 a, Vector3 b) => (a - b).magnitude;
|
|
public static float SqrMagnitude(Vector3 a) => a.sqrMagnitude;
|
|
public static float Dot(Vector3 a, Vector3 b) => a.x * b.x + a.y * b.y + a.z * b.z;
|
|
public static Vector3 Scale(Vector3 a, Vector3 b) => new Vector3(a.x * b.x, a.y * b.y, a.z * b.z);
|
|
public void Scale(Vector3 s) { x *= s.x; y *= s.y; z *= s.z; }
|
|
public static Vector3 Lerp(Vector3 a, Vector3 b, float t) => new Vector3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t);
|
|
public static Vector3 operator +(Vector3 a, Vector3 b) => new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
|
|
public static Vector3 operator -(Vector3 a, Vector3 b) => new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
public static Vector3 operator -(Vector3 a) => new Vector3(-a.x, -a.y, -a.z);
|
|
public static Vector3 operator *(Vector3 a, float s) => new Vector3(a.x * s, a.y * s, a.z * s);
|
|
public static Vector3 operator *(float s, Vector3 a) => new Vector3(a.x * s, a.y * s, a.z * s);
|
|
public static Vector3 operator /(Vector3 a, float s) => new Vector3(a.x / s, a.y / s, a.z / s);
|
|
public static bool operator ==(Vector3 a, Vector3 b) => a.x == b.x && a.y == b.y && a.z == b.z;
|
|
public static bool operator !=(Vector3 a, Vector3 b) => !(a == b);
|
|
public override bool Equals(object o) => o is Vector3 v && this == v;
|
|
public override int GetHashCode() => x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode();
|
|
}
|
|
|
|
public struct Quaternion
|
|
{
|
|
public float x, y, z, w;
|
|
public Quaternion(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; }
|
|
public static Quaternion identity => new Quaternion(0, 0, 0, 1);
|
|
public static Quaternion Euler(float x, float y, float z) => identity;
|
|
public static Quaternion Euler(Vector3 e) => identity;
|
|
public static Quaternion AngleAxis(float angle, Vector3 axis) => identity;
|
|
public static Quaternion Slerp(Quaternion a, Quaternion b, float t) => identity;
|
|
public Vector3 eulerAngles { get => Vector3.zero; set { } }
|
|
public static Vector3 operator *(Quaternion q, Vector3 v) => v;
|
|
public static Quaternion operator *(Quaternion a, Quaternion b) => identity;
|
|
}
|
|
|
|
public struct Color
|
|
{
|
|
public float r, g, b, a;
|
|
public Color(float r, float g, float b, float a) { this.r = r; this.g = g; this.b = b; this.a = a; }
|
|
public Color(float r, float g, float b) { this.r = r; this.g = g; this.b = b; this.a = 1f; }
|
|
public static Color white => new Color(1, 1, 1, 1);
|
|
public static Color black => new Color(0, 0, 0, 1);
|
|
public static Color clear => new Color(0, 0, 0, 0);
|
|
public static Color red => new Color(1, 0, 0, 1);
|
|
public static Color cyan => new Color(0, 1, 1, 1);
|
|
public static Color gray => new Color(0.5f, 0.5f, 0.5f, 1);
|
|
public static Color grey => gray;
|
|
public static Color Lerp(Color a, Color b, float t) => new Color(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t);
|
|
public static Color operator *(Color c, float s) => new Color(c.r * s, c.g * s, c.b * s, c.a * s);
|
|
public static Color operator *(Color a, Color b) => new Color(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a);
|
|
public static Color operator +(Color a, Color b) => new Color(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a);
|
|
public static implicit operator Color(Color32 c) => new Color(c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f);
|
|
public static implicit operator Color32(Color c) => new Color32(
|
|
(byte)(Mathf.Clamp01(c.r) * 255f), (byte)(Mathf.Clamp01(c.g) * 255f),
|
|
(byte)(Mathf.Clamp01(c.b) * 255f), (byte)(Mathf.Clamp01(c.a) * 255f));
|
|
public static bool operator ==(Color a, Color b) => a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
|
|
public static bool operator !=(Color a, Color b) => !(a == b);
|
|
public override bool Equals(object o) => o is Color c && this == c;
|
|
public override int GetHashCode() => r.GetHashCode() ^ (g.GetHashCode() << 2) ^ (b.GetHashCode() << 4) ^ (a.GetHashCode() << 6);
|
|
}
|
|
|
|
public static class Mathf
|
|
{
|
|
public static float Floor(float f) => (float)Math.Floor(f);
|
|
public static int FloorToInt(float f) => (int)Math.Floor(f);
|
|
public static float Ceil(float f) => (float)Math.Ceiling(f);
|
|
public static float Round(float f) => (float)Math.Round(f);
|
|
public static int RoundToInt(float f) => (int)Math.Round(f);
|
|
public static float Abs(float f) => Math.Abs(f);
|
|
public static int Abs(int f) => Math.Abs(f);
|
|
public static float Max(float a, float b) => Math.Max(a, b);
|
|
public static int Max(int a, int b) => Math.Max(a, b);
|
|
public static float Max(params float[] values) { float m = float.NegativeInfinity; foreach (var v in values) m = Math.Max(m, v); return m; }
|
|
public static int Max(params int[] values) { int m = int.MinValue; foreach (var v in values) m = Math.Max(m, v); return m; }
|
|
public static float Min(float a, float b) => Math.Min(a, b);
|
|
public static int Min(int a, int b) => Math.Min(a, b);
|
|
public static float Min(params float[] values) { float m = float.PositiveInfinity; foreach (var v in values) m = Math.Min(m, v); return m; }
|
|
public static int Min(params int[] values) { int m = int.MaxValue; foreach (var v in values) m = Math.Min(m, v); return m; }
|
|
public static float Clamp(float v, float lo, float hi) => Math.Max(lo, Math.Min(hi, v));
|
|
public static int Clamp(int v, int lo, int hi) => Math.Max(lo, Math.Min(hi, v));
|
|
public static float Clamp01(float v) => Math.Max(0f, Math.Min(1f, v));
|
|
public static float Lerp(float a, float b, float t) => a + (b - a) * Clamp01(t);
|
|
public static float SmoothDamp(float cur, float target, ref float vel, float time) { vel = 0; return target; }
|
|
public static float SmoothDampAngle(float cur, float target, ref float vel, float time) { vel = 0; return target; }
|
|
public static float Sin(float f) => (float)Math.Sin(f);
|
|
public static float Cos(float f) => (float)Math.Cos(f);
|
|
public static float Asin(float f) => (float)Math.Asin(f);
|
|
public static float Atan2(float y, float x) => (float)Math.Atan2(y, x);
|
|
public static float Sqrt(float f) => (float)Math.Sqrt(f);
|
|
public static float Pow(float f, float p) => (float)Math.Pow(f, p);
|
|
public static float Log(float f) => (float)Math.Log(f);
|
|
public static float Sign(float f) => Math.Sign(f);
|
|
public static bool Approximately(float a, float b) => Math.Abs(a - b) < 1e-6f;
|
|
public static float GammaToLinearSpace(float v) => v;
|
|
}
|
|
|
|
public static class Debug
|
|
{
|
|
public static void LogWarning(object m) { }
|
|
public static void LogError(object m) { }
|
|
}
|
|
}
|