using System.Collections.Generic; using System.Linq; using Wizard.Battle; public class SkillParameterIsChaosFilter : ISkillCardFilter { private bool _isChaos; public SkillParameterIsChaosFilter(string value) { _isChaos = value == "true"; } public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) { // Pull NetworkUserInfoData lazily via the first card's mgr chain instead of caching // it at ctor time (the ctor runs during skill parsing when no mgr is attached). NetworkUserInfoData userInfo = cards.FirstOrDefault()?.SelfBattlePlayer?.BattleMgr?.GameMgr?.GetNetworkUserInfoData(); if (userInfo == null) return new List(); int chaosId = userInfo.GetSelfChaosId(); if ((_isChaos && chaosId != -1) || (!_isChaos && chaosId == -1)) { return cards; } return new List(); } }