Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/AIReverseEvaluateValueListOrder.cs
gamer147 824309ec44 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.
2026-06-05 20:30:59 -04:00

67 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace Wizard;
public class AIReverseEvaluateValueListOrder
{
private List<float> evalvalues = new List<float>();
private List<AIVirtualCard> cards = new List<AIVirtualCard>();
public void AddData(float value, AIVirtualCard card)
{
if (card == null)
{
AIConsoleUtility.LogError("CompValue:AddData() Target card is null");
}
else if (evalvalues.Any())
{
bool flag = false;
for (int i = 0; i < evalvalues.Count; i++)
{
if (evalvalues[i] > value)
{
evalvalues.Insert(i, value);
cards.Insert(i, card);
flag = true;
break;
}
}
if (!flag)
{
evalvalues.Add(value);
cards.Add(card);
}
}
else
{
evalvalues.Add(value);
cards.Add(card);
}
}
public List<AIVirtualCard> GetCardList(int takeCount)
{
if (takeCount <= 0 || cards.Count < takeCount)
{
return null;
}
List<AIVirtualCard> list = new List<AIVirtualCard>();
for (int i = 0; i < takeCount; i++)
{
list.Add(cards[i]);
}
return list;
}
public AIVirtualCard GetFirst()
{
if (cards == null || cards.Count <= 0)
{
return null;
}
return cards[0];
}
}