示例#1
0
        public void CalcLevelCurveStatus(int rank, ref BaseStatus result, UnitParam.Status ini_status, UnitParam.Status max_status)
        {
            int num1 = this.GetLevelCap() - 1;
            int num2 = rank - 1;

            result.bonus.Clear();
            result.enchant_assist.Clear();
            result.enchant_resist.Clear();
            result.element_assist.Clear();
            result.element_resist.Clear();
            ini_status.param.CopyTo(result.param);
            if (ini_status.enchant_resist != null)
            {
                ini_status.enchant_resist.CopyTo(result.enchant_resist);
            }
            if (num2 < 1 || num1 < 1)
            {
                return;
            }
            if (num2 >= num1)
            {
                max_status.param.CopyTo(result.param);
                if (max_status.enchant_resist == null)
                {
                    return;
                }
                max_status.enchant_resist.CopyTo(result.enchant_resist);
            }
            else
            {
                BaseStatus baseStatus1 = new BaseStatus();
                BaseStatus baseStatus2 = new BaseStatus();
                for (int index1 = 0; index1 < this.curve.Count; ++index1)
                {
                    long num3 = (long)((int)this.curve[index1].lv - 1);
                    for (int index2 = index1; index2 > 0; --index2)
                    {
                        num3 -= (long)(int)this.curve[index2 - 1].lv;
                    }
                    long        num4         = (long)num2 >= num3 ? num3 : (long)num2;
                    StatusParam statusParam1 = ini_status.param;
                    StatusParam statusParam2 = max_status.param;
                    StatusParam src          = this.curve[index1].status.param;
                    src.CopyTo(baseStatus1.param);
                    baseStatus1.param.Sub(baseStatus2.param);
                    baseStatus2.param.Add(src);
                    for (int index2 = 0; index2 < baseStatus1.param.Length; ++index2)
                    {
                        long num5 = (long)(((int)statusParam2[(StatusTypes)index2] - (int)statusParam1[(StatusTypes)index2]) * (int)baseStatus1.param[(StatusTypes)index2] / 100);
                        if (num5 != 0L)
                        {
                            StatusParam statusParam3;
                            StatusTypes index3;
                            (statusParam3 = result.param)[index3 = (StatusTypes)index2] = (OInt)((int)statusParam3[index3] + (int)(100000L * num5 / num3 * num4 / 100000L));
                        }
                    }
                    if (ini_status.enchant_resist != null && max_status.enchant_resist != null)
                    {
                        EnchantParam enchantResist1 = ini_status.enchant_resist;
                        EnchantParam enchantResist2 = max_status.enchant_resist;
                        EnchantParam enchantResist3 = this.curve[index1].status.enchant_resist;
                        enchantResist3.CopyTo(baseStatus1.enchant_resist);
                        baseStatus1.enchant_resist.Sub(baseStatus2.enchant_resist);
                        baseStatus2.enchant_resist.Add(enchantResist3);
                        for (int index2 = 0; index2 < baseStatus1.enchant_resist.values.Length; ++index2)
                        {
                            long num5 = (long)(((int)enchantResist2.values[index2] - (int)enchantResist1.values[index2]) * (int)baseStatus1.enchant_resist.values[index2] / 100);
                            if (num5 != 0L)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                OShort& local = @result.enchant_resist.values[index2];
示例#2
0
 public bool Deserialize(JSON_UnitParam json)
 {
     if (json == null)
     {
         return(false);
     }
     this.iname    = json.iname;
     this.name     = json.name;
     this.model    = json.mdl;
     this.grow     = (OString)json.grow;
     this.piece    = json.piece;
     this.birth    = (OString)json.birth;
     this.birthID  = json.birth_id;
     this.ability  = json.ability;
     this.ma_quest = json.ma_quest;
     this.sex      = (ESex)json.sex;
     this.rare     = (byte)json.rare;
     this.raremax  = (byte)json.raremax;
     this.type     = (EUnitType)json.type;
     this.element  = (EElement)json.elem;
     this.flag.Set(0, json.hero != 0);
     this.search = (byte)json.search;
     this.flag.Set(1, json.notsmn == 0);
     if (!string.IsNullOrEmpty(json.available_at))
     {
         try
         {
             this.available_at = DateTime.Parse(json.available_at);
         }
         catch
         {
             this.available_at = DateTime.MaxValue;
         }
     }
     this.height       = (short)json.height;
     this.weight       = (short)json.weight;
     this.jobsets      = (string[])null;
     this.mJobSetCache = (JobSetParam[])null;
     this.tags         = (string[])null;
     if (json.skins != null && json.skins.Length >= 1)
     {
         this.skins = new string[json.skins.Length];
         for (int index = 0; index < json.skins.Length; ++index)
         {
             this.skins[index] = json.skins[index];
         }
     }
     if (UnitParam.NoJobStatus.IsExistParam(json))
     {
         this.no_job_status = new UnitParam.NoJobStatus();
         this.no_job_status.SetParam(json);
     }
     if (this.type == EUnitType.EventUnit)
     {
         return(true);
     }
     if (json.jobsets != null)
     {
         this.jobsets = new string[json.jobsets.Length];
         for (int index = 0; index < this.jobsets.Length; ++index)
         {
             this.jobsets[index] = json.jobsets[index];
         }
     }
     if (json.tag != null)
     {
         this.tags = json.tag.Split(',');
     }
     if (this.ini_status == null)
     {
         this.ini_status = new UnitParam.Status();
     }
     this.ini_status.SetParamIni(json);
     this.ini_status.SetEnchentParamIni(json);
     if (this.max_status == null)
     {
         this.max_status = new UnitParam.Status();
     }
     this.max_status.SetParamMax(json);
     this.max_status.SetEnchentParamMax(json);
     this.leader_skills[0] = json.ls1;
     this.leader_skills[1] = json.ls2;
     this.leader_skills[2] = json.ls3;
     this.leader_skills[3] = json.ls4;
     this.leader_skills[4] = json.ls5;
     this.leader_skills[5] = json.ls6;
     this.recipes[0]       = json.recipe1;
     this.recipes[1]       = json.recipe2;
     this.recipes[2]       = json.recipe3;
     this.recipes[3]       = json.recipe4;
     this.recipes[4]       = json.recipe5;
     this.recipes[5]       = json.recipe6;
     this.image            = json.img;
     this.voice            = json.vce;
     this.flag.Set(2, json.no_trw == 0);
     this.flag.Set(3, json.no_kb == 0);
     this.unlock_time = json.unlck_t;
     return(true);
 }