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:
50
SVSim.BattleEngine/Engine/Wizard/AITokenPool.cs
Normal file
50
SVSim.BattleEngine/Engine/Wizard/AITokenPool.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user