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:
gamer147
2026-07-03 19:18:54 -04:00
parent 5c1db83967
commit 2d9a6eea4b
2045 changed files with 11704 additions and 158495 deletions

View File

@@ -90,8 +90,6 @@ public class BattleManagerBase
private Dictionary<string, string> _originalTargetDictionary;
private const string MISSION_INFO_EQUAL = "mission_info=";
public MissionNecessaryInformation(Dictionary<string, string> targetDictionary)
{
_originalTargetDictionary = targetDictionary;
@@ -103,17 +101,6 @@ public class BattleManagerBase
}
}
public Dictionary<string, int> GetMissionNecessaryInfo(BattlePlayerPair pair, BattleCardBase selfClass)
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
foreach (KeyValuePair<string, SkillOptionValue> item in NecessaryTargetDictionary)
{
SkillCollectionBase.SetupOptionValue(item.Value, pair, selfClass, null);
dictionary.Add(item.Key, item.Value.GetInt(SkillFilterCreator.ContentKeyword.mission_info, 0));
}
return dictionary;
}
public Dictionary<string, string> GetOriginalTargetDictionary()
{
return _originalTargetDictionary;
@@ -150,9 +137,13 @@ public class BattleManagerBase
return false;
}
public bool IsOwnerCardDead()
// Fusion-list parameter: headless has no fusion animation, so the outer mgr's list is
// always empty and Contains(...) always returns false — the block below always runs.
// Passed as a parameter (not read via BattleLogManager.GetInstance()) so concurrent
// battles resolve against their own instance's list rather than a process singleton.
public bool IsOwnerCardDead(List<BattleCardBase> enemyFusionCard)
{
if (!BattleLogManager.GetInstance().EnemyFusionCard.Contains(_ownerCard))
if (!enemyFusionCard.Contains(_ownerCard))
{
if (!_ownerCard.IsDead)
{
@@ -272,18 +263,12 @@ public class BattleManagerBase
private Dictionary<CalledCreateFilterPair, SkillOrFilter> _calledCreateOrFilterDictionary = new Dictionary<CalledCreateFilterPair, SkillOrFilter>();
public const int SIMPLE_STAGE_ID = 9;
public const int NEW_INDEX = -1;
public List<BattleCardBase> EnemyFusionCard = new List<BattleCardBase>();
public static readonly int FIRST_PLAYER_EP_NUM = 2;
public static readonly int SECOND_PLAYER_EP_NUM = 3;
protected const int FIRST_PLAYER_EVOLVE_WAIT_TURN = 5;
protected const int SECOND_PLAYER_EVOLVE_WAIT_TURN = 4;
public SBattleLoad SBattleLoad;
protected IBattleMgrContentsCreator _contentsCreator;
@@ -352,8 +337,6 @@ public class BattleManagerBase
public SideLogControl ESelectSkillSideLogControl;
private const string UnityEventAgentStr = "Prefab/Game/UnityEventAgent";
public ITurnPanelControl TurnPanelControl;
public GameObject BattleResult;
@@ -384,8 +367,6 @@ public class BattleManagerBase
protected int _temporaryPublishedAddCount;
public const int NOT_LETHAL_PUBLISHED_COUNT = -1;
protected int _lethalPublishedActiveSkillCount = -1;
protected int _lethalMovementCount;
@@ -398,28 +379,50 @@ public class BattleManagerBase
public int SecondTurn;
public int GroundID;
public int DamageCount;
private GameObject _unityEventAgentObject;
private UnityEventAgent _unityEventAgent;
protected IPhase _phase;
private NetworkTouchControl _networkTouchControl;
// Instance-backed IsRandomDraw / IsForecast / RecoveryInfo (Phase 5a, 2026-07-02).
// Static accessors (this.InstanceIsForecast, Wizard.Data.BattleRecoveryInfo, etc.)
// route through the ambient's current Mgr — same lookup shape as GetIns() — but the
// authoritative state lives on the mgr instance itself, not in separate ambient slots.
// Defaults mirror the ambient's historical defaults.
public bool InstanceIsRandomDraw { get; set; } = true;
public bool InstanceIsForecast { get; set; } = true;
public Wizard.BattleRecoveryInfo InstanceRecoveryInfo { get; set; }
// Instance-backed ViewerId. Default 1001 matches EngineGlobalInit.ThisViewerId (the historical
// PlayerStaticData / Certification default when neither has been assigned by a session).
public int InstanceViewerId { get; set; } = 1001;
// Instance-backed RealTimeNetworkAgent. Owner: mgr; nullable — headless mostly runs without an
// agent, and existing readers guard with `?.`.
public RealTimeNetworkAgent InstanceNetworkAgent { get; set; }
// Phase-5 chunk 42 (2026-07-03): ambient bridge dropped. All engine per-mgr readers and writers
// now use `mgr.InstanceIsRandomDraw` / `mgr.InstanceIsForecast` directly. The residual static
// setter/getter keeps the shape only for pre-mgr fixture/node writes — no ambient-slot fallback.
// If GetIns() is null (no scope), the setter silently no-ops and the getter returns the default.
public static bool IsRandomDraw {
get => SVSim.BattleEngine.Ambient.BattleAmbient.Require().IsRandomDraw;
set => SVSim.BattleEngine.Ambient.BattleAmbient.Require().IsRandomDraw = value;
get => GetIns()?.InstanceIsRandomDraw ?? true;
set { if (GetIns() is { } m) m.InstanceIsRandomDraw = value; }
}
public static bool IsForecast {
get => SVSim.BattleEngine.Ambient.BattleAmbient.Require().IsForecast;
set => SVSim.BattleEngine.Ambient.BattleAmbient.Require().IsForecast = value;
get => GetIns()?.InstanceIsForecast ?? true;
set { if (GetIns() is { } m) m.InstanceIsForecast = value; }
}
// Phase-5 chunk 45 (2026-07-03): pure per-instance GameMgr assigned in ctor. The property has
// no field initializer so the ctor can set it before the base-ctor chain reads it. Subclasses
// that need a pre-seeded GameMgr (test fixtures with chara-id / net-user data) call the
// (contentsCreator, gameMgr) overload; the parameterless overload keeps the historical ambient
// bridge so pre-existing TestBattleScope seeders still work while the fixture rewrite lands.
public GameMgr GameMgr { get; }
public BattleLifeTimeSharedObject BattleLifeTimeSharedObject;
private BattleUIContainer _battleUIContainer;
@@ -434,8 +437,6 @@ public class BattleManagerBase
protected XorShift _oppXorShiftRandom;
public bool IsKeyboardEnable = true;
public static bool IsTutorial
{
get
@@ -448,8 +449,6 @@ public class BattleManagerBase
}
}
protected virtual bool IsStoryTutorial => false;
protected virtual bool DisableCustomMouse => false;
public static bool UseCustomMouse
@@ -465,46 +464,14 @@ public class BattleManagerBase
}
}
public static bool UseKeyboard
{
get
{
bool flag = GetIns()?.IsStoryTutorial ?? false;
GameMgr ins = GameMgr.GetIns();
bool isWatchBattle = ins.IsWatchBattle;
bool isReplayBattle = ins.IsReplayBattle;
if (InputMgr.KeyboardControl && !flag && !isWatchBattle)
{
return !isReplayBattle;
}
return false;
}
}
public static bool UseKeyboardTurnEndSpaceShortcut
{
get
{
if (UseKeyboard)
{
return InputMgr.KeyboardControlSpace;
}
return false;
}
}
public int BackgroundId { get; private set; }
public string BgmId { get; private set; }
public bool IsBackGroundLoad => _backGround.IsLoadDone;
public BattleCamera Camera => _battleCamera;
public BackGroundBase BackGround => _backGround;
public Camera SubParticleCamera => _subParticleCamera;
public int AllPublishedActiveSkillCount
{
get
@@ -599,8 +566,6 @@ public class BattleManagerBase
public IPhaseCreator PhaseCreator { get; private set; }
public bool IsPreRecovery { get; set; }
public bool IsRecovery { get; set; }
public bool IsPuzzleMgr => this is PuzzleBattleManager;
@@ -658,7 +623,7 @@ public class BattleManagerBase
public bool IsTurnEnd { get; protected set; }
public virtual bool IsVirtualBattle => IsForecast;
public virtual bool IsVirtualBattle => this.InstanceIsForecast;
public virtual bool IsVirtualBattleEnemyTurn
{
@@ -712,15 +677,23 @@ public class BattleManagerBase
public static BattleManagerBase GetIns()
{
// Soft read: returns null when no scope is active, preserving engine call sites that pattern
// `GetIns()?.Foo ?? default` (or null-tolerant successors). Inside a scope, returns the
// scope's Mgr (which may itself be null mid-Setup — see SessionBattleEngine.SetupInternal,
// which publishes Mgr before WireMulliganPhase).
return SVSim.BattleEngine.Ambient.BattleAmbient.Current?.Mgr;
// Phase-5 chunk 46: pure per-instance world. GetIns() no longer routes through the ambient
// (which is being deleted). All direct engine callers were converted to per-mgr reads in
// chunks 38-42; residual callers are the 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo,
// ToolboxGame.RealTimeNetworkAgent) and the two static flags (IsForecast, IsRandomDraw),
// each of which returns a null-tolerant default when GetIns() is null — matching the "no scope"
// semantics the ambient used to provide.
return null;
}
protected BattleManagerBase(IBattleMgrContentsCreator contentsCreator)
: this(contentsCreator, new GameMgr())
{
}
protected BattleManagerBase(IBattleMgrContentsCreator contentsCreator, GameMgr gameMgr)
{
GameMgr = gameMgr;
BattleLifeTimeSharedObject = new BattleLifeTimeSharedObject();
PublishedSkillList = new List<SkillBase>();
_contentsCreator = contentsCreator;
@@ -765,8 +738,8 @@ public class BattleManagerBase
SubUI = null;
SubUIOverLayBG = null;
MenuButtonObject = null;
GameMgr.GetIns().GetPrefabMgr().Load("Prefab/Game/UnityEventAgent");
_unityEventAgentObject = UnityEngine.Object.Instantiate(GameMgr.GetIns().GetPrefabMgr().Get("Prefab/Game/UnityEventAgent"));
this.GameMgr.GetPrefabMgr().Load("Prefab/Game/UnityEventAgent");
_unityEventAgentObject = UnityEngine.Object.Instantiate(this.GameMgr.GetPrefabMgr().Get("Prefab/Game/UnityEventAgent"));
_unityEventAgent = _unityEventAgentObject.GetComponent<UnityEventAgent>();
_unityEventAgent.SetBattleMgr(this);
Prediction = new Prediction(BattleResourceMgr, GetBattlePlayerPair(isPlayer: true));
@@ -780,7 +753,7 @@ public class BattleManagerBase
FirstReplaySetting();
OnBattleSettingInfoClear += delegate
{
GameMgr.GetIns().GetDataMgr().SetStoryBgmID("NONE");
this.GameMgr.GetDataMgr().SetStoryBgmID("NONE");
};
LocalLog.AccumulateSettingLog();
}
@@ -792,7 +765,7 @@ public class BattleManagerBase
public void StartRecoveryRecording()
{
_contentsCreator.RecoveryRecordManager.SetupRecording(this, GameMgr.GetIns().GetDataMgr().m_BattleType, _contentsCreator.RandomSeed, BackgroundId, BgmId);
_contentsCreator.RecoveryRecordManager.SetupRecording(this, this.GameMgr.GetDataMgr().m_BattleType, _contentsCreator.RandomSeed, BackgroundId, BgmId);
}
protected virtual void FirstReplaySetting()
@@ -805,11 +778,6 @@ public class BattleManagerBase
_contentsCreator.ReplayRecordManager.SetupRecording(this);
}
public void SetupReplayBattleInfoFilter()
{
_contentsCreator.ReplayRecordManager.SetupBattleInfoFilter();
}
public void CreateXorShift(int selfIdxSeed, int oppIdxSeed = -1)
{
if (selfIdxSeed != -1)
@@ -841,12 +809,12 @@ public class BattleManagerBase
return backGroundId;
}
int result = 1;
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
DataMgr dataMgr = this.GameMgr.GetDataMgr();
if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SIMPLE_STAGE))
{
result = 9;
}
else if (dataMgr.m_BattleType == DataMgr.BattleType.Story || dataMgr.IsQuestBattleType() || GameMgr.GetIns().IsPuzzleQuest)
else if (dataMgr.m_BattleType == DataMgr.BattleType.Story || dataMgr.IsQuestBattleType() || this.GameMgr.IsPuzzleQuest)
{
result = dataMgr.GetSoroPlay3DFieldID();
}
@@ -900,7 +868,7 @@ public class BattleManagerBase
return bgmId;
}
string result = "NONE";
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
DataMgr dataMgr = this.GameMgr.GetDataMgr();
if (dataMgr.m_BattleType == DataMgr.BattleType.Story || dataMgr.IsQuestBattleType())
{
result = dataMgr.GetStoryBgmID();
@@ -908,17 +876,10 @@ public class BattleManagerBase
return result;
}
public BackGroundBase CreateBattleField()
{
_backGround.CreateField(_battleCamera, Battle3DContainer, CutInContainer);
GameMgr.GetIns().GetInputMgr().SetBackGround(_backGround);
return _backGround;
}
protected void CreateManager()
{
_battleCamera = new BattleCamera();
GameMgr.GetIns().GetInputMgr().SetBattleCamera(_battleCamera);
this.GameMgr.GetInputMgr().SetBattleCamera(_battleCamera);
DetailMgr = new DetailMgr();
switch (BackgroundId)
{
@@ -1122,20 +1083,6 @@ public class BattleManagerBase
SetupEvolCount(doesPlayerGoFirst);
}
protected virtual void SetupInitialGameState(bool doesPlayerGoFirst, bool areCardsRandomlyDrawn, int playerCurrentLife, int enemyCurrentLife, int playerMaxLife, int enemyMaxLife, int playerEvolCount, int enemyEvolCount, int playerEvolWaitTurnCount, int enemyEvolWaitTurnCount, int playerInitialPp, int enemyInitialPp, int playerInitialCemeteryAmount, int enemyInitialCemeteryAmount, int currentTurnNumber, bool showTurnsLeftUntilEvolve)
{
IsFirst = doesPlayerGoFirst;
IsRandomDraw = areCardsRandomlyDrawn;
InitializeClassLife(playerMaxLife, enemyMaxLife);
TurnPanelControl.Initialize(showTurnsLeftUntilEvolve, showTurnsLeftUntilEvolve);
int maxEvolCount = (doesPlayerGoFirst ? FIRST_PLAYER_EP_NUM : SECOND_PLAYER_EP_NUM);
int maxEvolCount2 = ((!doesPlayerGoFirst) ? FIRST_PLAYER_EP_NUM : SECOND_PLAYER_EP_NUM);
InitializePlayer(BattlePlayer, playerEvolCount, maxEvolCount, playerEvolWaitTurnCount, playerInitialPp, playerInitialCemeteryAmount, playerCurrentLife, playerMaxLife);
InitializePlayer(BattleEnemy, enemyEvolCount, maxEvolCount2, enemyEvolWaitTurnCount, enemyInitialPp, enemyInitialCemeteryAmount, enemyCurrentLife, enemyMaxLife);
FirstTurn = currentTurnNumber;
SecondTurn = currentTurnNumber;
}
public void SetupEvolCount(bool doesPlayerGoFirst)
{
BattlePlayerBase battlePlayerBase;
@@ -1167,21 +1114,6 @@ public class BattleManagerBase
((ClassBattleCardBase)BattleEnemy.Class).InitBaseMaxLife(enemyMaxLife);
}
private void InitializePlayer(BattlePlayerBase battlePlayerBase, int evolCount, int maxEvolCount, int evolWaitTurnCount, int initialPp, int initialCemeteryAmount, int currentLife, int maxLife)
{
SetPlayerInitialEp(battlePlayerBase, evolCount, maxEvolCount, evolWaitTurnCount);
battlePlayerBase.SetPpTotal(initialPp, isUpdatePp: true, null);
for (int i = 0; i < initialCemeteryAmount; i++)
{
BattleCardBase item = CardCreatorBase.CreateDummyInstance();
battlePlayerBase.CemeteryList.Add(item);
}
if (currentLife < maxLife)
{
battlePlayerBase.Class.SkillApplyInformation.DamageLife(maxLife - currentLife, -1, isSelfTurn: false);
}
}
protected virtual void SetupEvent()
{
BattlePlayer.OnTurnEndFinish += delegate
@@ -1254,16 +1186,6 @@ public class BattleManagerBase
};
}
public VfxBase LoadOpponentObjects()
{
VfxBase vfxBase = GetIns().SBattleLoad.NetworkBattleStartToLoadOpponentObjects(delegate
{
DelayLoadCompleteOpponentResources();
});
VfxMgr.RegisterSequentialVfx(vfxBase);
return vfxBase;
}
protected virtual void DelayLoadCompleteOpponentResources()
{
SetupBattlePlayersEvent();
@@ -1353,11 +1275,6 @@ public class BattleManagerBase
return TurnPanelControl.LoadResource();
}
public void ReinitializeTurnPanelControl()
{
TurnPanelControl.Initialize(BattlePlayer.EvolveWaitTurnCount > 0, BattleEnemy.EvolveWaitTurnCount > 0);
}
public virtual void Update(float dt)
{
VfxWith<IPhase> vfxWith = _phase.Update(dt);
@@ -1378,50 +1295,35 @@ public class BattleManagerBase
LocalLog.SubmitAccumulateLastTraceLog();
}
public virtual void Pause()
{
_phase.Pause();
Prediction.Clear();
}
public IPhase GetCurrentPhase()
{
return _phase;
}
public virtual void Resume()
{
}
public virtual void FinishBattle()
{
}
public void OnBattleSettingInfoClearIsNullClear()
{
this.OnBattleSettingInfoClear = null;
}
public virtual void DisposeBattleGameObj()
{
BattleResourceMgr.Dispose();
VfxMgr.Dispose();
DetailMgr.Dispose();
Data.BattleRecoveryInfo = null;
this.InstanceRecoveryInfo = null;
BattleLifeTimeSharedObject = null;
this.OnBattleSettingInfoClear.Call();
BattleLogItem.ClearHeaderTextureCache();
CardVoiceInfoCache.ClearCardVoiceInfo();
NullBattleCardView.ReleaseSharedDummy();
NullBattleCard.ReleaseSharedDummy();
GameMgr.GetIns().GetEffectMgr().ClearBattleFeildEffect();
GameMgr.GetIns().GetEffectMgr().RestUnneededEffect();
this.GameMgr.GetEffectMgr().ClearBattleFeildEffect();
this.GameMgr.GetEffectMgr().RestUnneededEffect();
_backGround.Dispose();
_battleCamera.Dispose();
Toolbox.ResourcesManager.RemoveAssetGroup(Toolbox.ResourcesManager.BattleListAssetPathList);
Toolbox.ResourcesManager.BattleListAssetPathList.Clear();
RenderSettings.fog = false;
GameMgr.GetIns().GetEffectMgr().ImmediateDestroyBattleEffectContainer();
this.GameMgr.GetEffectMgr().ImmediateDestroyBattleEffectContainer();
if (PanelMgr != null)
{
DisposeBattleGameObj_DestroyImmediate(PanelMgr.gameObject);
@@ -1476,9 +1378,9 @@ public class BattleManagerBase
SubUI = null;
SubParticleContainer = null;
UIManager.GetInstance().DestroyView(UIManager.ViewScene.Battle);
GameMgr.GetIns().GetPrefabMgr().DisposeAllClonedObject();
GameMgr.GetIns().GetGameObjMgr().DisposeUIGameObj();
GameMgr.GetIns().GetPrefabMgr().AllUnLoad();
this.GameMgr.GetPrefabMgr().DisposeAllClonedObject();
this.GameMgr.GetGameObjMgr().DisposeUIGameObj();
this.GameMgr.GetPrefabMgr().AllUnLoad();
}
private void DisposeBattleGameObj_DestroyImmediate(GameObject obj)
@@ -1538,16 +1440,7 @@ public class BattleManagerBase
public BattleControl GetBattleControl()
{
return GameMgr.GetIns().GetBattleCtrl();
}
public CardParameterListInfo GetCardParameterListInfo(bool isPlayer)
{
if (!isPlayer)
{
return EnemyCardParameterListInfo;
}
return PlayerCardParameterListInfo;
return this.GameMgr.GetBattleCtrl();
}
public BattlePlayerBase GetBattlePlayer(bool isPlayer)
@@ -1573,14 +1466,9 @@ public class BattleManagerBase
return new BattlePlayerReadOnlyInfoPair(battlePlayer, battlePlayer2);
}
public Transform GetBattle3DContainerChild(string childName)
{
return Battle3DContainer.transform.Find(childName);
}
public virtual int StableRandom(int val)
{
if (IsForecast)
if (this.InstanceIsForecast)
{
return 0;
}
@@ -1591,7 +1479,7 @@ public class BattleManagerBase
public virtual double StableRandomDouble()
{
if (IsForecast)
if (this.InstanceIsForecast)
{
return 0.0;
}
@@ -1602,7 +1490,7 @@ public class BattleManagerBase
public virtual int StableRandomOnlySelf(int val)
{
if (IsForecast)
if (this.InstanceIsForecast)
{
return 0;
}
@@ -1688,12 +1576,6 @@ public class BattleManagerBase
return battleCardBase;
}
public BattleCardBase CreateFusionCard(int cardId, bool isPlayer)
{
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId);
return CardCreatorBase.CreateToken(CreateCardBuildInfo(null, cardParameterFromId, isPlayer, cardId, cardId), createNullView: true);
}
public BattleCardBase ReplaceChoiceBraveCard(BattleCardBase originalCard, int cardId, BattleCardBase selectSkillCard)
{
BattleCardBase choiceBraveCard = originalCard.SelfBattlePlayer.CreateCard(cardId, originalCard.SelfBattlePlayer.Class.Index, isChoiceBrave: true);
@@ -1729,15 +1611,15 @@ public class BattleManagerBase
GameObject gameObject = null;
if (cardParameter.CharType == CardBasePrm.CharaType.NORMAL)
{
gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(SBattleLoad.UnitCardTemplate.gameObject, _backGround.m_Battle3DContainer);
gameObject = this.GameMgr.GetPrefabMgr().CloneObjectToParent(SBattleLoad.UnitCardTemplate.gameObject, _backGround.m_Battle3DContainer);
}
else if (cardParameter.CharType == CardBasePrm.CharaType.SPELL)
{
gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(SBattleLoad.SpellCardTemplate.gameObject, _backGround.m_Battle3DContainer);
gameObject = this.GameMgr.GetPrefabMgr().CloneObjectToParent(SBattleLoad.SpellCardTemplate.gameObject, _backGround.m_Battle3DContainer);
}
else if (cardParameter.CharType == CardBasePrm.CharaType.FIELD || cardParameter.CharType == CardBasePrm.CharaType.CHANT_FIELD)
{
gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(SBattleLoad.FieldCardTemplate.gameObject, _backGround.m_Battle3DContainer);
gameObject = this.GameMgr.GetPrefabMgr().CloneObjectToParent(SBattleLoad.FieldCardTemplate.gameObject, _backGround.m_Battle3DContainer);
gameObject.transform.Find("CardObj/NormalField").gameObject.SetActive(value: false);
}
SetupCardObjectTags(gameObject, isPlayer, cardIndex);
@@ -1820,7 +1702,7 @@ public class BattleManagerBase
public VfxBase DeadClass(bool PlayerDead, FINISH_TYPE finishType)
{
ClassBattleCardBase classBattleCardBase = (ClassBattleCardBase)GetBattlePlayer(PlayerDead).Class;
if (GameMgr.GetIns().IsReplayBattle && !classBattleCardBase.ClassBattleCardView.InPlayModelActive)
if (this.GameMgr.IsReplayBattle && !classBattleCardBase.ClassBattleCardView.InPlayModelActive)
{
return NullVfx.GetInstance();
}
@@ -1881,7 +1763,7 @@ public class BattleManagerBase
public virtual void InitiateGameEndSequence(bool hasWon)
{
if (GameMgr.GetIns().IsReplayBattle && !GameMgr.GetIns().IsNewReplayBattle)
if (this.GameMgr.IsReplayBattle && !this.GameMgr.IsNewReplayBattle)
{
hasWon = Data.ReplayBattleInfo.is_win;
}
@@ -1897,7 +1779,7 @@ public class BattleManagerBase
public virtual VfxBase PlaySpecialWin(BattlePlayerBase winPlayer)
{
GetIns().VfxMgr.RegisterImmediateVfx(new CanNotTouchCardVfx());
GetIns().VfxMgr.RegisterImmediateVfx(NullVfx.GetInstance());
bool playerDead = !winPlayer.IsPlayer;
return SequentialVfxPlayer.Create(DeadClass(playerDead, FINISH_TYPE.SPECIAL_WIN), InstantVfx.Create(delegate
{
@@ -1907,7 +1789,7 @@ public class BattleManagerBase
public virtual void PlayRetire()
{
GetIns().VfxMgr.RegisterImmediateVfx(new CanNotTouchCardVfx());
GetIns().VfxMgr.RegisterImmediateVfx(NullVfx.GetInstance());
if (!GetBattlePlayer(isPlayer: true).Class.IsDead)
{
BattlePlayer.BattleView.HideTurnEndButton();
@@ -1920,11 +1802,6 @@ public class BattleManagerBase
}
}
public void MulliganSubmit()
{
VfxMgr.RegisterSequentialVfx(this.OnSubmitMulligan.GetAllFuncVfxResults());
}
public void ChangeCameraFieldOfView(float aspectRatio)
{
if ((bool)Battle3DContainer)
@@ -1947,7 +1824,7 @@ public class BattleManagerBase
}
Camera component2 = transform2.GetComponent<Camera>();
component2.fieldOfView = num;
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
DataMgr dataMgr = this.GameMgr.GetDataMgr();
if (dataMgr.Is3DSkin(isPlayer: true))
{
component2.depth = 40f;
@@ -1982,7 +1859,7 @@ public class BattleManagerBase
public bool CanOpenEvolutionConfirmation(BattleCardBase card)
{
if (IsStopOperate || !card.IsInplay || !card.SelfBattlePlayer.IsSelfTurn || !card.IsPlayer || !card.IsUnit || GameMgr.GetIns().IsWatchBattle)
if (IsStopOperate || !card.IsInplay || !card.SelfBattlePlayer.IsSelfTurn || !card.IsPlayer || !card.IsUnit || this.GameMgr.IsWatchBattle)
{
return false;
}
@@ -1994,7 +1871,7 @@ public class BattleManagerBase
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
if (battlePlayer.IsShortageDeckWin)
{
sequentialVfxPlayer.Register(new DeckOutWinVfx(battlePlayer));
sequentialVfxPlayer.Register(NullVfx.GetInstance());
sequentialVfxPlayer.Register(DeadClass(!battlePlayer.IsPlayer, FINISH_TYPE.SPECIAL_WIN));
battlePlayer.Class.OpponentBattlePlayer.Class.FlagCardAsDestroyedBySkill();
}
@@ -2002,12 +1879,12 @@ public class BattleManagerBase
{
if (battlePlayer.IsPlayer)
{
sequentialVfxPlayer.Register(new PlayerDeckOutVfx(BattlePlayer, this));
sequentialVfxPlayer.Register(NullVfx.GetInstance());
BattlePlayer.SetIsShortageDeckLose(flag: true);
}
else
{
sequentialVfxPlayer.Register(new EnemyDeckOutVfx(BattleEnemy, this));
sequentialVfxPlayer.Register(NullVfx.GetInstance());
BattleEnemy.SetIsShortageDeckLose(flag: true);
}
sequentialVfxPlayer.Register(DeadClass(battlePlayer.IsPlayer, FINISH_TYPE.NORMAL));
@@ -2114,7 +1991,7 @@ public class BattleManagerBase
{
if (item.Key.HasOwnerCard())
{
if (item.Key.IsOwnerCardDead())
if (item.Key.IsOwnerCardDead(EnemyFusionCard))
{
list.Add(item.Key);
}
@@ -2133,7 +2010,7 @@ public class BattleManagerBase
{
if (item3.Key.HasOwnerCard())
{
if (item3.Key.IsOwnerCardDead())
if (item3.Key.IsOwnerCardDead(EnemyFusionCard))
{
list.Add(item3.Key);
}
@@ -2152,7 +2029,7 @@ public class BattleManagerBase
{
if (item5.Key.HasOwnerCard())
{
if (item5.Key.IsOwnerCardDead())
if (item5.Key.IsOwnerCardDead(EnemyFusionCard))
{
list.Add(item5.Key);
}
@@ -2170,7 +2047,7 @@ public class BattleManagerBase
protected void SetUpMyRotationBattle(int playerMaxLife, int enemyMaxLife)
{
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
DataMgr dataMgr = this.GameMgr.GetDataMgr();
MyRotationInfo myRotationInfo;
bool flag = dataMgr.TryGetPlayerMyRotationInfo(out myRotationInfo);
MyRotationInfo myRotationInfo2;
@@ -2253,7 +2130,7 @@ public class BattleManagerBase
{
if (Data.CurrentFormat == Format.Avatar)
{
GameMgr.GetIns().GetDataMgr();
this.GameMgr.GetDataMgr();
if (doesPlayerGoFirst)
{
SetupSpecifiedPlayerAvatarBattle(isPlayer: true);
@@ -2269,7 +2146,7 @@ public class BattleManagerBase
private void SetupSpecifiedPlayerAvatarBattle(bool isPlayer)
{
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
DataMgr dataMgr = this.GameMgr.GetDataMgr();
if ((!isPlayer) ? dataMgr.TryGetEnemyAvatarBattleInfo(out var avatarBattleInfo) : dataMgr.TryGetPlayerAvatarBattleInfo(out avatarBattleInfo))
{
SetupPlayerAvatarBattle(isPlayer ? ((BattlePlayerBase)BattlePlayer) : ((BattlePlayerBase)BattleEnemy), avatarBattleInfo);
@@ -2321,19 +2198,6 @@ public class BattleManagerBase
return new AttachInfo(battleCardBase, skillBase, targetSkillBuildInfo, myRotationBonusId);
}
public static bool IsCardPrivate(BattleCardBase card)
{
if (!card.IsPlayer)
{
if (!card.IsInHand)
{
return card.IsInDeck;
}
return true;
}
return false;
}
public VfxBase LoadCardResources(List<BattleCardBase> cards, bool isRecoveryFinish = false)
{
if (cards.Count == 0)
@@ -2387,63 +2251,8 @@ public class BattleManagerBase
});
}
}
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(new WaitLoadResourceVfx(list2, action));
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(NullVfx.GetInstance());
sequentialVfxPlayer.Register(parallelVfxPlayer);
return sequentialVfxPlayer;
}
public VfxBase RecoveryInPlayAndHandCards()
{
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
List<BattleCardBase> list = new List<BattleCardBase>();
for (int i = 0; i < BattlePlayer.InPlayCards.Count(); i++)
{
BattleCardBase battleCardBase = BattlePlayer.InPlayCards.ElementAt(i);
battleCardBase.BattleCardView.CardWrapObject.SetActive(value: true);
iTween.Stop(battleCardBase.BattleCardView.GameObject);
list.Add(battleCardBase);
parallelVfxPlayer.Register(battleCardBase.RecoveryInPlay(i, newReplayMoveTurn: true));
}
for (int j = 0; j < BattleEnemy.InPlayCards.Count(); j++)
{
BattleCardBase battleCardBase2 = BattleEnemy.InPlayCards.ElementAt(j);
iTween.Stop(battleCardBase2.BattleCardView.GameObject);
list.Add(battleCardBase2);
parallelVfxPlayer.Register(battleCardBase2.RecoveryInPlay(j, newReplayMoveTurn: true));
}
for (int k = 0; k < BattlePlayer.HandCardList.Count; k++)
{
BattleCardBase card = BattlePlayer.HandCardList[k];
list.Add(card);
card.SetOnDraw(draw: false);
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(card.BattleCardView.RecoveryInHand());
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
{
card.BattleCardView.GameObject.SetActive(value: false);
MotionUtils.SetLayerAll(card.BattleCardView.GameObject, 10);
card.BattleCardView.InitCostViewAnim();
card.BattleCardView.Transform.parent = BattlePlayer.HandControl.Transform;
BattlePlayer.BattleView.HandView.AddCardToView(card.BattleCardView, 0f, isNewReplayMoveTurn: true);
card.BattleCardView.GameObject.SetActive(value: true);
card.BattleCardView.CardWrapObject.SetActive(value: true);
}));
parallelVfxPlayer.Register(sequentialVfxPlayer);
}
for (int num = 0; num < BattleEnemy.HandCardList.Count; num++)
{
BattleCardBase card2 = BattleEnemy.HandCardList[num];
list.Add(card2);
SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create();
sequentialVfxPlayer2.Register(InstantVfx.Create(delegate
{
card2.BattleCardView.GameObject.SetActive(value: false);
MotionUtils.SetLayerAll(card2.BattleCardView.GameObject, 10);
card2.BattleCardView.Transform.parent = BattleEnemy.HandControl.Transform;
BattleEnemy.BattleView.HandView.AddCardToView(card2.BattleCardView, 0f, isNewReplayMoveTurn: true);
card2.BattleCardView.GameObject.SetActive(value: true);
}));
parallelVfxPlayer.Register(sequentialVfxPlayer2);
}
return SequentialVfxPlayer.Create(LoadCardResources(list), parallelVfxPlayer);
}
}