Ejemplo n.º 1
0
    public void DoGodSkill()
    {
        //Debug.Log("2 & 2  "+ (2 & 2) + ",  7 & 2  " + (7 & 2));

        List <Life> ltarget = GetRangeAttackList(m_godskill.m_target, m_godskill.m_multiple, m_targetpos, m_godskill.m_range, m_Camp);

        /*  if (ltarget.Count == 0)//目标不是来自技能
         * {
         *
         * }*/

        if (m_godskill.m_action == 1)
        {
            foreach (Life l in ltarget)
            {
                if (l.m_Core.m_Camp == m_Camp)
                {
                    StatusBuff(l);
                }
                else
                {
                    SkillReleaseInfo Info = new SkillReleaseInfo();
                    Info.m_InterruptSkill = false;
                    Info.m_MakeStatus     = new List <StatusType> ();
                    Info.m_bImmunity      = false;
                    if (l is Building)
                    {
                        Info.m_Damage = -Mathf.CeilToInt(m_godskill.m_power2 * l.fullHP * 1.0f / l.m_Attr.Bear);
                    }
                    else
                    {
                        Info.m_Damage = -m_godskill.m_power;
                    }
                    Info.m_struckeffect = "";
                    Info.Result         = AttackResult.Normal;
                    if (StatusDeBuff(l))
                    {
                        Info.m_InterruptSkill = true;
                    }
                    //else Damage = Defense.HP;
                    //判断受击方受到的伤害值,是否大于可被打断伤害值。
                    int LimitHp = l.m_Attr.Hp * ConfigM.GetSkillData0() / 100;
                    if (m_godskill.m_power > LimitHp)
                    {
                        Info.m_InterruptSkill = true;
                    }
                    l.ApplyDamage(Info, null);
                }
            }
        }
        else if (m_godskill.m_action == 2)
        {
            ltarget = m_listSkillTarget;
            if (m_listSkillTarget.Count > 0)
            {
                Life life = m_listSkillTarget[0];
                Role role = life as Role;
                if (role != null)
                {
                    role.ReBorn();
                }
            }
        }
        else if (m_godskill.m_action == 3)
        {
            CreatePet(m_godskill.m_power, m_targetg);
        }
        //NGUIUtil.DebugLog("name = " + ltarget[0].transform.name + " hp =" + ltarget[0].HP);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 技能释放
    /// </summary>
    /// <param name="Attack">技能释放者</param>
    /// <param name="Defense">受击者</param>
    /// <param name="DefenseAction">防守方,攻击处于的状态</param>
    /// <returns>技能伤害值</returns>
    public SkillReleaseInfo SkillRelease(Life Attack, Life Defense, GridActionCmd DefenseAction, SkillInfo skill)
    {
        //异常处理
        AttackResult     Result = AttackResult.Normal;
        SkillReleaseInfo Info   = new SkillReleaseInfo();

        Info.m_InterruptSkill = false;
        Info.m_MakeStatus     = new List <StatusType> ();
        Info.m_bImmunity      = false;
        Info.m_Damage         = 0;
        Info.m_struckeffect   = "";
        Info.Result           = AttackResult.Normal;
        Info.HitAttributeType = skill.m_AttributeType;
        if (Attack == null || Defense == null || skill == null)
        {
            Debug.Log(Attack + "," + Defense + "," + skill.m_name);
            return(Info);
        }
        if (Defense is Role && (Defense as Role).NoDie)
        {
            return(Info);
        }
        //处于攻击中(过了前要阶段)

        /*if(DefenseAction != null && DefenseAction is GridActionCmdAttack)
         * {
         *      if((DefenseAction as GridActionCmdAttack).IsPlayed() == true)
         *      return Info;
         * }*/
        Info.HitType        = (AttackType)skill.m_attacktype;
        Info.m_struckeffect = skill.m_struckeffect;
        //判断是否技能免疫 ,免疫技能不受到伤害及状态。
        AttackType Type = (AttackType)skill.m_attacktype;
        bool       ret  = ImmunitySkill(Type, skill.m_type, Defense.m_Status);

        if (ret == true)
        {
            Info.m_bImmunity = true;
            Info.Result      = AttackResult.Immunity;
            return(Info);
        }
        //根据m_interrupt_skill 判断受击方技能是否打断
        if (skill.m_interrupt_skill == 1)
        {
            if (skill is SoldierSkill)
            {
                float random = Random.Range(0, 1f);
                if (Defense.m_Attr.Level <= (skill as SoldierSkill).m_rankslevel || random <= (skill as SoldierSkill).m_status_hitratio)
                {
                    Info.m_InterruptSkill = true;
                }
            }
            else
            {
                Info.m_InterruptSkill = true;
            }
        }

        if (Attack.m_Attr == null || Defense.m_Attr == null)
        {
            return(Info);
        }
        //计算技能伤害
        int Damage  = 0;
        int regenhp = 0;

        if (Attack.m_Core.m_Camp == Defense.m_Core.m_Camp)
        {
            regenhp = CalcSkillRegenHP(Attack.m_Attr, Defense.m_Attr, ref Result, skill);
        }
        else
        {
            Damage = CalcSkillDamage(Attack.m_Attr, Defense.m_Attr, ref Result, skill);
        }
        Damage = CalcDistanInfo(Attack.m_Attr, Defense.m_Attr, Damage);
        Damage = CalcAttributableSkillDamage(skill.m_AttributeType, Defense.m_Attr, Damage);
        //计算技能治疗量
        //盾抵抗伤害
        if (Defense.m_Status != null)
        {
            Damage = Damage - Defense.m_Status.ReduceHpbyShield((AttackType)skill.m_attacktype, Damage);
        }
        //miss 不产生状态
        if (Result == AttackResult.Miss)
        {
            Info.Result = AttackResult.Miss;
            return(Info);
        }
        else if (Result == AttackResult.Crit)
        {
            Info.Result = AttackResult.Crit;
        }

        if ((Defense.m_Attr.Hp - Damage) > 0)
        {
            //产生debuff,根据ememy_status,判断debuff中是包含打断技能状态
            if (StatusDeBuff(Defense, skill) == true)
            {
                Info.m_InterruptSkill = true;
            }
            //魅惑状态下的BUFF效果无效
            if (!Attack.m_Attr.Charmed && StatusBuff(Defense, skill) == true)
            {
                Info.m_InterruptSkill = true;
            }
            if (Defense is Building)
            {
                StatusBuildDeBuff(Defense);
            }
        }



        //else Damage = Defense.HP;
        //判断受击方受到的伤害值,是否大于可被打断伤害值。
        int LimitHp = Defense.m_Attr.Hp * ConfigM.GetSkillData0() / 100;

        if (Damage > LimitHp)
        {
            Info.m_InterruptSkill = true;
        }
        if (Attack.m_Attr.Vampire > 0)
        {
            int vampriehp = CalcVampireHP(Attack.m_Attr, Damage);
            Attack.HP += vampriehp;
            Attack.StatusUpdateHp(vampriehp);
        }

        if (Attack.m_Core.m_Camp == Defense.m_Core.m_Camp)
        {
            Info.m_Damage = regenhp;
        }
        else
        {
            Info.m_Damage = -Damage;
        }

        return(Info);
    }