Example #1
0
        private List <DataInfo> GetDataInfos()
        {
            List <DataInfo> list = new List <DataInfo>();

            for (int i = 0; i < this.data.damage_ids.Length; i++)
            {
                DamageData vo = Singleton <DamageDataManager> .Instance.GetVo(this.data.damage_ids[i]);

                if (vo == null)
                {
                    Debug.LogError("没有找到伤害包:错误id" + this.data.damage_ids[i]);
                }
                else if (SkillUtility.DoMoFaMianYi(this.targetUnit, vo))
                {
                    this.targetUnit.jumpFont(JumpFontType.MoFaMianYi, string.Empty, null, true);
                }
                else if (SkillUtility.DoWuDi(this.targetUnit, vo))
                {
                    this.targetUnit.jumpFont(JumpFontType.WuDi, string.Empty, null, true);
                }
                else
                {
                    DataInfo dataInfo = new DataInfo();
                    dataInfo.reverse  = this.isReverse;
                    dataInfo.damageID = this.data.damage_ids[i];
                    if (vo.IsPropertyValue)
                    {
                        dataInfo.key     = vo.property_key;
                        dataInfo.value   = vo.property_value;
                        dataInfo.percent = vo.property_percent;
                        dataInfo.formula = false;
                        list.Add(dataInfo);
                    }
                    else if (vo.IsPropertyFormula)
                    {
                        dataInfo.key     = vo.property_key;
                        dataInfo.value   = FormulaTool.GetFormualValue(vo.property_formula, this.targetUnit);
                        dataInfo.percent = vo.property_percent;
                        dataInfo.formula = true;
                        list.Add(dataInfo);
                    }
                    else
                    {
                        Debug.LogError("DataChange 公式配置错误:既不是IsPropertyValue也不是IsPropertyFormula:错误id" + this.data.damage_ids[i]);
                    }
                }
            }
            return(list);
        }
Example #2
0
 private float GetData(string data)
 {
     string[] stringValue = StringUtils.GetStringValue(data, '|');
     if (stringValue != null)
     {
         int num  = int.Parse(stringValue[0]);
         int num2 = num;
         if (num2 == 1)
         {
             return((stringValue.Length <= 1) ? 0f : float.Parse(stringValue[1]));
         }
         if (num2 == 2)
         {
             int formula_id = (stringValue.Length <= 1) ? 0 : int.Parse(stringValue[1]);
             return(FormulaTool.GetFormualValue(formula_id, this.self.ParentUnit));
         }
     }
     return(0f);
 }
