engine cleanup passes 4-7 + multi-instancing ambient rip
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>
This commit is contained in:
@@ -4,79 +4,6 @@ using System.Linq;
|
||||
|
||||
public class VoiceDictionary
|
||||
{
|
||||
private const string DESTROY_COMVO_VOICE_CHECK = "_4_";
|
||||
|
||||
private const string ENEMY_COMVO_VOICE_CHECK = "_7_";
|
||||
|
||||
private const string ALLY_COMVO_VOICE_CHECK = "_8_";
|
||||
|
||||
private const string ENHANCE_VOICE_CHECK = "_enh";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK = "_ub";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_PLAY = "_ubp";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_30 = "_ubs";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_60 = "_ubl";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_SHORT_30 = "_ubks";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_SHORT_60 = "_ubkl";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_DIRECTLY_30 = "_ubds";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_DIRECTLY_60 = "_ubdl";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_DIRECTLY_SHORT_30 = "_ubdks";
|
||||
|
||||
private const string UNION_BURST_VOICE_CHECK_DIRECTLY_SHORT_60 = "_ubdkl";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK = "_sb";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_PLAY = "_sbp";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_30 = "_sbs";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_60 = "_sbl";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_SHORT_30 = "_sbks";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_SHORT_60 = "_sbkl";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_30 = "_sbds";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_60 = "_sbdl";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_30 = "_sbdks";
|
||||
|
||||
private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_60 = "_sbdkl";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK = "_ssb";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_PLAY = "_ssbp";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_30 = "_ssbs";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_60 = "_ssbl";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_SHORT_30 = "_ssbks";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_SHORT_60 = "_ssbkl";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_30 = "_ssbds";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_60 = "_ssbdl";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_30 = "_ssbdks";
|
||||
|
||||
private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_60 = "_ssbdkl";
|
||||
|
||||
private const string EARTH_RITE_VOICE_CHECK = "_ear";
|
||||
|
||||
private const string SUMMON_TOKEN_VOICE = "_11";
|
||||
|
||||
public const int CONVE_ID_INDEX = 2;
|
||||
|
||||
private VoiceAndWaitTime[] _parsedVoice;
|
||||
|
||||
@@ -100,58 +27,6 @@ public class VoiceDictionary
|
||||
|
||||
public List<int> AllyComvoList { get; private set; }
|
||||
|
||||
public bool HasFixedUseCost
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fixedUseCostVoice != null)
|
||||
{
|
||||
return _fixedUseCostVoice.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasUnionBurstVoice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_unionBurstVoice != null)
|
||||
{
|
||||
return _unionBurstVoice.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSkyboundArtVoice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_skyboundArtVoice != null)
|
||||
{
|
||||
return _skyboundArtVoice.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSuperSkyboundArtVoice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_superSkyboundArtVoice != null)
|
||||
{
|
||||
return _superSkyboundArtVoice.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasEarthRite => _earthRiteVoice != null;
|
||||
|
||||
public bool HasSummonTokenVoice => _summonTokenVoice != null;
|
||||
|
||||
public VoiceDictionary(string voice)
|
||||
{
|
||||
EnemyComvoList = new List<int>();
|
||||
@@ -303,15 +178,6 @@ public class VoiceDictionary
|
||||
return _allVoiceID;
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetNormalVoice()
|
||||
{
|
||||
if (_normalVoice == null)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
return _normalVoice;
|
||||
}
|
||||
|
||||
private bool IsNormalVoice(string voiceName)
|
||||
{
|
||||
if (!IsConvVoice(voiceName) && !IsFixedUseCostVoice(voiceName) && !IsUnionBurstVoice(voiceName) && !IsSkyboundArtVoice(voiceName) && !IsSuperSkyboundArtVoice(voiceName) && !IsEarthRiteVoice(voiceName))
|
||||
@@ -321,38 +187,6 @@ public class VoiceDictionary
|
||||
return false;
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetAllyConvVoice(int cardId)
|
||||
{
|
||||
string cardIDStr = cardId.ToString();
|
||||
int i = 0;
|
||||
while (i < AllyComvoList.Count)
|
||||
{
|
||||
if (IsConvMatch(AllyComvoList[i].ToString(), cardIDStr))
|
||||
{
|
||||
return _parsedVoice.FirstOrDefault((VoiceAndWaitTime c) => c.Voice.Contains(AllyComvoList[i].ToString()) && c.Voice.Contains("_8_"));
|
||||
}
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetEnemyConvVoice(int cardId)
|
||||
{
|
||||
string cardIDStr = cardId.ToString();
|
||||
int i = 0;
|
||||
while (i < EnemyComvoList.Count)
|
||||
{
|
||||
if (IsConvMatch(EnemyComvoList[i].ToString(), cardIDStr))
|
||||
{
|
||||
return _parsedVoice.FirstOrDefault((VoiceAndWaitTime c) => c.Voice.Contains(EnemyComvoList[i].ToString()) && c.Voice.Contains("_7_"));
|
||||
}
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
|
||||
private bool IsConvVoice(string voiceName)
|
||||
{
|
||||
if (voiceName.Contains("_4_"))
|
||||
@@ -373,160 +207,11 @@ public class VoiceDictionary
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsConvMatch(string voiceName, string cardIDStr)
|
||||
{
|
||||
return voiceName.Contains(cardIDStr);
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetEnhanceVoice(int index)
|
||||
{
|
||||
if (_fixedUseCostVoice.Count <= 0)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
return _fixedUseCostVoice[index];
|
||||
}
|
||||
|
||||
private bool IsFixedUseCostVoice(string voiceName)
|
||||
{
|
||||
return voiceName.Contains("_enh");
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetUnionBurstVoice(int skillVoiceIndex)
|
||||
{
|
||||
int count = _unionBurstVoice.Count;
|
||||
if (count <= 0)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return _unionBurstVoice[0];
|
||||
}
|
||||
if (skillVoiceIndex == 9)
|
||||
{
|
||||
foreach (VoiceAndWaitTime item in _unionBurstVoice)
|
||||
{
|
||||
if (item.Voice.Contains("_ubp"))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
string text = "";
|
||||
text = skillVoiceIndex switch
|
||||
{
|
||||
1 => "_ubs",
|
||||
3 => "_ubl",
|
||||
2 => "_ubks",
|
||||
4 => "_ubkl",
|
||||
5 => "_ubds",
|
||||
7 => "_ubdl",
|
||||
6 => "_ubdks",
|
||||
8 => "_ubdkl",
|
||||
_ => "_ubs",
|
||||
};
|
||||
foreach (VoiceAndWaitTime item2 in _unionBurstVoice)
|
||||
{
|
||||
if (item2.Voice.Contains(text))
|
||||
{
|
||||
return new VoiceAndWaitTime(item2.Voice.Replace(text, "_ub"), item2.WaitTime);
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetSkyboundArtVoice(int skillVoiceIndex)
|
||||
{
|
||||
int count = _skyboundArtVoice.Count;
|
||||
if (count <= 0)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return _skyboundArtVoice[0];
|
||||
}
|
||||
if (skillVoiceIndex == 19)
|
||||
{
|
||||
foreach (VoiceAndWaitTime item in _skyboundArtVoice)
|
||||
{
|
||||
if (item.Voice.Contains("_sbp"))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
string text = "";
|
||||
text = skillVoiceIndex switch
|
||||
{
|
||||
11 => "_sbs",
|
||||
13 => "_sbl",
|
||||
12 => "_sbks",
|
||||
14 => "_sbkl",
|
||||
15 => "_sbds",
|
||||
17 => "_sbdl",
|
||||
16 => "_sbdks",
|
||||
18 => "_sbdkl",
|
||||
_ => "_sbs",
|
||||
};
|
||||
foreach (VoiceAndWaitTime item2 in _skyboundArtVoice)
|
||||
{
|
||||
if (item2.Voice.Contains(text))
|
||||
{
|
||||
return new VoiceAndWaitTime(item2.Voice.Replace(text, "_sb"), item2.WaitTime);
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetSuperSkyboundArtVoice(int skillVoiceIndex)
|
||||
{
|
||||
int count = _superSkyboundArtVoice.Count;
|
||||
if (count <= 0)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
if (count == 1)
|
||||
{
|
||||
return _superSkyboundArtVoice[0];
|
||||
}
|
||||
if (skillVoiceIndex == 29)
|
||||
{
|
||||
foreach (VoiceAndWaitTime item in _superSkyboundArtVoice)
|
||||
{
|
||||
if (item.Voice.Contains("_ssbp"))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
string text = "";
|
||||
text = skillVoiceIndex switch
|
||||
{
|
||||
21 => "_ssbs",
|
||||
23 => "_ssbl",
|
||||
22 => "_ssbks",
|
||||
24 => "_ssbkl",
|
||||
25 => "_ssbds",
|
||||
27 => "_ssbdl",
|
||||
26 => "_ssbdks",
|
||||
28 => "_ssbdkl",
|
||||
_ => "_ssbs",
|
||||
};
|
||||
foreach (VoiceAndWaitTime item2 in _superSkyboundArtVoice)
|
||||
{
|
||||
if (item2.Voice.Contains(text))
|
||||
{
|
||||
return new VoiceAndWaitTime(item2.Voice.Replace(text, "_ssb"), item2.WaitTime);
|
||||
}
|
||||
}
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
|
||||
private bool IsUnionBurstVoice(string voiceName)
|
||||
{
|
||||
return voiceName.Contains("_ub");
|
||||
@@ -542,29 +227,11 @@ public class VoiceDictionary
|
||||
return voiceName.Contains("_ssb");
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetEarthRiteVoice()
|
||||
{
|
||||
if (_earthRiteVoice == null)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
return _earthRiteVoice;
|
||||
}
|
||||
|
||||
private bool IsEarthRiteVoice(string voiceName)
|
||||
{
|
||||
return voiceName.Contains("_ear");
|
||||
}
|
||||
|
||||
public VoiceAndWaitTime GetSummonTokenVoice()
|
||||
{
|
||||
if (_summonTokenVoice == null)
|
||||
{
|
||||
return VoiceAndWaitTime._nullVoice;
|
||||
}
|
||||
return _summonTokenVoice;
|
||||
}
|
||||
|
||||
private bool IsSummonTokenVoice(string voiceName)
|
||||
{
|
||||
return voiceName.EndsWith("_11");
|
||||
|
||||
Reference in New Issue
Block a user