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:
@@ -0,0 +1,73 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public static class AIPlayoutAttackerCountUtility
|
||||
{
|
||||
public static int GetPlayoutAttackerCount(AIVirtualField field, AIVirtualCard tagOwner, List<int> playPtn, List<AIScriptTokenBase> filters, AISituationInfo situation)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < field.AllyInplayCards.Count; i++)
|
||||
{
|
||||
if (IsPlayoutAttacker(field.AllyInplayCards[i], field, filters, playPtn, tagOwner, situation))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
AISinglePlayptnRecord playptnRecordOnSim = field.GetPlayptnRecordOnSim(playPtn);
|
||||
for (int j = 0; j < playPtn.Count; j++)
|
||||
{
|
||||
AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[j]];
|
||||
if (aIVirtualCard == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (IsPlayoutAttacker(aIVirtualCard, field, filters, playPtn, tagOwner, situation))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
AIVirtualCard actor = aIVirtualCard;
|
||||
if (playptnRecordOnSim != null)
|
||||
{
|
||||
PlayedCardInfo playedCardInfo = playptnRecordOnSim.PlayedCardList[j];
|
||||
actor = ((playedCardInfo.TransformCard != null) ? playedCardInfo.TransformCard : aIVirtualCard);
|
||||
}
|
||||
AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(actor, aIVirtualCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null);
|
||||
aIVirtualTargetSelectAction.forceLethalMode = true;
|
||||
List<AITokenInformation> allySideTokenIdsOfPlaySituation = AIPlayTokenSimulationUtility.GetAllySideTokenIdsOfPlaySituation(field, playPtn, aIVirtualTargetSelectAction);
|
||||
if (allySideTokenIdsOfPlaySituation == null || allySideTokenIdsOfPlaySituation.Count <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (int k = 0; k < allySideTokenIdsOfPlaySituation.Count; k++)
|
||||
{
|
||||
if (IsPlayoutAttacker(field.AI.tokenManager.GetTokenFromId(allySideTokenIdsOfPlaySituation[k].TokenId, isAlly: true, field), field, filters, playPtn, tagOwner, situation))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (num >= 6)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static bool IsPlayoutAttacker(AIVirtualCard card, AIVirtualField field, List<AIScriptTokenBase> filters, List<int> playPtn, AIVirtualCard tagOwner, AISituationInfo situation)
|
||||
{
|
||||
if (!card.IsAlly || !card.IsOnField)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!card.IsUnit || card.IsDead || !AIAttackSimulationUtility.IsAttackPossible(field, card.AttackLeaderSituation))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!AIFilteringUtility.CheckMatchTargetFiltering(card, field.AllyInplayCards, filters, playPtn, tagOwner, situation))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user