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,11 +11,6 @@ using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class UnitBattleCard : BattleCardBase
|
||||
{
|
||||
public const string DRAIN_EFFECT = "btl_magic_cure_1";
|
||||
|
||||
public const string DRAIN_SE = "se_btl_magic_cure_1";
|
||||
|
||||
public const float DRAIN_WAIT_TIME = 0.3f;
|
||||
|
||||
private bool _isEvolution;
|
||||
|
||||
@@ -33,11 +28,6 @@ public class UnitBattleCard : BattleCardBase
|
||||
|
||||
public event Func<VfxBase> OnAfterAttack;
|
||||
|
||||
public void Evolution(bool isEvolution = true)
|
||||
{
|
||||
_isEvolution = isEvolution;
|
||||
}
|
||||
|
||||
public override bool Movable(bool isCheckOnDraw = true, bool isSkipSelecting = false, CHECK_CONDITION_MUTATIONSKILL_TYPE type = CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE, bool isRecording = false)
|
||||
{
|
||||
type = IsCheckActiveMutationSkill;
|
||||
@@ -80,7 +70,7 @@ public class UnitBattleCard : BattleCardBase
|
||||
{
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(base.BattleCardView._inPlayFrameEffect.HideFrameEffect));
|
||||
}
|
||||
if (GameMgr.GetIns().IsWatchBattle || GameMgr.GetIns().IsReplayBattle)
|
||||
if (_buildInfo.BattleMgr.GameMgr.IsWatchBattle || _buildInfo.BattleMgr.GameMgr.IsReplayBattle)
|
||||
{
|
||||
parallelVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
@@ -126,23 +116,23 @@ public class UnitBattleCard : BattleCardBase
|
||||
}
|
||||
_isEvolution = true;
|
||||
base.AttackableCount = attackableCount;
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
if (_buildInfo.BattleMgr.IsRecovery)
|
||||
{
|
||||
sequentialVfxPlayer.Register(new RecoveryEvolveVfx(this, _buildInfo.ResourceMgr));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
else if (getEvolveVfxFunc == null)
|
||||
{
|
||||
if (base.IsPlayer && GameMgr.GetIns().GetDataMgr().Is3DSkin(isPlayer: true))
|
||||
if (base.IsPlayer && _buildInfo.BattleMgr.GameMgr.GetDataMgr().Is3DSkin(isPlayer: true))
|
||||
{
|
||||
sequentialVfxPlayer.Register(new Class3dEvolveVfx(this, _buildInfo.ResourceMgr));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
else if (base.IsPlayer && GameMgr.GetIns().GetDataMgr().IsHighRankSkinPlayer())
|
||||
else if (base.IsPlayer && _buildInfo.BattleMgr.GameMgr.GetDataMgr().IsHighRankSkinPlayer())
|
||||
{
|
||||
sequentialVfxPlayer.Register(new HighRankEvolveVfx(this, _buildInfo.ResourceMgr));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
else
|
||||
{
|
||||
sequentialVfxPlayer.Register(new EvolveVfx(this, _buildInfo.ResourceMgr));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -274,7 +264,7 @@ public class UnitBattleCard : BattleCardBase
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
base.SelfBattlePlayer.HandCardToField(this);
|
||||
base.BattleCardView.ResetTemplate();
|
||||
sequentialVfxPlayer.Register(base.VfxCreator.CreatePick());
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
@@ -348,10 +338,10 @@ public class UnitBattleCard : BattleCardBase
|
||||
|
||||
public override AttackOpponentResult AttackOpponent(BattleCardBase target, DamageParam damageParam, SkillProcessor skillProcessor, bool IsChallenge)
|
||||
{
|
||||
VfxBase vfx = base.VfxCreator.CreateAttack(base.BattleCardView, target.BattleCardView);
|
||||
VfxBase vfx = NullVfx.GetInstance();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
DamageResult damageResult = target.ApplyDamage(null, damageParam, base.SkillApplyInformation.IsKiller, isReflectedDamage: false, skillProcessor, null);
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
BattleManagerBase ins = _buildInfo.BattleMgr;
|
||||
base.SelfBattlePlayer.Class.SkillApplyInformation.CausedDamageLife(damageResult.DamageApplied, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn);
|
||||
sequentialVfxPlayer.Register(damageResult.Vfx);
|
||||
SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create();
|
||||
@@ -381,11 +371,11 @@ public class UnitBattleCard : BattleCardBase
|
||||
{
|
||||
EffectBattle effectBattle = null;
|
||||
Vector3 effectPosition = base.SelfBattlePlayer.Class.BattleCardView.CardWrapObject.transform.position;
|
||||
sequentialVfxPlayer.Register(new SkillBase.WaitEffectLoadVfx("btl_magic_cure_1", EffectMgr.EngineType.SHURIKEN, "se_btl_magic_cure_1", BattleManagerBase.GetIns().BattleResourceMgr, delegate(EffectBattle eb)
|
||||
sequentialVfxPlayer.Register(new SkillBase.WaitEffectLoadVfx("btl_magic_cure_1", EffectMgr.EngineType.SHURIKEN, "se_btl_magic_cure_1", _buildInfo.BattleMgr.BattleResourceMgr, delegate(EffectBattle eb)
|
||||
{
|
||||
effectBattle = eb;
|
||||
}));
|
||||
DelaySetupVfx vfx = new DelaySetupVfx(() => new SkillEffectBattleVfx(effectBattle, base.SelfBattlePlayer.Class.BattleCardView, BattleManagerBase.GetIns().BattleResourceMgr, () => effectPosition, () => effectPosition, 0f, 0.2f, EffectMgr.MoveType.NONE, base.SelfBattlePlayer.Class.SelfBattlePlayer.IsPlayer, Color.clear));
|
||||
VfxBase vfx = NullVfx.GetInstance();
|
||||
sequentialVfxPlayer2.Register(vfx);
|
||||
}
|
||||
sequentialVfxPlayer.Register(sequentialVfxPlayer2);
|
||||
@@ -408,14 +398,14 @@ public class UnitBattleCard : BattleCardBase
|
||||
}
|
||||
damageParam.Damage = CalculateFinalDamageAmount(damageParam.Damage, isSkillDamage, isSpellDamage);
|
||||
new SkillConditionCheckerOption().DefaultDamage = new DamageInfo(skill, damage);
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
BattleManagerBase ins = _buildInfo.BattleMgr;
|
||||
base.SkillApplyInformation.DamageLife(damageParam.Damage, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn);
|
||||
if (doesAttackerPossessKiller && !base.SkillApplyInformation.IsIndependent && !base.SkillApplyInformation.IsIndestructible)
|
||||
{
|
||||
FlagCardAsDestroyedByKiller();
|
||||
}
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.VfxCreator.CreateDamage(damageParam.Damage, base.Life, base.MaxLife, BaseMaxLife, isReflectedDamage, isSkillDamage));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
skillProcessor.Register(base.Skills.CreateWhenDamageInfo(skill, skillProcessor, new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer), damage, damageParam.Damage));
|
||||
sequentialVfxPlayer.Register(base.ApplyDamage(skill, damageParam, doesAttackerPossessKiller, isReflectedDamage, skillProcessor, reflectCard).Vfx);
|
||||
return new DamageResult(sequentialVfxPlayer, damageParam.Damage, damageParam.Damage, null, null, isReflectedDamage);
|
||||
@@ -423,10 +413,10 @@ public class UnitBattleCard : BattleCardBase
|
||||
|
||||
public override HealResult ApplyHealing(HealParam healParam, SkillProcessor skillProcessor)
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
BattleManagerBase ins = _buildInfo.BattleMgr;
|
||||
int num = HealLife(healParam.HealAmount, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.VfxCreator.CreateHealing(num, base.Life, base.MaxLife, BaseMaxLife));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
new SkillConditionCheckerOption().HealingCardAndValue = new List<BattlePlayerBase.CardAndValue>
|
||||
{
|
||||
new BattlePlayerBase.CardAndValue(this, num)
|
||||
@@ -444,18 +434,10 @@ public class UnitBattleCard : BattleCardBase
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView)
|
||||
{
|
||||
if (isNullView)
|
||||
{
|
||||
return NullCardVfxCreator.GetInstance();
|
||||
}
|
||||
return new UnitCardVfxCreator(isPlayer, this, battleCardView, _buildInfo.ResourceMgr);
|
||||
}
|
||||
|
||||
protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator)
|
||||
protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card)
|
||||
{
|
||||
return new UnitSkillApplyInformation(card, vfxCreator);
|
||||
return new UnitSkillApplyInformation(card);
|
||||
}
|
||||
|
||||
protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView)
|
||||
@@ -487,15 +469,15 @@ public class UnitBattleCard : BattleCardBase
|
||||
sequentialVfxPlayer.Register(base.RecoveryInPlay(inPlayIndex, newReplayMoveTurn));
|
||||
if (IsEvolution)
|
||||
{
|
||||
sequentialVfxPlayer.Register(new EvolveImageChangeVfx(this, _buildInfo.ResourceMgr));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
if (base.IsChoiceEvolutionCard)
|
||||
{
|
||||
sequentialVfxPlayer.Register(new EvolveNameChangeVfx(this));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
sequentialVfxPlayer.Register(new EvolveUnitMaskCardInPlayVfx(base.BattleCardView));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
}
|
||||
sequentialVfxPlayer.Register(new RefreshAttackVfx(base.BattleCardView, base.Atk, base.BaseAtk, forceUpdate: true, newReplayMoveTurn));
|
||||
sequentialVfxPlayer.Register(new RefreshHealthVfx(base.BattleCardView, base.Life, base.MaxLife, BaseMaxLife, newReplayMoveTurn));
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
sequentialVfxPlayer.Register(NullVfx.GetInstance());
|
||||
if (Attackable && base.IsSelfTurn)
|
||||
{
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
|
||||
Reference in New Issue
Block a user