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:
@@ -11,9 +11,7 @@ public class Skill_powerup : SkillBase
|
||||
Null,
|
||||
Add,
|
||||
Multiply,
|
||||
AddMaxLife,
|
||||
Copy
|
||||
}
|
||||
AddMaxLife }
|
||||
|
||||
public class PowerUpModifierContainer
|
||||
{
|
||||
@@ -34,10 +32,6 @@ public class Skill_powerup : SkillBase
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly string[] BehaviorOptionType = new string[1] { SkillFilterCreator.ContentKeyword.copy.ToStringCustom() };
|
||||
|
||||
public static readonly string[] TargetOptionType = new string[1] { SkillFilterCreator.ContentKeyword.last_target.ToStringCustom() };
|
||||
|
||||
protected readonly List<PowerUpModifierContainer> _targetList = new List<PowerUpModifierContainer>();
|
||||
|
||||
protected int _addOffense = -1;
|
||||
@@ -160,9 +154,9 @@ public class Skill_powerup : SkillBase
|
||||
}
|
||||
}
|
||||
CallPowerUpEvent(list3);
|
||||
if (IsBattleLog && !GameMgr.GetIns().IsAdminWatch && !base.SkillPrm.ownerCard.IsPlayer && OnWhenDraw != 0)
|
||||
if (IsBattleLog && !SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.GameMgr.IsAdminWatch && !base.SkillPrm.ownerCard.IsPlayer && OnWhenDraw != 0)
|
||||
{
|
||||
BattleLogManager.GetInstance().AddLogSkillBuffAddClass(new List<BattleCardBase> { BattleManagerBase.GetIns().BattleEnemy.Class }, this);
|
||||
BattleLogManager.GetInstance().AddLogSkillBuffAddClass(new List<BattleCardBase> { SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.BattleEnemy.Class }, this);
|
||||
}
|
||||
IncrementGameBuffCount(inplayTargetCards);
|
||||
RegisterOtherSkillInfo(parameter, inplayTargetCards);
|
||||
@@ -319,85 +313,6 @@ public class Skill_powerup : SkillBase
|
||||
return new LifeAddModifier(0);
|
||||
}
|
||||
|
||||
private List<ICardOffenseModifier> CreateBehaviorOffenceModifierList(string behaviorOption, string targetOption, CallParameter parameter)
|
||||
{
|
||||
List<ICardOffenseModifier> list = new List<ICardOffenseModifier>();
|
||||
string[] array = targetOption.Split('.');
|
||||
if (SkillFilterCreator.Str2ContentKeyword(behaviorOption) == SkillFilterCreator.ContentKeyword.copy)
|
||||
{
|
||||
string text = array[1];
|
||||
if (text.Contains(SkillFilterCreator.ContentKeyword.last_target.ToStringCustom()))
|
||||
{
|
||||
List<List<BattleCardBase>> list2 = ((array[0] == SkillFilterCreator.ContentKeyword.me.ToString()) ? parameter.calledSkillResultInfo.SelfLastTargetCards : parameter.calledSkillResultInfo.OpponentLastTargetCards);
|
||||
int result = 0;
|
||||
if (text.Count() > SkillFilterCreator.ContentKeyword.last_target.ToStringCustom().Count())
|
||||
{
|
||||
int.TryParse(text.Substring(SkillFilterCreator.ContentKeyword.last_target.ToStringCustom().Count() + 1), out result);
|
||||
}
|
||||
for (int i = 0; i < list2[result].Count; i++)
|
||||
{
|
||||
list.AddRange(list2[result][i].SkillApplyInformation.OffenseModifierList);
|
||||
}
|
||||
}
|
||||
else if (text.Contains(SkillFilterCreator.ContentKeyword.load_target.ToStringCustom()))
|
||||
{
|
||||
List<BattleCardBase> list3 = base.SkillPrm.ownerCard.SkillApplyInformation.LoadTargetList();
|
||||
for (int j = 0; j < list3.Count; j++)
|
||||
{
|
||||
list.AddRange(list3[j].SkillApplyInformation.OffenseModifierList);
|
||||
}
|
||||
}
|
||||
else if (text.Contains(SkillFilterCreator.ContentKeyword.load_burial_rite_target.ToStringCustom()))
|
||||
{
|
||||
List<BattleCardBase> list4 = base.SkillPrm.ownerCard.SkillApplyInformation.LoadBurialRiteTargetList();
|
||||
for (int k = 0; k < list4.Count; k++)
|
||||
{
|
||||
list.AddRange(list4[k].SkillApplyInformation.OffenseModifierList);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<ICardLifeModifier> CreateBehaviorLifeModifierList(string behaviorOption, string targetOption, CallParameter parameter)
|
||||
{
|
||||
List<ICardLifeModifier> list = new List<ICardLifeModifier>();
|
||||
string[] array = targetOption.Split('.');
|
||||
if (SkillFilterCreator.Str2ContentKeyword(behaviorOption) == SkillFilterCreator.ContentKeyword.copy)
|
||||
{
|
||||
string text = array[1];
|
||||
if (text.Contains(SkillFilterCreator.ContentKeyword.last_target.ToStringCustom()))
|
||||
{
|
||||
List<List<BattleCardBase>> list2 = ((array[0] == SkillFilterCreator.ContentKeyword.me.ToString()) ? parameter.calledSkillResultInfo.SelfLastTargetCards : parameter.calledSkillResultInfo.OpponentLastTargetCards);
|
||||
int customValue = 0;
|
||||
SkillFilterCreator.ParseSuffixX(text, out customValue);
|
||||
for (int i = 0; i < list2[customValue].Count; i++)
|
||||
{
|
||||
list.AddRange(list2[customValue][i].SkillApplyInformation.LifeChangeList);
|
||||
}
|
||||
}
|
||||
else if (text.Contains(SkillFilterCreator.ContentKeyword.load_target.ToStringCustom()))
|
||||
{
|
||||
List<BattleCardBase> list3 = base.SkillPrm.ownerCard.SkillApplyInformation.LoadTargetList();
|
||||
for (int j = 0; j < list3.Count; j++)
|
||||
{
|
||||
list.AddRange(list3[j].SkillApplyInformation.LifeChangeList);
|
||||
}
|
||||
}
|
||||
else if (text.Contains(SkillFilterCreator.ContentKeyword.load_burial_rite_target.ToStringCustom()))
|
||||
{
|
||||
List<BattleCardBase> list4 = base.SkillPrm.ownerCard.SkillApplyInformation.LoadBurialRiteTargetList();
|
||||
for (int k = 0; k < list4.Count; k++)
|
||||
{
|
||||
list.AddRange(list4[k].SkillApplyInformation.LifeChangeList);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void SettingPowerUpData(int offense, int life)
|
||||
{
|
||||
_addOffense = offense;
|
||||
@@ -425,7 +340,7 @@ public class Skill_powerup : SkillBase
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isAdminWatch = GameMgr.GetIns().IsAdminWatch;
|
||||
bool isAdminWatch = SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.GameMgr.IsAdminWatch;
|
||||
bool isTargetSelfOpenCardSkill = base.IsContainSelfFilter && (base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessOpenCard) || (isAdminWatch && OnWhenDraw != 0));
|
||||
list = targetCards.Where((BattleCardBase c) => c.IsInHand && (c.IsPlayer == base.SkillPrm.selfBattlePlayer.IsPlayer || isAdminWatch || isTargetSelfOpenCardSkill)).ToList();
|
||||
if ((IsTargetInHand() || isTargetSelfOpenCardSkill || ((base.SkillPrm.selfBattlePlayer.IsPlayer || base.ApplyingTargetFilter is SkillTargetReturnCardFilter) && list.Count > 0)) && (!(base.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter) || list.Count != 0))
|
||||
|
||||
Reference in New Issue
Block a user