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.
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Wizard;
|
|
|
|
public class AITokenPool
|
|
{
|
|
private const int DEFAULT_TOKEN_INDEX = -1;
|
|
|
|
private Dictionary<int, AIVirtualCard> tokenPool;
|
|
|
|
private BattlePlayerBase owner;
|
|
|
|
private int tokenIndex;
|
|
|
|
public void AddTokenToPool(EnemyAI ai, int tokenId, bool isChoice)
|
|
{
|
|
if (tokenPool.TryGetValue(tokenId, out var value))
|
|
{
|
|
AIVirtualCard aIVirtualCard = (value.IsAlly ? ai.CurrentVirtualField.AllyClass : ai.CurrentVirtualField.EnemyClass);
|
|
value.IsSelfTurn = aIVirtualCard.IsSelfTurn;
|
|
return;
|
|
}
|
|
int cardIndex = (isChoice ? tokenId : tokenIndex--);
|
|
AIVirtualCard aIVirtualCard2 = new AIVirtualCard(owner.CreateCard(tokenId, cardIndex), ai.CurrentVirtualField);
|
|
aIVirtualCard2.InitializeTags(ai.ParamQuery, null, null);
|
|
tokenPool.Add(tokenId, aIVirtualCard2);
|
|
}
|
|
|
|
public AIVirtualCard GetTokenFromPool(int tokenId)
|
|
{
|
|
if (tokenPool.TryGetValue(tokenId, out var value))
|
|
{
|
|
return value;
|
|
}
|
|
AIConsoleUtility.LogError("getTokenFromPool: ID does not exist in the pool! ID: " + tokenId);
|
|
return null;
|
|
}
|
|
|
|
public bool IsRegisteredToken(int tokenId)
|
|
{
|
|
return tokenPool.ContainsKey(tokenId);
|
|
}
|
|
|
|
public AITokenPool(BattlePlayerBase _owner)
|
|
{
|
|
tokenPool = new Dictionary<int, AIVirtualCard>();
|
|
owner = _owner;
|
|
tokenIndex = -1;
|
|
}
|
|
}
|