public List <int> FindContextTarget(ContextTargetType target, ContextAbilityData context)
        {
            var list = new List <int>();

            switch (target)
            {
            case ContextTargetType.Target:
                list.Add(ContextTurn.InterfaceTargetId ?? context.OwnerId);
                break;

            case ContextTargetType.Owner:
                list.Add(context.OwnerId);
                break;

            case ContextTargetType.AllAllies:
                list = (context.IsEnemy ? _battleAccessor.LiveEnemies : _battleAccessor.LiveAllies).ToList();
                break;

            case ContextTargetType.AllEnemies:
                list = (context.IsEnemy ? _battleAccessor.LiveAllies : _battleAccessor.LiveEnemies).ToList();
                break;

            case ContextTargetType.AllUnits:
                list = _unitAccessor.State.Units.Where(x => x.Stars > 0).Select(x => x.Id).ToList();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(target), target, null);
            }
            return(list);
        }
 public void SetContextCondition(int ownerId, int target, bool isEnemy)
 {
     //Logger.Log($"{Logger.GetTabString()}change context condition owner id = {ownerId} target id = {target}");
     ContextCondition = new ContextAbilityData {
         OwnerId = ownerId, CurrentTarget = target, IsEnemy = isEnemy
     };
     CurrentContext = ContextCondition;
 }
        public void SetContextFormula(int?unit)
        {
            ContextFormula = unit;

            if (unit != null)
            {
                CurrentContext = new ContextAbilityData {
                    OwnerId = unit.Value, CurrentTarget = unit.Value, IsEnemy = true
                };
            }
            else
            {
                CurrentContext = new ContextAbilityData {
                    OwnerId = -1, CurrentTarget = -1, IsEnemy = false
                };
            }
        }