Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/AIBattleInfoReceiver.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

122 lines
3.9 KiB
C#

using System.Linq;
namespace Wizard;
public class AIBattleInfoReceiver
{
private const string NOT_FOUND_INSTANCE_LOG = "AIBattleInfoReceiver.GetInstance() error. battleMgr does not have battleInfoReceiver.";
private IEnemyAIBattleInfoRecieveDataAccessor _enemyAI;
private AIGenerateTagOwnerTable _oprSimGenerateTagOwnerTable;
private AIBattleInfoReceivedData _oprSimBattleInfoReceiveData;
private bool _isExecutingOprSim;
public bool IsNotNullOprSimCollections
{
get
{
if (_oprSimGenerateTagOwnerTable != null)
{
return _oprSimBattleInfoReceiveData != null;
}
return false;
}
}
public static bool CheckCreatedValidEnemyAI()
{
return BattleManagerBase.GetIns().EnemyAI is IEnemyAIBattleInfoRecieveDataAccessor;
}
public static AIBattleInfoReceiver GetInstance()
{
AIBattleInfoReceiver result = null;
BattleManagerBase ins = BattleManagerBase.GetIns();
if (ins is SingleBattleMgr singleBattleMgr)
{
result = singleBattleMgr.BattleInfoReceiver;
}
else if (ins is AINetworkBattleManager aINetworkBattleManager)
{
result = aINetworkBattleManager.BattleInfoReceiver;
}
return result;
}
public static void ShowNotFoundInstanceLog()
{
LocalLog.AccumulateTraceLog("AIBattleInfoReceiver.GetInstance() error. battleMgr does not have battleInfoReceiver.");
}
public AIBattleInfoReceiver(IEnemyAI enemyAI)
{
_enemyAI = enemyAI as IEnemyAIBattleInfoRecieveDataAccessor;
}
public void ReceiveAttachedSkillInfo(BattleCardBase skillOwner, BattleCardBase target)
{
string lastAttachedSkillHash = GetLastAttachedSkillHash(target);
if (_isExecutingOprSim && IsNotNullOprSimCollections)
{
RegisterAttachedSkillInfoToOperationSimulator(skillOwner, target, lastAttachedSkillHash);
}
else
{
RegisterAttachedSkillInfoToRealField(skillOwner, target, lastAttachedSkillHash);
}
}
protected virtual void RegisterAttachedSkillInfoToRealField(BattleCardBase skillOwner, BattleCardBase target, string skillHash)
{
if (_enemyAI != null)
{
RegisterGenerateTagExecutingParameters(_enemyAI.GenerateTagOwnerTable, _enemyAI.BattleInfoReceivedData, skillOwner, target, skillHash);
}
}
protected string GetLastAttachedSkillHash(BattleCardBase target)
{
AttachedSkillInformation attachedSkillsInfo = target.SkillApplyInformation.AttachedSkillsInfo;
if (attachedSkillsInfo == null || attachedSkillsInfo.AttachedSkills == null || attachedSkillsInfo.AttachedSkills.Count() <= 0)
{
return null;
}
SkillBase skillBase = attachedSkillsInfo.AttachedSkills.Get(attachedSkillsInfo.AttachedSkills.Count() - 1);
if (skillBase == null)
{
return null;
}
return CardSkillHashUtility.GetSingleSkillBaseHash(skillBase).ToString();
}
protected void RegisterGenerateTagExecutingParameters(AIGenerateTagOwnerTable generateTagOwnerTable, AIBattleInfoReceivedData battleInfoReceivedData, BattleCardBase skillOwner, BattleCardBase target, string skillHash)
{
battleInfoReceivedData.AttachedInfoReceiveCollection.GetInfoFromOwner(skillOwner.BaseParameter.BaseCardId, skillOwner.Index, skillOwner.IsPlayer)?.AddTargetAndSkillHash(target, skillHash);
}
public void SetUpOprSimAccessor(AIOperationSimulatorAccessor oprSimAccessor)
{
_isExecutingOprSim = true;
_oprSimGenerateTagOwnerTable = oprSimAccessor.GenerateTagOwnerTable;
_oprSimBattleInfoReceiveData = oprSimAccessor.BattleInfoReceiveDate;
}
public void CleanUpOprSimAccessor()
{
_isExecutingOprSim = false;
_oprSimGenerateTagOwnerTable = null;
_oprSimBattleInfoReceiveData = null;
}
protected void RegisterAttachedSkillInfoToOperationSimulator(BattleCardBase skillOwner, BattleCardBase target, string skillHash)
{
if (IsNotNullOprSimCollections)
{
RegisterGenerateTagExecutingParameters(_oprSimGenerateTagOwnerTable, _oprSimBattleInfoReceiveData, skillOwner, target, skillHash);
}
}
}