Example #3
0
    private void calculateDamage(Units target, Units casterUnit, int[] damage_ids, out bool crit, out bool miss, bool isJumpFont, out int damageType, out int damageCalType, params float[] extraParams)
    {
        crit          = false;
        miss          = false;
        damageType    = 0;
        damageCalType = 0;
        if (target == null)
        {
            return;
        }
        if (damage_ids == null)
        {
            return;
        }
        for (int i = 0; i < damage_ids.Length; i++)
        {
            int        id = damage_ids[i];
            DamageData vo = Singleton <DamageDataManager> .Instance.GetVo(id);

            if (vo != null)
            {
                if (!SkillUtility.DoMoFaMianYi(target, vo))
                {
                    damageCalType = vo.damageCalType;
                    damageType    = vo.damage_type;
                    int damageCalType2 = vo.damageCalType;
                    switch (damageCalType2)
                    {
                    case 1:
                    {
                        float value       = this.GetAttackDamage(target, casterUnit, vo, out miss, out crit) * -1f;
                        int   debugDamage = GlobalSettings.Instance.PvpSetting.DebugDamage;
                        if (debugDamage != 0)
                        {
                            value = (float)debugDamage;
                        }
                        this.doExtraDCA_Attack(casterUnit, target, ref value);
                        this.AddDataBag(vo.damageId, value);
                        this.AddDamageHP((DamageValueType)vo.damage_type, value);
                        goto IL_53D;
                    }

                    case 2:
                    {
                        float value2 = this.GetSkillDamage(target, casterUnit, vo, out miss, out crit) * -1f;
                        this.AddDataBag(vo.damageId, value2);
                        this.AddDamageHP((DamageValueType)vo.damage_type, value2);
                        goto IL_53D;
                    }

                    case 3:
                    {
                        float skillTreatment = this.GetSkillTreatment(target, casterUnit, vo, out miss, out crit);
                        this.AddDataBag(vo.damageId, skillTreatment);
                        this.AddDamageHP((DamageValueType)vo.damage_type, skillTreatment);
                        goto IL_53D;
                    }

                    case 4:
                    {
                        float    num          = 0f;
                        AttrType property_key = vo.property_key;
                        if (property_key == AttrType.Hp)
                        {
                            float hp_max = target.hp_max;
                            if (vo.property_percent)
                            {
                                num = hp_max * vo.property_value;
                            }
                            else
                            {
                                num = vo.property_value;
                            }
                            this.doDamageCalModifier(target, AttrType.Hp, ref num);
                            this.ClampMinDamage(ref num);
                            this.AddDamageHP(DamageValueType.RealDamage, num);
                        }
                        else if (property_key == AttrType.Mp)
                        {
                            float mp_max = target.mp_max;
                            if (vo.property_percent)
                            {
                                num = mp_max * vo.property_value;
                            }
                            else
                            {
                                num = vo.property_value;
                            }
                            this.doDamageCalModifier(target, AttrType.Mp, ref num);
                            if (isJumpFont)
                            {
                                target.jumpFontValue(AttrType.Mp, num, casterUnit, false, false, 0, 0);
                            }
                            this.AddDamage(property_key, num);
                        }
                        else
                        {
                            float attr = target.GetAttr(vo.property_key);
                            if (vo.property_percent)
                            {
                                num = attr * vo.property_value;
                            }
                            else
                            {
                                num = vo.property_value;
                            }
                            this.AddDamage(property_key, num);
                        }
                        this.AddDataBag(vo.damageId, num);
                        goto IL_53D;
                    }

                    case 5:
                    {
                        float    num2          = 0f;
                        AttrType property_key2 = vo.property_key;
                        float    formualValue  = FormulaTool.GetFormualValue(vo.property_formula, target);
                        if (vo.property_percent)
                        {
                            num2 = formualValue * vo.property_value;
                        }
                        else
                        {
                            num2 = formualValue;
                        }
                        if (property_key2 == AttrType.Hp)
                        {
                            this.doDamageCalModifier(target, AttrType.Hp, ref num2);
                            if (isJumpFont)
                            {
                                target.jumpFontValue(AttrType.Hp, num2, casterUnit, false, false, 0, vo.damage_type);
                            }
                            this.AddDamageHP(DamageValueType.RealDamage, num2);
                        }
                        else if (property_key2 == AttrType.Mp)
                        {
                            this.doDamageCalModifier(target, AttrType.Mp, ref num2);
                            if (isJumpFont)
                            {
                                target.jumpFontValue(AttrType.Mp, num2, casterUnit, false, false, 0, 0);
                            }
                            this.AddDamage(property_key2, num2);
                        }
                        else
                        {
                            this.AddDamage(property_key2, num2);
                        }
                        this.AddDataBag(vo.damageId, num2);
                        goto IL_53D;
                    }

                    case 6:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
IL_C1:
                        switch (damageCalType2)
                        {
                        case 22:
                        {
                            float num3 = vo.damageParam5 - Vector3.Distance(casterUnit.transform.position, target.transform.position);
                            num3 = Mathf.Clamp(num3, 0f, vo.damageParam5);
                            float value3 = -(vo.damageParam4 * num3 * this.GetDistanceBuffDamage(target, casterUnit, vo, out miss, out crit));
                            this.AddDataBag(vo.damageId, value3);
                            this.AddDamageHP((DamageValueType)vo.damage_type, value3);
                            goto IL_53D;
                        }

                        case 23:
                            goto IL_53D;

                        case 24:
                        {
                            float num4 = this.GetSkillDamage(target, casterUnit, vo, out miss, out crit) * -1f;
                            float num5 = 1f;
                            if (extraParams.Length > 0 && extraParams[0] > 0f)
                            {
                                num5 = extraParams[0];
                            }
                            num4 += -num5 * vo.damageParam5;
                            this.AddDataBag(vo.damageId, num4);
                            this.AddDamageHP((DamageValueType)vo.damage_type, num4);
                            goto IL_53D;
                        }

                        default:
                            goto IL_53D;
                        }
                        break;

                    case 13:
                    {
                        bool  flag = (int)vo.damageParam2 != 0;
                        float num6 = 0f;
                        if (flag)
                        {
                            num6 = target.hp * vo.damageParam1;
                        }
                        else
                        {
                            num6 = vo.damageParam1;
                        }
                        this.doDamageCalModifier(target, AttrType.Hp, ref num6);
                        this.AddDataBag(vo.damageId, num6);
                        this.AddDamage(AttrType.Hp, num6);
                        target.jumpFontValue(AttrType.Hp, num6, casterUnit, false, false, 0, vo.damage_type);
                        goto IL_53D;
                    }

                    case 14:
                    {
                        bool  flag2 = (int)vo.damageParam2 != 0;
                        float num7  = 0f;
                        if (flag2)
                        {
                            num7 = target.mp * vo.damageParam1;
                        }
                        else
                        {
                            num7 = vo.damageParam1;
                        }
                        this.doDamageCalModifier(target, AttrType.Mp, ref num7);
                        this.AddDataBag(vo.damageId, num7);
                        this.AddDamage(AttrType.Mp, num7);
                        target.jumpFontValue(AttrType.Mp, num7, casterUnit, false, false, 0, 0);
                        goto IL_53D;
                    }
                    }
                    goto IL_C1;
                }
                target.jumpFont(JumpFontType.MoFaMianYi, string.Empty, null, true);
            }
            IL_53D :;
        }
    }