Ejemplo n.º 1
0
 //受伤
 public void GetHurt(RangeDamageCount.AttackResult result)
 {
     health -= result.healthNumber;
     if (health <= 0)
     {
         Die();
     }
 }
Ejemplo n.º 2
0
        //计算伤害
        public static AttackResult CountDamge(SkillData skill, UnitData target)
        {
            AttackResult result = new AttackResult();

            result.resultType = IsDodge(skill, target) ? AttackResult.ResultType.miss : result.resultType;//是否闪避
            if (result.resultType == AttackResult.ResultType.miss)
            {
                return(result);
            }

            result.resultType = IsCritical(skill, result) ? AttackResult.ResultType.critical : result.resultType;       //是否暴击

            result.healthNumber = Mathf.Max(1, skill.uniData.mAttData.GetAttValue(0) - target.mAttData.GetAttValue(1)); //伤害 = 攻击-防御.最少造成1点伤害

            if (result.resultType == AttackResult.ResultType.critical)
            {
                result.healthNumber *= 2;
            }

            return(result);
        }
Ejemplo n.º 3
0
        static bool IsCritical(SkillData skill, AttackResult result)
        {
            int critcal = skill.uniData.mAttData.GetAttValue(9);

            return(Random.Range(0, 100) <= critcal ? true : false);
        }