Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/DeckGroupListData.cs
gamer147 0d9d8acae0 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.
2026-06-05 16:57:20 -04:00

126 lines
3.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
using LitJson;
namespace Wizard;
public class DeckGroupListData
{
public List<DeckGroup> DeckGroupList { get; private set; } = new List<DeckGroup>();
public bool VisiblePreRotation { get; private set; }
public DeckGroupListData()
{
}
public DeckGroupListData(JsonData jsonData, Format format)
{
Initialize(DeckListUtility.ParseDeckInfoResponceData(jsonData, format));
}
public DeckGroupListData(DeckGroup deckGroup)
{
Initialize(new List<DeckGroup> { deckGroup });
}
public DeckGroupListData(List<DeckGroup> deckGroupList)
{
Initialize(deckGroupList);
}
private void Initialize(List<DeckGroup> deckGroupList)
{
DeckGroupList = deckGroupList;
VisiblePreRotation = Prerelease.Status == Prerelease.eStatus.PRE_ROTATION;
}
public void ForceVisiblePreRotation(bool isVisible)
{
VisiblePreRotation = isVisible;
}
public List<DeckGroup> SelectDeckGroupList(Format format)
{
List<DeckGroup> list = new List<DeckGroup>();
switch (format)
{
case Format.All:
list = ((!VisiblePreRotation) ? DeckGroupList.Where((DeckGroup group) => group.DeckFormat != Format.PreRotation).ToList() : DeckGroupList);
break;
case Format.PreRotation:
if (VisiblePreRotation)
{
list = DeckGroupList.Where((DeckGroup deckGroup) => deckGroup.DeckFormat == Format.PreRotation).ToList();
}
break;
case Format.MyRotation:
list = DeckGroupList.Where((DeckGroup deckGroup) => deckGroup.DeckFormat == format).ToList();
list.RemoveAll((DeckGroup deckGroup) => deckGroup.AttributeType == DeckAttributeType.DefaultDeck);
break;
default:
list = DeckGroupList.Where((DeckGroup deckGroup) => deckGroup.DeckFormat == format).ToList();
break;
}
return list;
}
public void RemoveUseSubClassDeckList()
{
DeckGroupList = DeckGroupList.Where((DeckGroup deckGroup) => !FormatBehaviorManager.GetDefaultBehaviour(deckGroup.DeckFormat).UseSubClass).ToList();
}
public void RemoveFormat(Format format)
{
DeckGroupList = DeckGroupList.Where((DeckGroup deckGroup) => deckGroup.DeckFormat != format).ToList();
}
public bool IsDeckListByAttributeEmpty(DeckAttributeType deckAttributeType, Format format = Format.All)
{
List<DeckData> deckListByAttribute = GetDeckListByAttribute(deckAttributeType, format);
if (deckListByAttribute == null)
{
return true;
}
if (deckListByAttribute.Count == 0)
{
return true;
}
return false;
}
public List<DeckData> GetDeckListByAttribute(DeckAttributeType deckAttributeType, Format format = Format.All)
{
return (from deck in GetDeckListByFormat(format)
where deck.DeckAttributeType == deckAttributeType
select deck).ToList();
}
public DeckData GetDeckByAttribute(DeckAttributeType deckAttributeType, int deckId, Format format)
{
return GetDeckListByAttribute(deckAttributeType, format).FirstOrDefault((DeckData deckData) => deckData.GetDeckID() == deckId);
}
public List<DeckData> GetDeckListByFormat(Format format)
{
List<DeckData> list = new List<DeckData>();
foreach (DeckGroup item in SelectDeckGroupList(format))
{
list.AddRange(item.DeckDataList);
}
return list;
}
public bool IsExistDeckListByFormat(Format format = Format.All)
{
foreach (DeckData item in GetDeckListByFormat(format))
{
if (!item.IsNoCard())
{
return true;
}
}
return false;
}
}