Beispiel #1
0
        void PriorityCheck(Contact lhs, Contact rhs)
        {
            if (lhs.Type != ContactType.Hit)
            {
                throw new ArgumentException("lhs");
            }
            if (rhs.Type != ContactType.Hit)
            {
                throw new ArgumentException("rhs");
            }

            HitPriority lhs_hp = lhs.HitDef.HitPriority;
            HitPriority rhs_hp = rhs.HitDef.HitPriority;

            if (lhs_hp.Power > rhs_hp.Power)
            {
                m_killist.Add(rhs);
            }
            else if (lhs_hp.Power < rhs_hp.Power)
            {
                m_killist.Add(lhs);
            }
            else
            {
                if (lhs_hp.Type != PriorityType.Hit && rhs_hp.Type != PriorityType.Hit)
                {
                    m_killist.Add(lhs);
                    m_killist.Add(rhs);
                }
                else if (lhs_hp.Type == PriorityType.Dodge || rhs_hp.Type == PriorityType.Dodge)
                {
                    m_killist.Add(lhs);
                    m_killist.Add(rhs);
                }
                else if (lhs_hp.Type == PriorityType.Hit && rhs_hp.Type == PriorityType.Miss)
                {
                    m_killist.Add(rhs);
                }
                else if (lhs_hp.Type == PriorityType.Hit && rhs_hp.Type == PriorityType.Miss)
                {
                    m_killist.Add(lhs);
                }
            }
        }
Beispiel #2
0
        Int32 ContactSort(Contact lhs, Contact rhs)
        {
            if (lhs.Type != rhs.Type)
            {
                return(Comparer <ContactType> .Default.Compare(lhs.Type, rhs.Type));
            }

            if (lhs.Type == ContactType.Hit)
            {
                HitPriority hp_lhs = lhs.HitDef.HitPriority;
                HitPriority hp_rhs = rhs.HitDef.HitPriority;

                if (hp_lhs.Power == hp_rhs.Power)
                {
                    return(0);
                }

                return((hp_lhs.Power < hp_rhs.Power) ? -1 : 1);
            }

            return(0);
        }