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:
89
SVSim.BattleEngine/Engine/Wizard/ConventionDeckList.cs
Normal file
89
SVSim.BattleEngine/Engine/Wizard/ConventionDeckList.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class ConventionDeckList
|
||||
{
|
||||
public IDictionary<int, DeckData> DeckList { get; private set; }
|
||||
|
||||
public IDictionary<int, int> CardPool { get; private set; }
|
||||
|
||||
public IList<int> DeckIdList { get; private set; }
|
||||
|
||||
public ConventionInfo Conventioninfo { get; private set; }
|
||||
|
||||
public ConventionDeckList()
|
||||
{
|
||||
DeckList = new Dictionary<int, DeckData>();
|
||||
DeckIdList = new List<int>();
|
||||
}
|
||||
|
||||
public void Parse(JsonData responseData, ConventionInfo conventionInfo)
|
||||
{
|
||||
Conventioninfo = conventionInfo;
|
||||
if (responseData["data"].Keys.Contains("tournament_card_list"))
|
||||
{
|
||||
JsonData jsonData = responseData["data"]["tournament_card_list"];
|
||||
CardPool = new Dictionary<int, int>(jsonData.Count);
|
||||
for (int i = 0; i < jsonData.Count; i++)
|
||||
{
|
||||
CardPool.Add(jsonData[i].ToInt(), 3);
|
||||
}
|
||||
}
|
||||
ParseDeckListJson(responseData["data"]["user_deck_list"]);
|
||||
}
|
||||
|
||||
public ConventionDeckList(JsonData responseData, ConventionInfo conventionInfo)
|
||||
{
|
||||
Parse(responseData, conventionInfo);
|
||||
}
|
||||
|
||||
public void ParseDeckListJson(JsonData userDeck)
|
||||
{
|
||||
for (int i = 0; i < userDeck.Count; i++)
|
||||
{
|
||||
JsonData jsonData = userDeck[i];
|
||||
int num = jsonData["deck_no"].ToInt();
|
||||
if (!DeckIdList.Contains(num))
|
||||
{
|
||||
DeckIdList.Add(num);
|
||||
DeckList.Add(num, new DeckData(Conventioninfo.BattleParameterInstance.DeckFormat, DeckAttributeType.CustomDeck));
|
||||
}
|
||||
DeckList[num].Initialize(jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
public DeckData GetDeckUsingOffset(int i)
|
||||
{
|
||||
return DeckList[DeckIdList[i]];
|
||||
}
|
||||
|
||||
public int GetDeckNum()
|
||||
{
|
||||
return DeckIdList.Count;
|
||||
}
|
||||
|
||||
public List<int> GetConventionDeckClassList()
|
||||
{
|
||||
List<int> list = new List<int>(DeckList.Count);
|
||||
IFormatBehavior formatBehavior = FormatBehaviorManager.Create(Conventioninfo.BattleParameterInstance.DeckFormat, this);
|
||||
foreach (KeyValuePair<int, DeckData> deck in DeckList)
|
||||
{
|
||||
if (!deck.Value.IsNoCard())
|
||||
{
|
||||
list.Add(deck.Value.GetDeckClassID());
|
||||
if (formatBehavior.UseSubClass)
|
||||
{
|
||||
list.Add(deck.Value.GetDeckSubClassID());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool IsUseOkCard(int cardId)
|
||||
{
|
||||
return CardPool.ContainsKey(cardId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user