Exemple #1
0
        public override void Excute()
        {
            MsgDispatcher.SendMsg((int)MessageType.AnnounceAttack);
            //根据伤害优先级对伤害请求排序
            DamageRequestList = DamageRequest.CaculateDamageRequestList(_Attacker, _AttackedUnit);

            for (int i = 0; i < DamageRequestList.Count; i++)
            {
                //优先级相同并且两方互打的伤害请求作为同时处理
                if (i != DamageRequestList.Count - 1 && DamageRequestList[i].priority == DamageRequestList[i + 1].priority &&
                    DamageRequestList[i]._attacker == DamageRequestList[i + 1]._attackedUnit &&
                    DamageRequestList[i]._attackedUnit == DamageRequestList[i + 1]._attacker)
                {
                    //判断被攻击者的反击距离
                    if (JudgeStrikeBack())
                    {
                        DamageRequestList[i].ExcuteSameTime();
                    }
                    else
                    {
                        DamageRequestList[i].Excute(); //距离不够,无法进行反击
                    }
                    i++;
                }
                else if (!_AttackedUnit.IsDead() && !_Attacker.IsDead() && JudgeStrikeBack()) //符合反击要求
                {
                    DamageRequestList[i].Excute();
                }
                else if (!_AttackedUnit.IsDead() && !_Attacker.IsDead() && !JudgeStrikeBack()) //距离不够,无法进行反击
                {
                    DamageRequestList[i].Excute();
                    i++;
                }
            }
        }
Exemple #2
0
    public override void Excute()
    {
        MsgDispatcher.SendMsg((int)TriggerType.AnnounceAttack);
        //根据伤害优先级对伤害请求排序
        DamageRequestList = DamageRequest.CaculateDamageRequestList(_Attacker, _AttackedUnit);

        for (int i = 0; i < DamageRequestList.Count; i++)
        {
            //优先级相同并且两方互打的伤害请求作为同时处理
            if (i != DamageRequestList.Count - 1 && DamageRequestList[i].priority == DamageRequestList[i + 1].priority &&
                DamageRequestList[i]._attacker == DamageRequestList[i + 1]._attackedUnit &&
                DamageRequestList[i]._attackedUnit == DamageRequestList[i + 1]._attacker)
            {
                DamageRequestList[i].ExcuteSameTime();
                i++;
            }
            else
            {
                DamageRequestList[i].Excute();
            }
        }
    }