feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
147
SVSim.BattleEngine/Engine/Wizard/AITokenIdCollection.cs
Normal file
147
SVSim.BattleEngine/Engine/Wizard/AITokenIdCollection.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class AITokenIdCollection
|
||||
{
|
||||
public List<AITokenInformation> AllyTokenIdList;
|
||||
|
||||
public List<AITokenInformation> OpponentTokenIdList;
|
||||
|
||||
public bool HasAllyToken
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AllyTokenIdList != null)
|
||||
{
|
||||
return AllyTokenIdList.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasOpponentToken
|
||||
{
|
||||
get
|
||||
{
|
||||
if (OpponentTokenIdList != null)
|
||||
{
|
||||
return OpponentTokenIdList.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasToken
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!HasAllyToken)
|
||||
{
|
||||
return HasOpponentToken;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public AITokenIdCollection()
|
||||
{
|
||||
AllyTokenIdList = null;
|
||||
OpponentTokenIdList = null;
|
||||
}
|
||||
|
||||
public void Add(int id, AITokenType tokenType, bool isAllyToken)
|
||||
{
|
||||
AITokenInformation element = new AITokenInformation(id, tokenType);
|
||||
if (isAllyToken)
|
||||
{
|
||||
AllyTokenIdList = AIParamQuery.AddElementToList(element, AllyTokenIdList);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpponentTokenIdList = AIParamQuery.AddElementToList(element, OpponentTokenIdList);
|
||||
}
|
||||
}
|
||||
|
||||
private void Combine(AITokenIdCollection collection)
|
||||
{
|
||||
if (collection != null)
|
||||
{
|
||||
if (collection.HasAllyToken)
|
||||
{
|
||||
AllyTokenIdList = AIParamQuery.AddRangeToList(collection.AllyTokenIdList, AllyTokenIdList);
|
||||
}
|
||||
if (collection.HasOpponentToken)
|
||||
{
|
||||
OpponentTokenIdList = AIParamQuery.AddRangeToList(collection.OpponentTokenIdList, OpponentTokenIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static AITokenIdCollection CombineTwoCollection(AITokenIdCollection collection1, AITokenIdCollection collection2)
|
||||
{
|
||||
if (collection2 == null)
|
||||
{
|
||||
return collection1;
|
||||
}
|
||||
if (collection1 == null)
|
||||
{
|
||||
collection1 = collection2;
|
||||
}
|
||||
else
|
||||
{
|
||||
collection1.Combine(collection2);
|
||||
}
|
||||
return collection1;
|
||||
}
|
||||
|
||||
public void MultiplyByRepeatCount(int repeatCount)
|
||||
{
|
||||
if (repeatCount <= 0)
|
||||
{
|
||||
if (AllyTokenIdList != null)
|
||||
{
|
||||
AllyTokenIdList.Clear();
|
||||
AllyTokenIdList = null;
|
||||
}
|
||||
if (OpponentTokenIdList != null)
|
||||
{
|
||||
OpponentTokenIdList.Clear();
|
||||
OpponentTokenIdList = null;
|
||||
}
|
||||
}
|
||||
if (repeatCount <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool hasAllyToken = HasAllyToken;
|
||||
bool hasOpponentToken = HasOpponentToken;
|
||||
List<AITokenInformation> list = null;
|
||||
List<AITokenInformation> list2 = null;
|
||||
for (int i = 0; i < repeatCount; i++)
|
||||
{
|
||||
if (hasAllyToken)
|
||||
{
|
||||
list = AIParamQuery.AddRangeToList(AllyTokenIdList, list);
|
||||
}
|
||||
if (hasOpponentToken)
|
||||
{
|
||||
list2 = AIParamQuery.AddRangeToList(OpponentTokenIdList, list2);
|
||||
}
|
||||
}
|
||||
AllyTokenIdList = list;
|
||||
OpponentTokenIdList = list2;
|
||||
}
|
||||
|
||||
public void DrawAllTokenToField(AIVirtualField field, AIVirtualCard owner, AISituationInfo situation)
|
||||
{
|
||||
if (HasAllyToken)
|
||||
{
|
||||
AITokenDrawUtility.ExecuteTokenDraw(owner, situation, field, AllyTokenIdList, isAlly: true);
|
||||
}
|
||||
if (HasOpponentToken)
|
||||
{
|
||||
AITokenDrawUtility.ExecuteTokenDraw(owner, situation, field, OpponentTokenIdList, isAlly: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user