/// <summary>
    ///
    /// </summary>
    /// <param name="data1">The unit on the board</param>
    /// <param name="data2">The unit in the hand</param>
    /// <returns></returns>
    public bool Check(UnitData data1, UnitData data2)
    {
        if (!m_CanSame && data1.ID == data2.ID)
        {
            return(false);
        }

        if (data1Condition != null)
        {
            bool check1 = data1Condition.Check(data1);
            if (!check1)
            {
                return(false);
            }
        }

        if (data2Condition != null)
        {
            bool check2 = data2Condition.Check(data2);
            if (!check2)
            {
                return(false);
            }
        }

        return(true);
    }
    public List <UnitData> GetAllCardsWithCondition(SingleUnitCondition condition)
    {
        List <UnitData> copy = new List <UnitData>();

        copy.AddRange(m_CardList);

        for (int i = copy.Count - 1; i >= 0; i--)
        {
            if (!condition.Check(copy[i]))
            {
                copy.RemoveAt(i);
            }
        }

        return(copy);
    }
Beispiel #3
0
    public void RefreshAura(List <Unit> units)
    {
        foreach (Unit unit in units)
        {
            if (CheckInArea(unit))
            {
                bool result = m_Condition.Check(unit.m_Data);

                if (result)
                {
                    TryApplyStatus(unit);
                }
                else
                {
                    TryRemoveStatus(unit);
                }
            }
        }
    }
Beispiel #4
0
    protected override void Filter()
    {
        base.Filter();

        if (m_NeedUnit && !m_NeedEmpty && m_Condition != null)
        {
            for (int i = m_Blocks.Count - 1; i >= 0; i--)
            {
                bool check = m_Condition.Check(m_Blocks[i].m_Unit.m_Data);
                if (check && m_Exclude)
                {
                    m_Blocks.RemoveAt(i);
                }
                else if (!check && !m_Exclude)
                {
                    m_Blocks.RemoveAt(i);
                }
            }

            m_Targets = new List <Unit>();
            GetUnitsFromBlocks();
        }
    }