feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
52
SVSim.BattleEngine/Engine/Wizard/AIDrawCountUtility.cs
Normal file
52
SVSim.BattleEngine/Engine/Wizard/AIDrawCountUtility.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public static class AIDrawCountUtility
|
||||
{
|
||||
public static int GetDrawCount(AIVirtualCard owner, AIVirtualField field, List<int> playPtn, AIScriptTokenArgType period, AIScriptTokenArgType range)
|
||||
{
|
||||
int num = 0;
|
||||
switch (range)
|
||||
{
|
||||
case AIScriptTokenArgType.PLAYPTN:
|
||||
return num + GetDrawCountOfPlayptn(owner, field, playPtn);
|
||||
case AIScriptTokenArgType.PLAYED:
|
||||
return num + GetDrawCountOfPlayed(period, field);
|
||||
default:
|
||||
num += GetDrawCountOfPlayptn(owner, field, playPtn);
|
||||
return num + GetDrawCountOfPlayed(period, field);
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetDrawCountOfPlayptn(AIVirtualCard owner, AIVirtualField field, List<int> playPtn)
|
||||
{
|
||||
if (playPtn == null || playPtn.Count <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
AISinglePlayptnRecord playptnRecordOnSim = field.GetPlayptnRecordOnSim(playPtn);
|
||||
if (playptnRecordOnSim == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = 0;
|
||||
List<PlayedCardInfo> playedCardList = playptnRecordOnSim.PlayedCardList;
|
||||
for (int i = 0; i < playedCardList.Count && !playedCardList[i].Card.IsSameCard(owner); i++)
|
||||
{
|
||||
num += playedCardList[i].DrawCount;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static int GetDrawCountOfPlayed(AIScriptTokenArgType period, AIVirtualField field)
|
||||
{
|
||||
int virtualDrawCount = field.VirtualDrawCount;
|
||||
return period switch
|
||||
{
|
||||
AIScriptTokenArgType.TURN => virtualDrawCount + field.TurnDrawCount,
|
||||
AIScriptTokenArgType.GAME => virtualDrawCount + field.GameDrawCount,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user