Пример #1
0
        public float GetPower()
        {
            if (m_pSkillData == null)
            {
                return(0);
            }

            float fValue = m_SkillAValue.GetFloatValue(SkillAValueDefine.ad_skill_p);

            //计算攻击
            if (m_pSkillData.IsCalculationAtk())
            {
                fValue += Mathf.Max(m_CasterAValue.GetFloatValue(AvatarAValueDefine.atk_d)
                                    * (1 + (float)m_CasterAValue.GetPercentValue(AvatarAValueDefine.atk_d_r)), 1);
            }
            return(fValue);
        }
Пример #2
0
 public double GetPercentValue(AvatarAValueDefine define)
 {
     return(m_AValue.GetPercentValue(define));
 }
Пример #3
0
        //伤害结算
        public void CalculationDamage(ref int nEffectType, ref float fEffectValue)
        {
            if (m_pSkillData == null || !m_pCaster || !m_pTarget)
            {
                return;
            }

            //命中判断
            DecisionOnHit(ref nEffectType);
            if ((nEffectType & (int)eTriggerNotify.TriggerNotify_Hit) <= 0)
            {
                return;
            }

            //会心判断
            DecisionOnDamageCrit(ref nEffectType);

            float fAtkPower = GetPower();

            //计算护甲
            //if(m_pSkillData->IsCalculationAC())
            {
                float fAc = m_TargetAValue.GetFloatValue(AvatarAValueDefine.d_ac) *
                            (1 + (float)m_TargetAValue.GetPercentValue(AvatarAValueDefine.d_ac_r));
                if (fAc > 0 && fAtkPower > 0)
                {
                    fAtkPower = fAtkPower * (1 - fAc / (fAc + fAtkPower));
                }
            }

            //if((nEffectType & (int)eTriggerNotify.TriggerNotify_Crit) > 0)
            //{
            //	float MIN_K_DHCR = 0;
            //	float MAX_K_DHCR = 1;
            //	float fDHCR = MIN(MAX(m_CasterAValue.Values[dhcr] - m_TargetAValue.Values[be_dhcr], MIN_K_DHCR), MAX_K_DHCR);
            //	fAtkPower *= (1.5 + fDHCR);
            //}

            //f32 fDDR = 0;
            ////计算伤增/伤减
            //if(m_pSkillData->IsCalculationDR())
            //{
            //	f32 MIN_K_DDR = -1.0f;
            //	f32 MAX_K_DDR = 1.0f;
            //	fDDR = m_CasterAValue.Values[dr] - m_TargetAValue.Values[cdr];
            //	fDDR = MIN(MAX(fDDR, MIN_K_DDR), MAX_K_DDR);
            //}

            float fDamage = fAtkPower * (float)m_SkillAValue.GetPercentValue(SkillAValueDefine.ad_skill_r);
            //float fDamageDM = 0.0f; //计算真实伤害
            //if(m_pSkillData->IsCalculationDM())
            //{
            //	fDamageDM = MAX(m_CasterAValue.Values[dm] - m_TargetAValue.Values[da], 0);
            //}

            float fDFR         = 0.1f;
            float fRandom      = Random.Range(1 - fDFR, 1 + fDFR);
            float fTotalDamage = Mathf.Max(0, fDamage * fRandom);

            ModifyCalculation pModifyCal;

            pModifyCal        = ReferencePool.Acquire <ModifyCalculation>();
            pModifyCal.type   = eTriggerNotifyType.NotifyType_MakeDamage;
            pModifyCal.fValue = fTotalDamage;
            //造成的伤害
            if (m_pCaster.SkillCom)
            {
                m_pCaster.SkillCom.PushTriggerNotifyEffect(m_pSkillData.Id, m_pTarget.Id,
                                                           (int)eTriggerNotifyType.NotifyType_MakeDamage, nEffectType, pModifyCal);
            }
            ReferencePool.Release(pModifyCal);

            pModifyCal        = ReferencePool.Acquire <ModifyCalculation>();
            pModifyCal.type   = eTriggerNotifyType.NotifyType_TakeDamage;
            pModifyCal.fValue = fTotalDamage;
            //承受的伤害
            if (m_pTarget.SkillCom)
            {
                m_pTarget.SkillCom.PushTriggerNotifyEffect(m_pSkillData.Id, m_pCaster.Id,
                                                           (int)eTriggerNotifyType.NotifyType_TakeDamage, nEffectType, pModifyCal);
            }
            ReferencePool.Release(pModifyCal);

            if (fTotalDamage >= 1.0f)
            {
                fEffectValue = fTotalDamage;
                m_pTarget.SetDamage(m_pCaster.Id, fEffectValue);
            }
        }