1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384 |
- using Newtonsoft.Json.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- /// <summary>
- /// 言灵容器
- /// </summary>
- public class GameCollectYanling
- {
- /// <summary>
- /// 言灵集合
- /// </summary>
- public Dictionary<int, UserYanlingVo> items = new Dictionary<int, UserYanlingVo>();
- /// <summary>
- /// 言灵记录
- /// </summary>
- public List<string> yanlingRecord = new List<string>();
- /// <summary>
- /// 查询当前英雄可用的言灵列表
- /// </summary>
- /// <param name="heroTypeid"></param>
- /// <returns></returns>
- public List<UserYanlingVo> FindUseableYanlings(int heroTypeid)
- {
- var li = new List<UserYanlingVo>();
- foreach (var kv in items)
- {
- var mo = sm_item_yanling.GetMoById(int.Parse(kv.Value.typeId));
- if (null != mo)
- {
- if (mo.CanbeUsedForHero(heroTypeid))
- {
- li.Add(kv.Value);
- }
- }
- }
- return li;
- }
- /// <summary>
- /// 初始化言灵数据
- /// </summary>
- /// <param name="store"></param>
- public void InitItemData(JObject store)
- {
- if (store["yanling"] != null)
- {
- // {uid:{typeId:"",level:x,...},uid:{...},...}
- items = store["yanling"].ToObject<Dictionary<int, UserYanlingVo>>();
- foreach (var kv in items)
- {
- kv.Value.uid = kv.Key.ToString();
- }
- }
- if (store["yanlingRecord"] != null)
- {
- this.yanlingRecord.Clear();
- JArray arr = JArray.Parse(store["yanlingRecord"].ToString());
- foreach (JToken id in arr)
- {
- this.yanlingRecord.Add(id.ToString());
- }
- }
- }
- }
- /// <summary>
- /// 玩家言灵数据结构
- /// </summary>
- public class UserYanlingVo : ItemVo
- {
- /// <summary>
- /// 模板id
- /// </summary>
- //public int typeId;
- /// <summary>
- /// 装备此言灵的英雄的id, 默认0
- /// </summary>
- public int herouid;
- // todo: 其它字段带补充(后期加入强化后 --王刚2020年1月2日14:13:59)
- /// <summary>
- /// 当前等阶 2020.7.29 刘海要求改为0 20220512
- /// </summary>
- public int grade = 0;
- /// <summary>
- /// 等级
- /// </summary>
- public int level;
- /// <summary>
- /// 言灵星级
- /// </summary>
- public int starLv;
- /// <summary>
- /// 言灵当前经验
- /// </summary>
- public int exp;
- /// <summary>
- /// 镶嵌的宝石--没有镶嵌默认为0
- /// </summary>
- public int gemId;
- /// <summary>
- /// 升下一等级的经验
- /// </summary>
- public int nextExp
- {
- get
- {
- if (this.starLimitLv == this.level)
- {
- return exp;
- }
- var mo = GameConfigData.Ins.GetyanlingLevel_typeMo(sm_item_base.GetMoById(int.Parse(this.typeId)).quality, this.level + 1);
- if (mo != null)
- {
- return mo.requiredExp;
- }
- var lastMo = GameConfigData.Ins.GetyanlingLevel_typeMo(sm_item_base.GetMoById(int.Parse(this.typeId)).quality, this.level);
- if (lastMo != null)
- {
- return mo.requiredExp;
- }
- return 0;
- }
- }
- /// <summary>
- /// 当前星级限制的等级
- /// </summary>
- public int starLimitLv
- {
- get
- {
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv);
- if (mo == null)
- {
- return 0;
- }
- return mo.promoteLv;
- }
- }
- /// <summary>
- /// 突破的玩家等级限制
- /// </summary>
- public int userLimitLv
- {
- get
- {
- if (this.starLv >= 5)
- {
- return 0;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv + 1);
- return mo.userlvLimit;
- }
- }
- /// <summary>
- /// 突破后的星级等级限制
- /// </summary>
- public int lastStarLimitLv_Tupo
- {
- get
- {
- if (this.starLv >= 5)
- {
- return 0;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv + 1);
- if (mo == null)
- {
- return 0;
- }
- return mo.promoteLv;
- }
- }
- /// <summary>
- /// 是不是升级按钮 true:是
- /// </summary>
- public bool isUpgrade
- {
- get
- {
- if (this.starLv >= 5)
- {
- return true;
- }
- //&& UserProxy.Instance.player.baseInfo.level >= sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).userlvLimit
- if (this.level >= this.starLimitLv)
- {
- return false;
- }
- return true;
- }
- }
- /// <summary>
- /// 升级需要的材料道具
- /// </summary>
- public List<ItemVo> costItem_Upgrade
- {
- get
- {
- List<ItemVo> list = new List<ItemVo>();
- if (this.starLv >= 5)
- {
- return list;
- }
- List<sm_item_stones_type> stonelist = sm_item_stones_type.getItemStoneList(Enum_CostItemStonesType.YanLing);
- if (stonelist.Count == 0)
- {
- return list;
- }
- Dictionary<string, ItemVo> collectItemDic = UserProxy.Instance.player.collectItem.collectItemDic;
- foreach (sm_item_stones_type item in stonelist)
- {
- string typeId = item.typeId.ToString();
- foreach (KeyValuePair<string, ItemVo> kv in collectItemDic)
- {
- if (kv.Value.typeId == typeId)
- {
- ItemVo itVo = new ItemVo();
- itVo.typeId = typeId;
- itVo.count = kv.Value.count;
- list.Add(itVo);
- }
- }
- }
- return list;
- }
- }
- /// <summary>
- /// 消耗的道具----突破
- /// </summary>
- public List<ItemVo> costItem_tupo
- {
- get
- {
- List<ItemVo> list = new List<ItemVo>();
- if (this.starLv >= 5)
- {
- return list;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv + 1);
- string[] sList = mo.costItems.Split(';');
- foreach (string item in sList)
- {
- string[] str = item.Split(',');
- ItemVo vo = new ItemVo();
- vo.typeId = str[0];
- vo.count = int.Parse(str[1]);
- list.Add(vo);
- }
- return list;
- }
- }
- /// <summary>
- /// 当前星级经验
- /// </summary>
- public int curStarExp;
- /// <summary>
- /// 当前星升下一星需要的最大经验------------------废弃
- /// </summary>
- public int maxStarExp
- {
- get
- {
- return sm_item_yanling.GetMoById(int.Parse(this.typeId)).maxStarExp;
- }
- }
- public int costGold_tupo
- {
- get
- {
- if (this.starLv >= 5)
- {
- return 0;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv + 1);
- return mo.gold;
- }
- }
- /// <summary>
- /// 战力
- /// </summary>
- public int fightPower
- {
- get
- {
- float power = 0;
- Dictionary<EHeroProperties, int> baseAttr = this.baseAttr;
- Dictionary<EHeroAddProperties, int> rAttr = this.randAttr;
- Dictionary<EHeroAddProperties, int> gRandAttr = this.gemrRandAttr;
- List<yanlingComposeDataVo> ylComposeAttr = this.yanlingComposeAttr;
- foreach (KeyValuePair<EHeroProperties,int>kv in baseAttr)
- {
- int add = 0;
- if (kv.Key == EHeroProperties.HP)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_hpUpperlimit))
- {
- add += rAttr[EHeroAddProperties.additional_hpUpperlimit];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_hpUpperlimit))
- {
- add += gRandAttr[EHeroAddProperties.additional_hpUpperlimit];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_hpUpperlimit)
- {
- add += vo.val;
- }
- }
- }
-
- }
- else if (kv.Key == EHeroProperties.NENGLIANGZHI)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_manaUpperlimit))
- {
- add += rAttr[EHeroAddProperties.additional_manaUpperlimit];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_manaUpperlimit))
- {
- add += gRandAttr[EHeroAddProperties.additional_manaUpperlimit];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_manaUpperlimit)
- {
- add += vo.val;
- }
- }
- }
- }
- else if (kv.Key == EHeroProperties.WULIGONGJI)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_phyDamage))
- {
- add += rAttr[EHeroAddProperties.additional_phyDamage];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_phyDamage))
- {
- add += gRandAttr[EHeroAddProperties.additional_phyDamage];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_phyDamage)
- {
- add += vo.val;
- }
- }
- }
- }
- else if (kv.Key == EHeroProperties.FANGYUHUJIA)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_phyDefend))
- {
- add += rAttr[EHeroAddProperties.additional_phyDefend];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_phyDefend))
- {
- add += gRandAttr[EHeroAddProperties.additional_phyDefend];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_phyDefend)
- {
- add += vo.val;
- }
- }
- }
- }
- else if (kv.Key == EHeroProperties.CRICITAL)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_critDamage))
- {
- add += rAttr[EHeroAddProperties.additional_critDamage];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_critDamage))
- {
- add += gRandAttr[EHeroAddProperties.additional_critDamage];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_critDamage)
- {
- add += vo.val;
- }
- }
- }
- }
- else if (kv.Key == EHeroProperties.FASHUQIANGDU)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_magDamage))
- {
- add += rAttr[EHeroAddProperties.additional_magDamage];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_magDamage))
- {
- add += gRandAttr[EHeroAddProperties.additional_magDamage];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_magDamage)
- {
- add += vo.val;
- }
- }
- }
- }
- else if (kv.Key == EHeroProperties.MOFAKANGXING)
- {
- if (rAttr.ContainsKey(EHeroAddProperties.additional_magDefend))
- {
- add += rAttr[EHeroAddProperties.additional_magDefend];
- }
- if (gRandAttr.ContainsKey(EHeroAddProperties.additional_magDefend))
- {
- add += gRandAttr[EHeroAddProperties.additional_magDefend];
- }
- if (ylComposeAttr.Count != 0)
- {
- foreach (yanlingComposeDataVo vo in ylComposeAttr)
- {
- if (vo.isShow == false)
- {
- continue;
- }
- if (vo.attr == EHeroAddProperties.additional_magDefend)
- {
- add += vo.val;
- }
- }
- }
- }
- power += 1.0f * add / 100 * kv.Value + kv.Value;
- }
- //sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv);
- //生命
- //int hp = mo.hp + (this.level - 1) * mo.hpRate;
-
- //暴击
- //int crit = mo.baoji + (this.level - 1) * mo.baojiRate;
- //物理攻击
- //int phyAtk = mo.wuligongji + (this.level - 1) * mo.wuligongjiRate;
- //防御护甲
- //int phyDef = mo.fangyuhujia + (this.level - 1) * mo.fangyuhujiaRate;
- //攻击速度
- //int atkSpeed = mo.gongjisudu + (this.level - 1) * mo.gongjisuduRate;
- //法术强度
- //int fashuqiangdu = mo.fashuqiangdu + (this.level - 1) * mo.fashuqiangduRate;
- //魔法抗性
- //int mofakangxing = mo.mofakangxing + (this.level - 1) * mo.mofakangxingRate;
- ////生命
- //int hp = this.Mo().GetYanlingExt().hpBase + (this.level - 1) * this.Mo().GetYanlingExt().hpRate;
- ////暴击
- //int crit = this.Mo().GetYanlingExt().critBase + (this.level - 1) * this.Mo().GetYanlingExt().critRate;
- ////物理攻击
- //int phyAtk = this.Mo().GetYanlingExt().phyAtkBase + (this.level - 1) * this.Mo().GetYanlingExt().phyAtkRate;
- ////防御护甲
- //int phyDef = this.Mo().GetYanlingExt().phyDefBase + (this.level - 1) * this.Mo().GetYanlingExt().phyDefRate;
- ////攻击速度
- //int atkSpeed = this.Mo().GetYanlingExt().atkSpeedBase + (this.level - 1) * this.Mo().GetYanlingExt().atkSpeedRate;
- ////法术强度
- //int fashuqiangdu = this.Mo().GetYanlingExt().fashuqiangduBase + (this.level - 1) * this.Mo().GetYanlingExt().fashuqiangduRate;
- ////魔法抗性
- //int mofakangxing = this.Mo().GetYanlingExt().mofakangxingBase + (this.level - 1) * this.Mo().GetYanlingExt().mofakangxingRate;
- return (int)power;
- }
- }
- /// <summary>
- /// 基础属性---总览属性,升级
- /// </summary>
- public Dictionary<EHeroProperties, int> baseAttr
- {
- get
- {
- Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv);
- //生命
- int hp = mo.hp + (this.level - 1) * mo.hpRate;
- if (hp != 0)
- {
- attr[EHeroProperties.HP] = hp;
- }
- //Mp 能量值
- int nengliangzhi = mo.nengliangzhi + (this.level - 1) * mo.nengliangzhiRate;
- if (nengliangzhi != 0)
- {
- attr[EHeroProperties.NENGLIANGZHI] = nengliangzhi;
- }
-
- //物理攻击
- int phyAtk = mo.wuligongji + (this.level - 1) * mo.wuligongjiRate;
- if (phyAtk != 0)
- {
- attr[EHeroProperties.WULIGONGJI] = phyAtk;
- }
- //防御护甲
- int phyDef = mo.fangyuhujia + (this.level - 1) * mo.fangyuhujiaRate;
- if (phyDef != 0)
- {
- attr[EHeroProperties.FANGYUHUJIA] = phyDef;
- }
- ////攻击速度
- //int atkSpeed = mo.gongjisudu + (this.level - 1) * mo.gongjisuduRate;
- //if (atkSpeed != 0)
- //{
- // attr[EHeroProperties.ATKSPEED] = atkSpeed;
- //}
- //法术强度
- int fashuqiangdu = mo.fashuqiangdu + (this.level - 1) * mo.fashuqiangduRate;
- if (fashuqiangdu != 0)
- {
- attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
- }
- //魔法抗性
- int mofakangxing = mo.mofakangxing + (this.level - 1) * mo.mofakangxingRate;
- if (mofakangxing != 0)
- {
- attr[EHeroProperties.MOFAKANGXING] = mofakangxing;
- }
- //暴击
- int crit = mo.baoji + (this.level - 1) * mo.baojiRate;
- if (crit != 0)
- {
- attr[EHeroProperties.CRICITAL] = crit;
- }
- //抗暴击
- int kangbaoji = mo.kangbaoji + (this.level - 1) * mo.kangbaojiRate;
- if (kangbaoji != 0)
- {
- attr[EHeroProperties.KANGBAOJI] = kangbaoji;
- }
- //言力
- int yanli = mo.yanli + (this.level - 1) * mo.yanliRate;
- if (yanli != 0)
- {
- attr[EHeroProperties.YANLI] = yanli;
- }
- return attr;
- //生命
- //int hp = this.Mo().GetYanlingExt().hpBase + (this.level - 1) * this.Mo().GetYanlingExt().hpRate;
- ////float addHp = hp + hp * (1.0f*this.Mo().GetYanlingExt().additional_hpUpperlimit/100);
- //if (hp != 0)
- //{
- // attr[EHeroProperties.HP] = hp;
- //}
- ////暴击
- //int crit = this.Mo().GetYanlingExt().critBase + (this.level - 1) * this.Mo().GetYanlingExt().critRate;
- ////float addCrit = crit + crit * 1.0f * this.Mo().GetYanlingExt().additional_critDamage/100;
- //if (crit != 0)
- //{
- // attr[EHeroProperties.CRICITAL] = crit;
- //}
- ////物理攻击
- //int phyAtk = this.Mo().GetYanlingExt().phyAtkBase + (this.level - 1) * this.Mo().GetYanlingExt().phyAtkRate;
- ////float addPhyAtk = phyAtk + phyAtk * 1.0f * this.Mo().GetYanlingExt().additional_phyDamage/100;
- //if (phyAtk != 0)
- //{
- // attr[EHeroProperties.WULIGONGJI] = phyAtk;
- //}
- ////防御护甲
- //int phyDef = this.Mo().GetYanlingExt().phyDefBase + (this.level - 1) * this.Mo().GetYanlingExt().phyDefRate;
- ////float addPhyDef = phyDef + phyDef * 1.0f * this.Mo().GetYanlingExt().additional_phyDefend/100;
- //if (phyDef != 0)
- //{
- // attr[EHeroProperties.FANGYUHUJIA] = phyDef;
- //}
- ////攻击速度
- //int atkSpeed = this.Mo().GetYanlingExt().atkSpeedBase + (this.level - 1) * this.Mo().GetYanlingExt().atkSpeedRate;
- ////float addAtkSpeed = atkSpeed + atkSpeed * 1.0f * this.Mo().GetYanlingExt().additional_atkSpeed/100;
- //if (atkSpeed != 0)
- //{
- // attr[EHeroProperties.ATKSPEED] = atkSpeed;
- //}
- ////法术强度
- //int fashuqiangdu = this.Mo().GetYanlingExt().fashuqiangduBase + (this.level - 1) * this.Mo().GetYanlingExt().fashuqiangduRate;
- //if (fashuqiangdu != 0)
- //{
- // attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
- //}
- ////魔法抗性
- //int mofakangxing = this.Mo().GetYanlingExt().mofakangxingBase + (this.level - 1) * this.Mo().GetYanlingExt().mofakangxingRate;
- //if (mofakangxing != 0)
- //{
- // attr[EHeroProperties.MOFAKANGXING] = mofakangxing;
- //}
- return attr;
- }
- }
- /// <summary>
- /// 随机属性---总览属性,升级
- /// </summary>
- public Dictionary<EHeroAddProperties,int> randAttr
- {
- get
- {
- Dictionary<EHeroAddProperties, int> randAttr = new Dictionary<EHeroAddProperties, int>();
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), this.starLv);
- //hp
- int hpUpperlimit = mo.additional_hpUpperlimit;
- if (hpUpperlimit != 0)
- {
- randAttr[EHeroAddProperties.additional_hpUpperlimit] = hpUpperlimit;
- }
- //言能上限加成----Mp
- int manaUpperlimit = mo.additional_manaUpperlimit;
- if (manaUpperlimit != 0)
- {
- randAttr[EHeroAddProperties.additional_manaUpperlimit] = manaUpperlimit;
- }
- //物攻伤害加成
- int phyDamage = mo.additional_phyDamage;
- if (phyDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDamage] = phyDamage;
- }
- //防御护甲
- int phyDefend = mo.additional_phyDefend;
- if (phyDefend != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDefend] = phyDefend;
- }
- //法术强度
- int magDamage = mo.additional_magDamage;
- if (magDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_magDamage] = magDamage;
- }
- //魔法抗性
- int magDefend = mo.additional_magDefend;
- if (magDefend != 0)
- {
- randAttr[EHeroAddProperties.additional_magDefend] = magDefend;
- }
- //物伤减免加成
- int phyDamagereduce = mo.additional_phyDamagereduce;
- if (phyDamagereduce != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDamagereduce] = phyDamagereduce;
- }
- //言伤减免加成
- int magDamagereduce = mo.additional_magDamagereduce;
- if (magDamagereduce != 0)
- {
- randAttr[EHeroAddProperties.additional_magDamagereduce] = magDamagereduce;
- }
- int monsterExp = mo.additional_monsterExp;
- if (monsterExp != 0)
- {
- randAttr[EHeroAddProperties.additional_monsterExp] = monsterExp;
- }
- int atkSpeed = mo.additional_atkSpeed;
- if (atkSpeed != 0)
- {
- randAttr[EHeroAddProperties.additional_atkSpeed] = atkSpeed;
- }
- int moveSpeed = mo.additional_moveSpeed;
- if (moveSpeed != 0)
- {
- randAttr[EHeroAddProperties.additional_moveSpeed] = moveSpeed;
- }
- int critProbability = mo.additional_critProbability;
- if (critProbability != 0)
- {
- randAttr[EHeroAddProperties.additional_critProbability] = critProbability;
- }
- int critDamage = mo.additional_critDamage;
- if (critDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_critDamage] = critDamage;
- }
- return randAttr;
- }
- }
- /// <summary>
- /// 宝石加成
- /// </summary>
- public Dictionary<EHeroAddProperties, int> gemrRandAttr
- {
- get
- {
- Dictionary<EHeroAddProperties, int> randAttr = new Dictionary<EHeroAddProperties, int>();
- if (this.gemId == 0)
- {
- return randAttr;
- }
- sm_gemProperty mo = GameConfigData.Ins.GetgemPropertyMo(this.gemId);
- int additional_hpUpperlimit = mo.additional_hpUpperlimit;
- if (additional_hpUpperlimit != 0)
- {
- randAttr[EHeroAddProperties.additional_hpUpperlimit] = additional_hpUpperlimit;
- }
- int additional_phyDamage = mo.additional_phyDamage;
- if (additional_phyDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDamage] = additional_phyDamage;
- }
- int additional_magDamage = mo.additional_magDamage;
- if (additional_magDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_magDamage] = additional_magDamage;
- }
- int additional_critDamage = mo.additional_critDamage;
- if (additional_critDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_critDamage] = additional_critDamage;
- }
- int skillCoolTs = mo.skillCoolTs;
- if (skillCoolTs != 0)
- {
- randAttr[EHeroAddProperties.skillCoolTs] = skillCoolTs;
- }
- return randAttr;
- }
- }
- /// <summary>
- /// 突破后属性变化值
- /// </summary>
- public Dictionary<EHeroProperties, int> changeAttr
- {
- get
- {
- Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
- int nextStar = this.starLv + 1;
- if (this.starLv >= 5)
- {
- nextStar = 5;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), nextStar);
- //生命
- int hp = mo.hp + (this.level - 1) * mo.hpRate;
- if (hp != 0)
- {
- attr[EHeroProperties.HP] = hp;
- }
- //mp
- int mp = mo.nengliangzhi + (this.level - 1) * mo.nengliangzhiRate;
- if (mp != 0)
- {
- attr[EHeroProperties.NENGLIANGZHI] = mp;
- }
- //物理攻击
- int phyAtk = mo.wuligongji + (this.level - 1) * mo.wuligongjiRate;
- if (phyAtk != 0)
- {
- attr[EHeroProperties.WULIGONGJI] = phyAtk;
- }
- //防御护甲
- int phyDef = mo.fangyuhujia + (this.level - 1) * mo.fangyuhujiaRate;
- if (phyDef != 0)
- {
- attr[EHeroProperties.FANGYUHUJIA] = phyDef;
- }
- //攻击速度
- //int atkSpeed = mo.gongjisudu + (this.level - 1) * mo.gongjisuduRate;
- //if (atkSpeed != 0)
- //{
- // attr[EHeroProperties.ATKSPEED] = atkSpeed;
- //}
- //法术强度
- int fashuqiangdu = mo.fashuqiangdu + (this.level - 1) * mo.fashuqiangduRate;
- if (fashuqiangdu != 0)
- {
- attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
- }
- //魔法抗性
- int mofakangxing = mo.mofakangxing + (this.level - 1) * mo.mofakangxingRate;
- if (mofakangxing != 0)
- {
- attr[EHeroProperties.MOFAKANGXING] = mofakangxing;
- }
- //暴击
- int crit = mo.baoji + (this.level - 1) * mo.baojiRate;
- if (crit != 0)
- {
- attr[EHeroProperties.CRICITAL] = crit;
- }
- //抗暴击
- int kangbaoji = mo.kangbaoji + (this.level - 1) * mo.kangbaojiRate;
- if (kangbaoji != 0)
- {
- attr[EHeroProperties.KANGBAOJI] = kangbaoji;
- }
- //言力
- int yanli = mo.yanli + (this.level - 1) * mo.yanliRate;
- if (yanli != 0)
- {
- attr[EHeroProperties.YANLI] = yanli;
- }
- return attr;
- }
- }
- /// <summary>
- /// 言灵升星前后的属性变化--------废弃
- /// </summary>
- public Dictionary<EHeroProperties, int> addAttr
- {
- get
- {
- Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
- //if (this.starLv >= 5)
- //{
- // return attr;
- //}
- //int nextId = this.Mo().GetYanlingExt().nextId;
- //sm_item_yanling mo = sm_item_yanling.GetMoById(nextId);
- ////生命
- //int hp = this.Mo().GetYanlingExt().hpBase + (this.level - 1) * this.Mo().GetYanlingExt().hpRate;
- //int newhp = mo.hpBase + (this.level - 1) * mo.hpRate;
- //if (newhp - hp != 0)
- //{
- // attr.Add(EHeroProperties.HP, newhp - hp);
- //}
- ////暴击
- //int crit = this.Mo().GetYanlingExt().critBase + (this.level - 1) * this.Mo().GetYanlingExt().critRate;
- //int newcrit = mo.critBase + (this.level - 1) * mo.critRate;
- //if (newcrit - crit != 0)
- //{
- // attr.Add(EHeroProperties.CRICITAL, newcrit - crit);
- //}
- ////物理攻击
- //int phyAtk = this.Mo().GetYanlingExt().phyAtkBase + (this.level - 1) * this.Mo().GetYanlingExt().phyAtkRate;
- //int newphyAtk = mo.phyAtkBase + (this.level - 1) * mo.phyAtkRate;
- //if (newphyAtk - phyAtk != 0)
- //{
- // attr.Add(EHeroProperties.WULIGONGJI, newphyAtk - phyAtk);
- //}
- ////防御护甲
- //int phyDef = this.Mo().GetYanlingExt().phyDefBase + (this.level - 1) * this.Mo().GetYanlingExt().phyDefRate;
- //int newphyDef = mo.phyDefBase + (this.level - 1) * mo.phyDefRate;
- //if (newphyDef - phyDef != 0)
- //{
- // attr.Add(EHeroProperties.FANGYUHUJIA, newphyDef - phyDef);
- //}
- ////攻击速度
- //int atkSpeed = this.Mo().GetYanlingExt().atkSpeedBase + (this.level - 1) * this.Mo().GetYanlingExt().atkSpeedRate;
- //int newatkSpeed = mo.atkSpeedBase + (this.level - 1) * mo.atkSpeedRate;
- //if (newatkSpeed - atkSpeed != 0)
- //{
- // attr.Add(EHeroProperties.ATKSPEED, newatkSpeed - atkSpeed);
- //}
- ////法术强度
- //int fashuqiangdu = this.Mo().GetYanlingExt().fashuqiangduBase + (this.level - 1) * this.Mo().GetYanlingExt().fashuqiangduRate;
- //int newfashuqiangdu = mo.fashuqiangduBase + (this.level - 1) * mo.fashuqiangduRate;
- //if (newfashuqiangdu - fashuqiangdu != 0)
- //{
- // attr.Add(EHeroProperties.FASHUQIANGDU, newfashuqiangdu - fashuqiangdu);
- //}
- ////魔法抗性
- //int mofakangxing = this.Mo().GetYanlingExt().mofakangxingBase + (this.level - 1) * this.Mo().GetYanlingExt().mofakangxingRate;
- //int newmofakangxing = mo.mofakangxingBase + (this.level - 1) * mo.mofakangxingRate;
- //if (newmofakangxing - mofakangxing != 0)
- //{
- // attr.Add(EHeroProperties.MOFAKANGXING, newmofakangxing - mofakangxing);
- //}
- return attr;
- }
- }
- /// <summary>
- /// 突破后随机属性变化值
- /// </summary>
- public Dictionary<EHeroAddProperties, int> randAddAttr
- {
- get
- {
- Dictionary<EHeroAddProperties, int> randAttr = new Dictionary<EHeroAddProperties, int>();
- //if (this.starLv >= 5)
- //{
- // return randAttr;
- //}
- //int nextId = this.Mo().GetYanlingExt().nextId;
- //sm_item_yanling mo = sm_item_yanling.GetMoById(nextId);
- int nextStar = this.starLv + 1;
- if (this.starLv >= 5)
- {
- nextStar = 5;
- }
- sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(this.typeId), nextStar);
- if (mo.additional_hpUpperlimit != 0)
- {
- randAttr[EHeroAddProperties.additional_hpUpperlimit] = mo.additional_hpUpperlimit;
- }
- int manaUpperlimit = mo.additional_manaUpperlimit;
- if (manaUpperlimit != 0)
- {
- randAttr[EHeroAddProperties.additional_manaUpperlimit] = manaUpperlimit;
- }
- int phyDamage = mo.additional_phyDamage;
- if (phyDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDamage] = phyDamage;
- }
- int magDamage = mo.additional_magDamage;
- if (magDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_magDamage] = magDamage;
- }
- int phyDefend = mo.additional_phyDefend;
- if (phyDefend != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDefend] = phyDefend;
- }
- int magDefend = mo.additional_magDefend;
- if (magDefend != 0)
- {
- randAttr[EHeroAddProperties.additional_magDefend] = magDefend;
- }
- int phyDamagereduce = mo.additional_phyDamagereduce;
- if (phyDamagereduce != 0)
- {
- randAttr[EHeroAddProperties.additional_phyDamagereduce] = phyDamagereduce;
- }
- int magDamagereduce = mo.additional_magDamagereduce;
- if (magDamagereduce != 0)
- {
- randAttr[EHeroAddProperties.additional_magDamagereduce] = magDamagereduce;
- }
- int monsterExp = mo.additional_monsterExp;
- if (monsterExp != 0)
- {
- randAttr[EHeroAddProperties.additional_monsterExp] = monsterExp;
- }
- int atkSpeed = mo.additional_atkSpeed;
- if (atkSpeed != 0)
- {
- randAttr[EHeroAddProperties.additional_atkSpeed] = atkSpeed;
- }
- int moveSpeed = mo.additional_moveSpeed;
- if (moveSpeed != 0)
- {
- randAttr[EHeroAddProperties.additional_moveSpeed] = moveSpeed;
- }
- int critProbability = mo.additional_critProbability;
- if (critProbability != 0)
- {
- randAttr[EHeroAddProperties.additional_critProbability] = critProbability;
- }
- int critDamage = mo.additional_critDamage;
- if (critDamage != 0)
- {
- randAttr[EHeroAddProperties.additional_critDamage] = critDamage;
- }
- return randAttr;
- }
- }
- /// <summary>
- /// 言灵套系属性
- /// </summary>
- public List<yanlingComposeDataVo> yanlingComposeAttr
- {
- get
- {
- List<yanlingComposeDataVo> yanlingComposeAttr = new List<yanlingComposeDataVo>();
- int composeId = this.nMo.GetYanlingExt().composeId;
- if (composeId == 0)
- {
- return yanlingComposeAttr;
- }
- sm_yanling_compose mo = GameConfigData.Ins.Getyanling_composeMo(composeId);
- if (mo == null)
- {
- return yanlingComposeAttr;
- }
- int temp = 0;
- if (this.herouid != 0)
- {
- Dictionary<int, UserYanlingVo> hero_yanling = UserProxy.Instance.player.collectHero.collectHeroDic[this.herouid.ToString()].hero_yanling;
- foreach (KeyValuePair<int, UserYanlingVo> kt in hero_yanling)
- {
- if (kt.Value.typeId == null)
- {
- continue;
- }
- int id = kt.Value.nMo.GetYanlingExt().composeId;
- if (id == composeId)
- {
- temp += 1;
- }
- }
- }
-
- string[] twoList = mo.two_compose.Split(',');
- int attrType = int.Parse(twoList[0]);
-
- yanlingComposeDataVo vo = new yanlingComposeDataVo();
- vo.composeId = composeId;
- vo.isShow = false;
- if (temp >= 2)
- {
- vo.isShow = true;
- }
- vo.attr = (EHeroAddProperties)attrType;
- vo.attrName = mo.name;
- vo.desc = mo.two_desc;
- vo.type = int.Parse(twoList[1]);
- vo.val = int.Parse(twoList[2]);
- yanlingComposeAttr.Add(vo);
- string[] threeList = mo.three_compose.Split(',');
- int attrType_3 = int.Parse(threeList[0]);
-
- yanlingComposeDataVo vo_3 = new yanlingComposeDataVo();
- vo_3.composeId = composeId;
- vo_3.isShow = false;
- if (temp >= 3)
- {
- vo_3.isShow = true;
- }
- vo_3.attr = (EHeroAddProperties)attrType_3;
- vo_3.attrName = mo.name;
- vo_3.desc = mo.three_desc;
- vo_3.type = int.Parse(threeList[1]);
- vo_3.val = int.Parse(threeList[2]);
- yanlingComposeAttr.Add(vo_3);
- return yanlingComposeAttr;
- }
- }
- /// <summary>
- /// 1级消耗--------------废弃
- /// </summary>
- public List<ItemVo> singleCostList
- {
- get
- {
- List<ItemVo> list = new List<ItemVo>();
- ItemVo gVo = new ItemVo();
- gVo.typeId = 1.ToString();
- gVo.count = GameConfigData.Ins.GetyanlingLeveMo(this.level).goldCost;
- ItemVo pointVo = new ItemVo();
- pointVo.typeId = 8.ToString();
- pointVo.count = GameConfigData.Ins.GetyanlingLeveMo(this.level).pointCost;
- list.Add(gVo);
- list.Add(pointVo);
- return list;
- }
- }
- /// <summary>
- /// 5级消耗--------------废弃
- /// </summary>
- public List<ItemVo> multiCostList
- {
- get
- {
- int max = this.level + 5;
- Dictionary<int, int> dic = new Dictionary<int, int>();
- for (int i = this.level; i < max; i++)
- {
- if (!GameConfigData.Ins.yanlingLeve.ContainsKey(i))
- {
- break;
- }
- sm_yanlingLeve mo = GameConfigData.Ins.GetyanlingLeveMo(i);
- if (mo == null)
- {
- break;
- }
- string cost = "1,"+mo.goldCost + ";" +"8,"+ mo.pointCost;
- string[] sList = cost.Split(';');
- foreach (string item in sList)
- {
- string[] costList = item.Split(',');
- if (dic.ContainsKey(int.Parse(costList[0])))
- {
- dic[int.Parse(costList[0])] += int.Parse(costList[1]);
- }
- else
- {
- dic[int.Parse(costList[0])] = int.Parse(costList[1]);
- }
- }
- }
- List<ItemVo> list = new List<ItemVo>();
- foreach (KeyValuePair<int, int> kv in dic)
- {
- ItemVo vo = new ItemVo();
- vo.count = kv.Value;
- vo.typeId = kv.Key.ToString();
- list.Add(vo);
- }
- return list;
- }
- }
- /// <summary>
- /// 当前等级是否是最大值 true:是 --------------废弃
- /// </summary>
- public bool isLevelMax
- {
- get
- {
- //Dictionary<int, sm_yanlingLeve> yanlingLeve = GameConfigData.Ins.yanlingLeve;
- //if (this.level >= yanlingLeve.Count)
- //{
- // return true;
- //}
- return false;
- }
- }
- /// <summary>
- /// 获取言灵的Mo(基础数据), 获取扩展数据请继续.GetYanlingExt();
- /// </summary>
- /// <returns></returns>
- public sm_item_base Mo()
- {
- return sm_item_base.GetMoById(int.Parse(this.typeId));
- }
- /// <summary>
- /// 技能id
- /// </summary>
- public sm_skill skillMo
- {
- get
- {
- sm_item_yanling mo = this.nMo.GetYanlingExt();
- if (mo!= null && mo.skill_id != 0)
- {
- return sm_skill.GetMoByID(mo.skill_id);
- }
- return null;
- }
- }
- /// <summary>
- /// 查找言灵技在几级解锁
- /// </summary>
- /// <returns>(等级, 技能id)</returns>
- public (int grade, int skillId) FindSkillId()
- {
- if (CurGrade.skill_id > 0)
- {
- return (grade, CurGrade.skill_id);
- }
- for (var g = grade + 1; g <= 5; g++)
- {
- //var g = this.grade < 5 ? this.grade + 1 : this.grade;
- var mo = sm_yanling_upgrade.GetMo(int.Parse(this.typeId), g);
- if (null != mo && mo.skill_id > 0)
- {
- return (g, mo.skill_id);
- }
- }
- return (0, 0);
- }
- /// <summary>
- /// 前一等阶的数据
- /// </summary>
- public sm_yanling_upgrade PreGrade
- {
- get
- {
- var g = this.grade > 1 ? this.grade - 1 : this.grade;
- return sm_yanling_upgrade.GetMo(int.Parse(this.typeId), g);
- }
- }
- /// <summary>
- /// 当前等阶的数据
- /// </summary>
- public sm_yanling_upgrade CurGrade => sm_yanling_upgrade.GetMo(int.Parse(this.typeId), this.grade);
- /// <summary>
- /// 下一等阶的数据
- /// </summary>
- public sm_yanling_upgrade NextGrade
- {
- get
- {
- var g = this.grade < 5 ? this.grade + 1 : this.grade;
- return sm_yanling_upgrade.GetMo(int.Parse(this.typeId), g);
- }
- }
- }
- public class yanlingComposeDataVo
- {
-
- public int composeId { get; set; }
-
- /// <summary>
- /// 是否高亮显示 true:是
- /// </summary>
- public bool isShow { get; set; }
- /// <summary>
- /// 属性类型
- /// </summary>
- public EHeroAddProperties attr { get; set; }
- /// <summary>
- /// 属性名称
- /// </summary>
- public string attrName { get; set; }
- /// <summary>
- /// 描述信息
- /// </summary>
- public string desc { get; set; }
- /// <summary>
- /// 是数值还是百分比 1:数值;2:百分比
- /// </summary>
- public int type { get; set; }
- /// <summary>
- /// 属性值--百分比
- /// </summary>
- public int val { get; set; }
- }
|