GameHeroVo.cs 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119
  1. using UnityEngine;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. /// <summary>
  7. /// 角色[游戏数据]
  8. /// </summary>
  9. public class GameHeroVo
  10. {
  11. /// <summary>
  12. /// 是否是我自己的英雄 Ps. 本字段为本地字段,未同步到网络.
  13. /// 是我的= true, 其他人的= false
  14. /// </summary>
  15. public bool IsMyOwnerHero = false;
  16. /// <summary>
  17. /// 唯一ID
  18. /// </summary>
  19. public string uid { get; set; } = "0";
  20. /// <summary>
  21. /// 模板数据id
  22. /// </summary>
  23. public string typeId { get; set; }
  24. /// <summary>
  25. ///当前的经验(角色吃经验丹获得经验从而使level值成长.)
  26. /// </summary>
  27. public int xp { get; set; }
  28. /// <summary>
  29. /// 当前等级进展,累计的总经验
  30. /// </summary>
  31. public int maxXp
  32. {
  33. get
  34. {
  35. if (this.starLimitLv == this.level)
  36. {
  37. return xp;
  38. }
  39. var lvMo = GameConfigData.Ins.Gethero_levelexpMo(this.level + 1);
  40. if (null != lvMo)
  41. {
  42. return lvMo.requiredExp;
  43. }
  44. return GameConfigData.Ins.Gethero_levelexpMo(this.level).requiredExp;
  45. }
  46. }
  47. /// <summary>
  48. /// 当前等级(level值决定了其他属性如hp, phyAtk,等的成长(公式))
  49. /// </summary>
  50. public int level { get; set; } = 1;
  51. /// <summary>
  52. /// 品阶(S A B C D)(品阶可以通过吃碎片成长)
  53. /// </summary>
  54. public string grade { get; set; } = "D";
  55. /// <summary>
  56. /// 武器数据引用
  57. /// </summary>
  58. internal GameCollectEquips EquipRef;
  59. /// <summary>
  60. /// 言灵数据引用
  61. /// </summary>
  62. internal GameCollectYanling YanlingRef;
  63. #region 扩展功能标签
  64. /// <summary>
  65. /// 判断自己是否是队长
  66. /// </summary>
  67. public bool IsTeamLeader => UserProxy.Instance.player.heroTeamConfig.teamDic.Values.ToList().Exists(team => team.CurTeamLeaderUID == this.uid);
  68. /// <summary>
  69. /// 判断自己是否已经有战队了
  70. /// </summary>
  71. public bool IsInTeam => int.Parse(this.uid) > 0 && UserProxy.Instance.player.heroTeamConfig.teamDic.Values.ToList().Exists(team => team.heros.Contains(this.uid));
  72. /// <summary>
  73. /// 是否可升级, 玩家等级限制英雄等级
  74. /// </summary>
  75. /// <returns></returns>
  76. public bool HeroCanLevelUp => this.level < (sm_playerlevel.getUserLvById(UserProxy.Instance.player.baseInfo.level)?.hero_max_level ?? 15); // 找不到配置数据, 默认最大15级
  77. /// <summary>
  78. /// 英雄的模板数据源
  79. /// </summary>
  80. public sm_hero mo => sm_hero.GetMoByID(this.typeId);
  81. #endregion
  82. #region 技能
  83. // UNDONE : 技能部分梳理好,补充这里 -- 王刚 2019年12月4日
  84. // 原来 : 普通技能, 手动1, 手动2, 被动技能和队长技能.
  85. // 新的 : 普攻、必杀、被动、闪避、队长技
  86. /// <summary>
  87. /// 技能等级信息记录
  88. /// key 为技能ID,value为技能对应的等级
  89. /// </summary>
  90. [Obsolete("旧技能信息", true)]
  91. public Dictionary<string, int> skillDic = new Dictionary<string, int>();
  92. /// <summary>
  93. /// 子技能列表(子技能id)
  94. /// </summary>
  95. public Dictionary<int, List<int>> subSkills = new Dictionary<int, List<int>>();
  96. /// <summary>
  97. /// 查询可解锁技能列表
  98. /// </summary>
  99. /// <returns></returns>
  100. public List<sm_subSkill> GetUnlockAbleSkills(int mainSkillId)
  101. {
  102. var li = new List<sm_subSkill>();
  103. var ssl = sm_subSkill.GetSubSkillsByMainSkillId(mainSkillId) // 取主技能对应的子技能集合
  104. .Where(sm => sm.level == 1); // 未解锁,限定为1级技能
  105. foreach (var sm in ssl)
  106. {
  107. bool find = false;
  108. if (this.subSkills.ContainsKey(mainSkillId)) // 防御
  109. {
  110. var itor_sm = sm;
  111. if (this.subSkills[mainSkillId].Contains(itor_sm.subSkillId))
  112. {
  113. find = true;
  114. }
  115. else
  116. {
  117. while (itor_sm.nextLevel_Id > 0)
  118. { // 整个链条上的id都判断一遍
  119. if (this.subSkills[mainSkillId].Contains(itor_sm.nextLevel_Id))
  120. {
  121. find = true;
  122. break;
  123. }
  124. itor_sm = sm_subSkill.GetMoById(itor_sm.nextLevel_Id);
  125. }
  126. }
  127. }
  128. if (!find && sm.canUnlock(this)) // 英雄子技能列表中不包含的id判定为待解锁状态
  129. {
  130. li.Add(sm);
  131. }
  132. }
  133. return li;
  134. }
  135. /// <summary>
  136. /// 查询可升级子技能
  137. /// </summary>
  138. /// <returns></returns>
  139. public List<sm_subSkill> GetUpdateAbleSkills(int mainSkillId)
  140. {
  141. var li = new List<sm_subSkill>();
  142. if (this.subSkills.ContainsKey(mainSkillId))
  143. {
  144. foreach (var id in this.subSkills[mainSkillId])
  145. {
  146. var sk = sm_subSkill.GetMoById(id);
  147. if (sk.canUpgrade(this))
  148. {
  149. li.Add(sk);
  150. }
  151. }
  152. }
  153. return li;
  154. }
  155. /// <summary>
  156. /// 取一个主技能底下的所有子技能
  157. /// </summary>
  158. /// <param name="mainSkillId"></param>
  159. /// <returns></returns>
  160. public List<sm_subSkill> GetSubSkills(int mainSkillId)
  161. {
  162. var li = new List<sm_subSkill>();
  163. var ssl = sm_subSkill.GetSubSkillsByMainSkillId(mainSkillId) // 取主技能对应的子技能集合
  164. .Where(sm => sm.level == 1); // 未解锁,限定为1级技能
  165. foreach (var sm in ssl)
  166. {
  167. bool find = false;
  168. if (this.subSkills.ContainsKey(mainSkillId)) // 防御
  169. {
  170. var itor_sm = sm;
  171. if (this.subSkills[mainSkillId].Contains(itor_sm.subSkillId))
  172. {
  173. find = true;
  174. li.Add(sm);
  175. continue;
  176. }
  177. else
  178. {
  179. while (itor_sm.nextLevel_Id > 0)
  180. { // 整个链条上的id都判断一遍
  181. if (this.subSkills[mainSkillId].Contains(itor_sm.nextLevel_Id))
  182. {
  183. find = true;
  184. break;
  185. }
  186. itor_sm = sm_subSkill.GetMoById(itor_sm.nextLevel_Id);
  187. }
  188. }
  189. }
  190. if (!find) // 英雄子技能列表中不包含的id判定为待解锁状态
  191. {
  192. li.Add(sm);
  193. }
  194. }
  195. return li;
  196. }
  197. /// <summary>
  198. /// 队长技
  199. /// </summary>
  200. /// <returns></returns>
  201. public sm_skill SkillLeader()
  202. {
  203. return sm_skill.GetMoByID(int.Parse(this.mo.skill_leader));
  204. }
  205. /// <summary>
  206. /// 普通攻击技能
  207. /// </summary>
  208. /// <returns></returns>
  209. public sm_skill SkillNormal()
  210. {
  211. return sm_skill.GetMoByID(int.Parse(this.mo.GetNormalSkills()[0]));
  212. //return sm_skill.GetMoByID(int.Parse(this.mo.skill_normal));
  213. }
  214. /// <summary>
  215. /// 必杀技
  216. /// </summary>
  217. /// <returns></returns>
  218. public sm_skill SkillBisha()
  219. {
  220. return sm_skill.GetMoByID(int.Parse(this.mo.skill_bisha));
  221. }
  222. /// <summary>
  223. /// 闪避/冲刺
  224. /// </summary>
  225. /// <returns></returns>
  226. public sm_skill SkillShanbi()
  227. {
  228. return sm_skill.GetMoByID(int.Parse(this.mo.skill_shanbi));
  229. }
  230. /// <summary>
  231. /// 被动技
  232. /// </summary>
  233. /// <returns></returns>
  234. public sm_skill SkillBeidong()
  235. {
  236. return sm_skill.GetMoByID(int.Parse(this.mo.skill_beidong));
  237. }
  238. #endregion
  239. /* 一个英雄 有3个装备槽: waepon、armor、ring */
  240. #region 装备
  241. /// <summary>
  242. /// 英雄的装备信息
  243. /// key = [waepon. armor. ring]
  244. /// value = 装备UID
  245. /// </summary>
  246. public Dictionary<string, HeroGameVo_Equip> equips = new Dictionary<string, HeroGameVo_Equip>();
  247. /// <summary>
  248. /// 拉取本英雄可用的装备列表
  249. /// </summary>
  250. /// <returns></returns>
  251. public List<UserEquipmentVo> UsableWeapons()
  252. {
  253. return UserProxy.Instance.player.collectEquip.FindUseableEquips(int.Parse(this.typeId));
  254. }
  255. #endregion
  256. /* 一个英雄 有3个言灵槽: left:1、middle:2、right:3 */
  257. #region 言灵
  258. /// <summary>
  259. /// 英雄的言灵信息 (暂时先用字符串吧,优化的时候再说(王刚2020年1月2日18:50:53))
  260. /// key = [1. 2. 3]
  261. /// </summary>
  262. public Dictionary<int, HeroGameVo_Yanling> yanling = new Dictionary<int, HeroGameVo_Yanling>();
  263. /// <summary>
  264. /// 英雄的言灵信息---新的 2021.6.22
  265. /// </summary>
  266. public Dictionary<int, UserYanlingVo> hero_yanling
  267. {
  268. get
  269. {
  270. Dictionary<int, UserYanlingVo> dic = new Dictionary<int, UserYanlingVo>();
  271. foreach (KeyValuePair<int, HeroGameVo_Yanling> kv in this.yanling)
  272. {
  273. if (UserProxy.Instance.player.collectYanling.items.ContainsKey(kv.Value.itemuid))
  274. {
  275. UserYanlingVo vo = UserProxy.Instance.player.collectYanling.items[kv.Value.itemuid];
  276. dic[kv.Key] = vo;
  277. }
  278. else
  279. {
  280. UserYanlingVo vo = new UserYanlingVo();
  281. dic[kv.Key] = vo;
  282. }
  283. }
  284. return dic;
  285. }
  286. }
  287. /// <summary>
  288. /// 拉取本英雄可用的言灵列表
  289. /// </summary>
  290. /// <returns></returns>
  291. public List<UserYanlingVo> UsableYanling()
  292. {
  293. return UserProxy.Instance.player.collectYanling.FindUseableYanlings(int.Parse(this.typeId));
  294. }
  295. /// <summary>
  296. /// 当前英雄装配的言灵套系属性加成
  297. /// </summary>
  298. public List<yanlingComposeDataVo> hero_yanlingComposeAttr
  299. {
  300. get
  301. {
  302. List<yanlingComposeDataVo> list = new List<yanlingComposeDataVo>();
  303. List<int> cIdList = new List<int>();
  304. foreach (KeyValuePair<int, UserYanlingVo> kv in this.hero_yanling)
  305. {
  306. if (kv.Value.typeId == null)
  307. {
  308. continue;
  309. }
  310. int id = kv.Value.nMo.GetYanlingExt().composeId;
  311. cIdList.Add(id);
  312. }
  313. if (cIdList.Count == 0)
  314. {
  315. return list;
  316. }
  317. int count = 0;
  318. int composeId = 0;
  319. foreach (var item in cIdList.GroupBy(c => c))
  320. {
  321. int n = item.Count();
  322. if (count < n)
  323. {
  324. count = n;
  325. composeId = item.Key;
  326. }
  327. }
  328. if (composeId == 0)
  329. {
  330. return list;
  331. }
  332. if (count <= 1)
  333. {
  334. return list;
  335. }
  336. sm_yanling_compose mo = GameConfigData.Ins.Getyanling_composeMo(composeId);
  337. if (mo == null)
  338. {
  339. return list;
  340. }
  341. string[] twoList = mo.two_compose.Split(',');
  342. int attrType = int.Parse(twoList[0]);
  343. yanlingComposeDataVo vo = new yanlingComposeDataVo();
  344. vo.composeId = composeId;
  345. vo.isShow = false;
  346. if (count >= 2)
  347. {
  348. vo.isShow = true;
  349. }
  350. vo.attr = (EHeroAddProperties)attrType;
  351. vo.desc = mo.two_desc;
  352. vo.attrName = mo.name;
  353. vo.type = int.Parse(twoList[1]);
  354. vo.val = int.Parse(twoList[2]);
  355. list.Add(vo);
  356. //sm_yanling_compose newMo = GameConfigData.Ins.Getyanling_composeMo(composeId);
  357. string[] threeList = mo.three_compose.Split(',');
  358. int attrType_3 = int.Parse(threeList[0]);
  359. yanlingComposeDataVo vo_3 = new yanlingComposeDataVo();
  360. vo_3.composeId = composeId;
  361. vo_3.isShow = false;
  362. if (count >= 3)
  363. {
  364. vo_3.isShow = true;
  365. }
  366. vo_3.attr = (EHeroAddProperties)attrType_3;
  367. vo_3.desc = mo.three_desc;
  368. vo_3.attrName = mo.name;
  369. vo_3.type = int.Parse(threeList[1]);
  370. vo_3.val = int.Parse(threeList[2]);
  371. list.Add(vo_3);
  372. return list;
  373. }
  374. }
  375. public string yanlingComseName
  376. {
  377. get
  378. {
  379. if (this.hero_yanlingComposeAttr.Count == 0)
  380. {
  381. return "";
  382. }
  383. if (this.hero_yanlingComposeAttr[0].composeId == 0)
  384. {
  385. return "";
  386. }
  387. sm_yanling_compose mo = GameConfigData.Ins.Getyanling_composeMo(this.hero_yanlingComposeAttr[0].composeId);
  388. if (mo == null)
  389. {
  390. return "";
  391. }
  392. return mo.name;
  393. }
  394. }
  395. #endregion
  396. #region 过时
  397. /// <summary>
  398. /// 英雄锁定状态()
  399. /// true= 被锁定
  400. /// false = 未锁定
  401. /// </summary>
  402. [Obsolete("")]
  403. public bool isLocked { get; set; }
  404. /// <summary>
  405. /// 当前等阶 默认是0--------这个应该是废弃的-----2022-7-13最新注释:这个字段最开始应该是星级,后来升星功能改变用curStar字段了
  406. /// 这个字段是废弃的
  407. /// 0 1 2 3 4 5
  408. /// 绿 蓝 红 紫 橙
  409. /// </summary>
  410. [Obsolete("新规划只有等级和等阶两个强化 维度 ")]
  411. public int strengthLevel { get; set; }
  412. /// <summary>
  413. /// //升星
  414. /// 当前星级 默认是0星
  415. /// </summary>
  416. public int curStar { get; set; }
  417. /// <summary>
  418. /// 默认的当前神血等级
  419. /// 默认是0
  420. /// 最大是9 ~~~
  421. /// </summary>
  422. [Obsolete("新规划只有等级和等阶两个强化 维度 ")]
  423. public int curBloodId { get; set; }
  424. /// <summary>
  425. /// 当前星级限制的等级
  426. /// </summary>
  427. public int starLimitLv
  428. {
  429. get
  430. {
  431. sm_heroextra_level_tupo mo = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar);
  432. if (mo == null)
  433. {
  434. return 0;
  435. }
  436. return mo.promoteLv;
  437. }
  438. }
  439. /// <summary>
  440. /// 突破的玩家等级限制
  441. /// </summary>
  442. public int userLimitLv
  443. {
  444. get
  445. {
  446. if (this.curStar >= 5)
  447. {
  448. return 0;
  449. }
  450. sm_heroextra_level_tupo mo = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1);
  451. return mo.userlvLimit;
  452. }
  453. }
  454. /// <summary>
  455. /// 是不是升级按钮 true:是
  456. /// </summary>
  457. public bool isUpgrade
  458. {
  459. get
  460. {
  461. if (this.curStar >= 5)
  462. {
  463. return true;
  464. }
  465. //&& UserProxy.Instance.player.baseInfo.level >= sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).userlvLimit
  466. if (this.level >= this.starLimitLv)
  467. {
  468. return false;
  469. }
  470. return true;
  471. }
  472. }
  473. /// <summary>
  474. /// 消耗的道具----突破
  475. /// </summary>
  476. public List<ItemVo> costItem_tupo
  477. {
  478. get
  479. {
  480. List<ItemVo> list = new List<ItemVo>();
  481. if (this.curStar >= 5)
  482. {
  483. return list;
  484. }
  485. sm_heroextra_level_tupo mo = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1);
  486. string[] sList = mo.costItems.Split(';');
  487. foreach (string item in sList)
  488. {
  489. string[] str = item.Split(',');
  490. ItemVo vo = new ItemVo();
  491. vo.typeId = str[0];
  492. vo.count = int.Parse(str[1]);
  493. list.Add(vo);
  494. }
  495. ItemVo itVo = new ItemVo();
  496. itVo.typeId = mo.segID.ToString();
  497. itVo.count = mo.segNum;
  498. list.Add(itVo);
  499. return list;
  500. }
  501. }
  502. /// <summary>
  503. /// 升级消耗道具
  504. /// </summary>
  505. public List<ItemVo> costItem_up
  506. {
  507. get
  508. {
  509. List<ItemVo> list = new List<ItemVo>();
  510. Dictionary<int, sm_item_stones> item_stonesMo = GameConfigData.Ins.item_stones;
  511. Dictionary<string, ItemVo> cDic = UserProxy.Instance.player.collectItem.collectItemDic;
  512. foreach (KeyValuePair<int, sm_item_stones> kv in item_stonesMo)
  513. {
  514. if (cDic.ContainsKey(kv.Key.ToString()))
  515. {
  516. list.Add(cDic[kv.Key.ToString()]);
  517. }
  518. }
  519. return list;
  520. }
  521. }
  522. /// <summary>
  523. /// 当前金币值
  524. /// </summary>
  525. public int curGold
  526. {
  527. get
  528. {
  529. return UserProxy.Instance.player.baseInfo.gold;
  530. }
  531. }
  532. /// <summary>
  533. /// 突破需要的金币
  534. /// </summary>
  535. public int costGold_tupo
  536. {
  537. get
  538. {
  539. if (this.curStar >= 5)
  540. {
  541. return 0;
  542. }
  543. sm_heroextra_level_tupo mo = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1);
  544. return mo.gold;
  545. }
  546. }
  547. /// <summary>
  548. /// 唤灵师星级限制的等级下的经验最大值
  549. /// </summary>
  550. public int lvLimitMaxExp
  551. {
  552. get
  553. {
  554. Dictionary<int, sm_hero_levelexp> hero_levelexp = GameConfigData.Ins.hero_levelexp;
  555. int n = 0;
  556. foreach (KeyValuePair<int, sm_hero_levelexp> kv in hero_levelexp)
  557. {
  558. if (kv.Key <= this.level)
  559. {
  560. continue;
  561. }
  562. n += kv.Value.needExp;
  563. if (kv.Key > this.starLimitLv)
  564. {
  565. break;
  566. }
  567. }
  568. return n;
  569. }
  570. }
  571. #endregion
  572. #region 新增 方法
  573. /// <summary>
  574. /// 英雄增加经验
  575. /// </summary>
  576. /// <param name="add"></param>
  577. /// <returns></returns>
  578. public int AddExp(int add)
  579. {
  580. var maxLevel = GlobalParameter.Instance.Hero_Upgrade_BasicMaxLevel; // 最大等级
  581. if (this.level >= maxLevel)
  582. {
  583. return 0; // 已达顶级
  584. }
  585. var lvMo = GameConfigData.Ins.Gethero_levelexpMo(this.level + 1);
  586. this.xp += add;
  587. Debug.Assert(this.xp >= 0, "[" + this.uid + "] : HeroExp is negative!");
  588. while (this.xp >= lvMo.needExp)
  589. {
  590. if (this.level < maxLevel)
  591. { // 如果未到达最大等级
  592. //var nextlv = this.level + 1;
  593. this.level += 1;
  594. if (this.level >= maxLevel)
  595. {
  596. this.xp = lvMo.needExp;
  597. }
  598. else
  599. {
  600. this.xp -= lvMo.needExp;
  601. }
  602. //this.maxXp = lvMo.needExp;
  603. lvMo = GameConfigData.Ins.Gethero_levelexpMo(this.level + 1);
  604. }
  605. else
  606. { // 如果已到达最大等级则仅补齐缺失的经验即可
  607. this.xp = this.maxXp; // 经验不能超过最大值
  608. break;
  609. }
  610. }
  611. return this.xp;
  612. }
  613. /// <summary>
  614. /// 克隆方法
  615. /// </summary>
  616. /// <returns></returns>
  617. public GameHeroVo Clone()
  618. {
  619. return (GameHeroVo)this.MemberwiseClone();
  620. }
  621. /// <summary>
  622. /// 是否已经拥有(解锁)此英雄
  623. /// </summary>
  624. public bool IsOwned
  625. {
  626. get
  627. {
  628. return (!string.IsNullOrWhiteSpace(this.uid) && int.Parse(this.uid) > 0); // 拥有实例id代表已经拥有此英雄
  629. }
  630. }
  631. #region undone: 装备、言灵
  632. /// <summary>
  633. /// 获取英雄装备的武器信息(待补完)
  634. /// </summary>
  635. /// <returns></returns>
  636. public HeroGameVo_Equip GetWeapon()
  637. {
  638. return this.equips["weapon"];
  639. //// todo: 待武器模块补完后, 修补这里. --wg 2019年12月4日13:50:40
  640. //return null;
  641. }
  642. /// <summary>
  643. /// 获取已经装备的言灵信息
  644. /// </summary>
  645. public void GetYanlingInfo()
  646. {
  647. // todo: 待言灵模块添加后, 修补这里. --王刚 2019年12月4日
  648. }
  649. #endregion
  650. #region 升级与进阶
  651. /// <summary>
  652. /// 废弃
  653. /// </summary>
  654. public sm_heroextra_level mo_Grade_cur
  655. {
  656. get
  657. {
  658. return sm_heroextra_level.GetMoById(this.mo.heroId, this.grade);
  659. }
  660. }
  661. public string nextGrade
  662. {
  663. get
  664. {
  665. var cur = (EHeroQuality)Enum.Parse(typeof(EHeroQuality), this.grade);
  666. return (cur + 1).ToString();
  667. }
  668. }
  669. public sm_heroextra_level nextGradeMo
  670. {
  671. get
  672. {
  673. return sm_heroextra_level.GetMoById(this.mo.heroId, this.nextGrade);
  674. }
  675. }
  676. /// <summary>
  677. /// 下一等级
  678. /// </summary>
  679. public int nextLevel
  680. {
  681. get
  682. {
  683. var next = this.level + 1;
  684. if (next > sm_hero_levelexp.GetMaxLevel()) // 最大等级校验 -wg 2019年12月4日17:26:19
  685. {
  686. next = sm_hero_levelexp.GetMaxLevel();
  687. }
  688. return next;
  689. }
  690. }
  691. public sm_hero_levelexp mo_HeroLevelExp_cur { get { return sm_hero_levelexp.GetMoById(this.level); } }
  692. public sm_hero_levelexp mo_HeroLevelExp_next { get { return sm_hero_levelexp.GetMoById(this.nextLevel); } }
  693. /// <summary>
  694. /// 想要升阶还需再获得多少个碎片
  695. /// </summary>
  696. public int upGradeNeedMoreSegments
  697. {
  698. get
  699. {
  700. if (this.grade == "S")
  701. {
  702. return 0; // 已经达到顶级
  703. }
  704. var needNum = this.NextGradeRequireSegNumber - HasSegNub;
  705. return needNum > 0 ? needNum : 0;
  706. }
  707. }
  708. /// <summary>
  709. /// 拥有碎片数量
  710. /// </summary>
  711. public int HasSegNub { get { return UserProxy.Instance.player.collectItem.GetItemCount(this.mo_segment.typeId.ToString()); } }
  712. /// <summary>
  713. /// 进阶到下一阶要求的碎片数量
  714. /// </summary>
  715. public int NextGradeRequireSegNumber
  716. {
  717. get { return this.nextGradeMo.segNum; }
  718. }
  719. /// <summary>
  720. /// 对应的碎片mo
  721. /// </summary>
  722. public sm_item_base mo_segment
  723. {
  724. get
  725. {
  726. var seg = sm_item_segment.GetMoByHeroId(int.Parse(this.typeId));
  727. return sm_item_base.GetMoById(seg.typeId);
  728. }
  729. }
  730. /// <summary>
  731. /// 碎片图标
  732. /// </summary>
  733. public string SegmentIcon
  734. {
  735. get
  736. {
  737. return mo_segment.icon;
  738. }
  739. }
  740. #endregion
  741. #endregion
  742. #region 方法
  743. // todo: 下面的代码尚未整理 -wg 2019年12月4日
  744. /// <summary>
  745. /// 根据查询的技能类型,获取该类型技能对应的等级信息
  746. /// </summary>
  747. /// <param name="skillType">"normalSkill","manuSkill1","manuSkill2","passiveSkill", </param>
  748. /// <returns></returns>
  749. [Obsolete("2019年12月31日", true)]
  750. public int GetSkillLevel(string skillType)
  751. {
  752. int level = 1;
  753. if (skillDic.ContainsKey(skillType))
  754. {
  755. level = skillDic[skillType];
  756. }
  757. return level;
  758. }
  759. /// <summary>
  760. /// 获取该角色战斗力数值
  761. /// 生命值+物理攻击*4+魔法强度*4+护甲*5+魔抗*5
  762. /// </summary>
  763. /// <returns></returns>
  764. public int GetPower()
  765. {
  766. return (int)(getHpForBattle() * 1.0f
  767. + getNengLiangZhiJiForBattle() * 0
  768. + getWuLiGongJiForBattle() * 4
  769. + getFaShuQiangDuForBattle() * 4
  770. + getFangYuHuJiaForBattle() * 5
  771. + getMoFaKangXingForBattle() * 5
  772. );
  773. }
  774. /// <summary>
  775. /// 获得角色装备的 物品提供的属性加成
  776. /// </summary>
  777. /// <param name="attribute"></param>
  778. /// <returns></returns>
  779. protected float getEquipExtraProperty(EHeroProperties attribute)
  780. {
  781. float result = 0;
  782. if (this.equips.Count == 0)
  783. {
  784. return result;
  785. }
  786. Player player = UserProxy.Instance.player;
  787. foreach (string key in equips.Keys)
  788. {
  789. HeroGameVo_Equip vo = equips[key];
  790. if (player.collectEquip.equipments.ContainsKey(int.Parse(vo.equipItemUID)))
  791. {
  792. Dictionary<EHeroProperties, int> baseAttr = player.collectEquip.equipments[int.Parse(vo.equipItemUID)].baseAttr;
  793. if (baseAttr.ContainsKey(attribute))
  794. {
  795. result += baseAttr[attribute];
  796. }
  797. }
  798. }
  799. return result;
  800. #region
  801. /*
  802. if (!IsMyOwnerHero)
  803. {
  804. foreach (string key in equips.Keys)
  805. {
  806. //todo: 这两处, 通过itemId去Ref里面查找实例,计算加成.
  807. HeroGameVo_Equip vo = equips[key];
  808. if (EquipRef.equipments.ContainsKey(int.Parse(vo.equipItemUID)))
  809. {
  810. ItemVo item = EquipRef.equipments[int.Parse(vo.equipItemUID)];
  811. var wp = item.nMo.GetWeaponExt();
  812. switch (attribute)
  813. {
  814. case EHeroProperties.WULIGONGJI:
  815. result += wp.phyAtk;
  816. break;
  817. case EHeroProperties.FASHUQIANGDU:
  818. result += wp.fashuqiangdu;
  819. break;
  820. case EHeroProperties.CRICITAL:
  821. result += wp.crit;
  822. break;
  823. }
  824. }
  825. }
  826. }
  827. else
  828. {
  829. Player player = UserProxy.Instance.player;
  830. foreach (string key in equips.Keys)
  831. {
  832. HeroGameVo_Equip vo = equips[key];
  833. if (player.collectEquip.equipments.ContainsKey(int.Parse(vo.equipItemUID)))
  834. {
  835. ItemVo item = player.collectEquip.equipments[int.Parse(vo.equipItemUID)];
  836. var wp = item.nMo.GetWeaponExt();
  837. switch (attribute)
  838. {
  839. case EHeroProperties.WULIGONGJI:
  840. result += wp.phyAtk;
  841. break;
  842. case EHeroProperties.FASHUQIANGDU:
  843. result += wp.fashuqiangdu;
  844. break;
  845. case EHeroProperties.CRICITAL:
  846. result += wp.crit;
  847. break;
  848. }
  849. }
  850. }
  851. }
  852. return result;
  853. */
  854. #endregion
  855. }
  856. /// <summary>
  857. /// 获得角色装备的言灵提供的属性加成
  858. /// </summary>
  859. /// <param name="attribute"></param>
  860. /// <returns></returns>
  861. protected float getYanlingExtraProperty(EHeroProperties attribute)
  862. {
  863. float result = 0;
  864. if (this.hero_yanling.Count == 0)
  865. {
  866. return result;
  867. }
  868. foreach (KeyValuePair<int, UserYanlingVo> kv in this.hero_yanling)
  869. {
  870. if (kv.Value.typeId != null)
  871. {
  872. Dictionary<EHeroProperties, int> baseAttr = kv.Value.baseAttr;
  873. if (baseAttr.ContainsKey(attribute))
  874. {
  875. int baseNum = baseAttr[attribute];
  876. Dictionary<EHeroAddProperties, int> rAttr = kv.Value.randAttr;
  877. Dictionary<EHeroAddProperties, int> gRandAttr = kv.Value.gemrRandAttr;
  878. List<yanlingComposeDataVo> ylComposeAttr = kv.Value.yanlingComposeAttr;
  879. int attr = (int)attribute;
  880. int add = 0;
  881. if (rAttr.ContainsKey((EHeroAddProperties)attr))
  882. {
  883. add += rAttr[(EHeroAddProperties)attr];
  884. }
  885. if (gRandAttr.ContainsKey((EHeroAddProperties)attr))
  886. {
  887. add += gRandAttr[(EHeroAddProperties)attr];
  888. }
  889. if (ylComposeAttr.Count != 0)
  890. {
  891. foreach (yanlingComposeDataVo vo in ylComposeAttr)
  892. {
  893. if (vo.isShow == false)
  894. {
  895. continue;
  896. }
  897. if (vo.attr == (EHeroAddProperties)attr)
  898. {
  899. add += vo.val;
  900. }
  901. }
  902. }
  903. result += 1.0f * add / 100 * baseNum + baseNum;
  904. }
  905. }
  906. }
  907. return result;
  908. #region
  909. /*
  910. if (IsMyOwnerHero)
  911. {
  912. foreach (var yl in this.yanling)
  913. {
  914. if (yl.Value != null && yl.Value.itemuid > 0) // 判断是否装备了言灵
  915. {
  916. var mo = yl.Value.Mo().GetYanlingExt();
  917. if (mo != null)
  918. {
  919. switch (attribute)
  920. {
  921. case EHeroProperties.HP:
  922. result += mo.TrueHp;
  923. break;
  924. case EHeroProperties.WULIGONGJI:
  925. result += mo.TruePhyAtk;
  926. break;
  927. case EHeroProperties.FASHUQIANGDU:
  928. result += mo.TrueFashuqiangdu;
  929. break;
  930. case EHeroProperties.CRICITAL:
  931. result += mo.TrueCrit;
  932. break;
  933. case EHeroProperties.FANGYUHUJIA:
  934. result += mo.TruePhyDef;
  935. break;
  936. case EHeroProperties.MOFAKANGXING:
  937. result += mo.TrueMofakangxing;
  938. break;
  939. default:
  940. break;
  941. }
  942. }
  943. }
  944. }
  945. }
  946. else
  947. {
  948. // 非玩家数据,暂定为空
  949. foreach (var yl in this.yanling)
  950. {
  951. if (yl.Value.itemuid > 0) // 判断是否装备了言灵
  952. {
  953. var itemId = yl.Value.typeId;
  954. var mo = sm_item_base.GetMoById(itemId).GetYanlingExt();
  955. if (mo != null)
  956. {
  957. switch (attribute)
  958. {
  959. case EHeroProperties.HP:
  960. result += mo.TrueHp;
  961. break;
  962. case EHeroProperties.WULIGONGJI:
  963. result += mo.TruePhyAtk;
  964. break;
  965. case EHeroProperties.FASHUQIANGDU:
  966. result += mo.TrueFashuqiangdu;
  967. break;
  968. case EHeroProperties.CRICITAL:
  969. result += mo.TrueCrit;
  970. break;
  971. case EHeroProperties.FANGYUHUJIA:
  972. result += mo.TruePhyDef;
  973. break;
  974. case EHeroProperties.MOFAKANGXING:
  975. result += mo.TrueMofakangxing;
  976. break;
  977. default:
  978. break;
  979. }
  980. }
  981. }
  982. }
  983. }
  984. return result;
  985. */
  986. #endregion
  987. }
  988. /// <summary>
  989. /// 血量
  990. /// </summary>
  991. /// <returns></returns>
  992. protected float getHp()
  993. {
  994. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.HP, level, grade);
  995. }
  996. /// <summary>
  997. /// 言能
  998. /// </summary>
  999. /// <returns></returns>
  1000. public float getNengLiangZhi()
  1001. {
  1002. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.NENGLIANGZHI, level, grade);
  1003. }
  1004. /// <summary>
  1005. /// 言攻
  1006. /// </summary>
  1007. /// <returns></returns>
  1008. protected float getFaShuQiangDu()
  1009. {
  1010. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.FASHUQIANGDU, level, grade);
  1011. }
  1012. /// <summary>
  1013. /// 言抗
  1014. /// </summary>
  1015. /// <returns></returns>
  1016. protected float getMoFaKangXing()
  1017. {
  1018. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.MOFAKANGXING, level, grade);
  1019. }
  1020. /// <summary>
  1021. /// 物攻
  1022. /// </summary>
  1023. /// <returns></returns>
  1024. protected float getWuLiGongJi()
  1025. {
  1026. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.WULIGONGJI, level, grade);
  1027. }
  1028. /// <summary>
  1029. /// 物抗
  1030. /// </summary>
  1031. /// <returns></returns>
  1032. protected float getFangYuHuJia()
  1033. {
  1034. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.FANGYUHUJIA, level, grade);
  1035. }
  1036. /// <summary>
  1037. /// 暴击
  1038. /// </summary>
  1039. /// <returns></returns>
  1040. protected float getCritical()
  1041. {
  1042. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.CRICITAL, level, grade);
  1043. }
  1044. [Obsolete("去掉攻速了-2019年12月4日")]
  1045. protected float getGongJiSuDu()
  1046. {
  1047. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.GONGJISUDU, level, grade);
  1048. }
  1049. protected float getKangbaoji()
  1050. {
  1051. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.KANGBAOJI, level, grade);
  1052. }
  1053. protected float getYanli()
  1054. {
  1055. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.YANLI, level, grade);
  1056. }
  1057. #region 战斗战斗 为战斗提供的人物的属性数值 基础属性 * 升级加成 + 升星加成 + 升阶加成 + 装备加成 + 言灵加成 、、、
  1058. /* 2019年12月4日 大概公式: 基础值*等级加成 + 武器加成 + 言灵加成 后面补完. */
  1059. /// <summary>
  1060. /// 当前的属性值 【2022-1-19】
  1061. /// </summary>
  1062. /// <returns></returns>
  1063. public int getHpForBattle()
  1064. {
  1065. //基础值+ 升级给的加成+
  1066. return (int)(getHp() // 英雄数据
  1067. + getEquipExtraProperty(EHeroProperties.HP) // 武器数据
  1068. + getYanlingExtraProperty(EHeroProperties.HP)
  1069. ); // 言灵数据
  1070. }
  1071. /// <summary>
  1072. /// 角色突破升星时当前的属性---2022-7-13修改
  1073. /// </summary>
  1074. /// <returns></returns>
  1075. public float getHpForBattle_PrimaryGrade()
  1076. {
  1077. return this.getHp(); // 言灵数据
  1078. }
  1079. /// <summary>
  1080. /// 突破后的唤灵师的属性
  1081. /// </summary>
  1082. /// <returns></returns>
  1083. public float getHpForBattle_NextGrade()
  1084. {
  1085. string gradeNew = "S";
  1086. if (this.curStar < 5)
  1087. {
  1088. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1089. }
  1090. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.HP, this.level, gradeNew);
  1091. ////基础值+ 升级给的加成+
  1092. //return (int)(heroAr // 英雄数据
  1093. // + getEquipExtraProperty(EHeroProperties.HP) // 武器数据
  1094. // + getYanlingExtraProperty(EHeroProperties.HP)
  1095. // ); // 言灵数据
  1096. }
  1097. public int getNengLiangZhiJiForBattle()
  1098. {
  1099. return (int)(getNengLiangZhi() // 英雄本身
  1100. + getEquipExtraProperty(EHeroProperties.NENGLIANGZHI) // + 武器加成
  1101. + getYanlingExtraProperty(EHeroProperties.NENGLIANGZHI) // + 言灵加成
  1102. );
  1103. }
  1104. public float getNengliangzhi_PrimaryGrade()
  1105. {
  1106. return this.getNengLiangZhi();
  1107. }
  1108. /// <summary>
  1109. /// 突破后的唤灵师的属性
  1110. /// </summary>
  1111. /// <returns></returns>
  1112. public float getNengliangzhiForBattle_NextGrade()
  1113. {
  1114. string gradeNew = "S";
  1115. if (this.curStar < 5)
  1116. {
  1117. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1118. }
  1119. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.NENGLIANGZHI, this.level, gradeNew);
  1120. //return (int)(heroAr // 英雄数据
  1121. // + getEquipExtraProperty(EHeroProperties.NENGLIANGZHI) // 武器数据
  1122. // + getYanlingExtraProperty(EHeroProperties.NENGLIANGZHI)
  1123. // );
  1124. }
  1125. /// <summary>
  1126. /// 当前唤灵师属性
  1127. /// </summary>
  1128. /// <returns></returns>
  1129. public int getWuLiGongJiForBattle()
  1130. {
  1131. return (int)(getWuLiGongJi()
  1132. + getEquipExtraProperty(EHeroProperties.WULIGONGJI)
  1133. + getYanlingExtraProperty(EHeroProperties.WULIGONGJI)
  1134. );
  1135. }
  1136. public float getWuLiGongJiForBattle_PrimaryGrade()
  1137. {
  1138. return this.getWuLiGongJi();
  1139. }
  1140. /// <summary>
  1141. /// 突破后的唤灵师的属性
  1142. /// </summary>
  1143. /// <returns></returns>
  1144. public float getWuLiGongJiForBattle_NextGrade()
  1145. {
  1146. string gradeNew = "S";
  1147. if (this.curStar < 5)
  1148. {
  1149. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1150. }
  1151. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.WULIGONGJI, this.level, gradeNew);
  1152. //return (int)(heroAr // 英雄数据
  1153. // + getEquipExtraProperty(EHeroProperties.WULIGONGJI) // 武器数据
  1154. // + getYanlingExtraProperty(EHeroProperties.WULIGONGJI)
  1155. // );
  1156. }
  1157. public int getFaShuQiangDuForBattle()
  1158. {
  1159. return (int)(getFaShuQiangDu()
  1160. + getEquipExtraProperty(EHeroProperties.FASHUQIANGDU)
  1161. + getYanlingExtraProperty(EHeroProperties.FASHUQIANGDU)
  1162. );
  1163. }
  1164. public float getFaShuQiangDuForBattle_PrimaryGrade()
  1165. {
  1166. return this.getFaShuQiangDu();
  1167. }
  1168. public float getFaShuQiangDuForBattle_NextGrade()
  1169. {
  1170. string gradeNew = "S";
  1171. if (this.curStar < 5)
  1172. {
  1173. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1174. }
  1175. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.FASHUQIANGDU, level, gradeNew);
  1176. //return (int)(heroAr
  1177. // + getEquipExtraProperty(EHeroProperties.FASHUQIANGDU)
  1178. // + getYanlingExtraProperty(EHeroProperties.FASHUQIANGDU)
  1179. // );
  1180. }
  1181. public int getMoFaKangXingForBattle()
  1182. {
  1183. return (int)(getMoFaKangXing()
  1184. + getEquipExtraProperty(EHeroProperties.MOFAKANGXING)
  1185. + getYanlingExtraProperty(EHeroProperties.MOFAKANGXING)
  1186. );
  1187. }
  1188. public float getMoFaKangXingForBattle_PrimaryGrade()
  1189. {
  1190. return this.getMoFaKangXing();
  1191. }
  1192. public float getMoFaKangXingForBattle_NextGrade()
  1193. {
  1194. string gradeNew = "S";
  1195. if (this.curStar < 5)
  1196. {
  1197. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1198. }
  1199. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.MOFAKANGXING, level, gradeNew);
  1200. }
  1201. /// <summary>
  1202. /// 当前唤灵师属性
  1203. /// </summary>
  1204. /// <returns></returns>
  1205. public int getFangYuHuJiaForBattle()
  1206. {
  1207. return (int)(getFangYuHuJia()
  1208. + getEquipExtraProperty(EHeroProperties.FANGYUHUJIA)
  1209. + getYanlingExtraProperty(EHeroProperties.FANGYUHUJIA)
  1210. );
  1211. }
  1212. public float getFangYuHuJiaForBattle_PrimaryGrade()
  1213. {
  1214. return this.getFangYuHuJia();
  1215. }
  1216. /// <summary>
  1217. /// 突破后的唤灵师属性
  1218. /// </summary>
  1219. /// <returns></returns>
  1220. public float getFangYuHuJiaForBattle_NextGrade()
  1221. {
  1222. string gradeNew = "S";
  1223. if (this.curStar < 5)
  1224. {
  1225. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1226. }
  1227. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.FANGYUHUJIA, level, gradeNew);
  1228. //return (int)(heroAr
  1229. // + getEquipExtraProperty(EHeroProperties.FANGYUHUJIA)
  1230. // + getYanlingExtraProperty(EHeroProperties.FANGYUHUJIA)
  1231. // );
  1232. }
  1233. [Obsolete("取消攻速了")]
  1234. public float getGongJiSuDuForBattle()
  1235. {
  1236. return (getGongJiSuDu()
  1237. + getEquipExtraProperty(EHeroProperties.GONGJISUDU));
  1238. }
  1239. /// <summary>
  1240. /// 暴击
  1241. /// </summary>
  1242. /// <returns></returns>
  1243. public int getCriticalForBattle()
  1244. {
  1245. Debug.Log("基础暴击:" + getCritical());
  1246. Debug.Log("武器暴击:" + getEquipExtraProperty(EHeroProperties.CRICITAL));
  1247. Debug.Log("言灵暴击:" + getYanlingExtraProperty(EHeroProperties.CRICITAL));
  1248. return (int)(getCritical()
  1249. + getEquipExtraProperty(EHeroProperties.CRICITAL)
  1250. + getYanlingExtraProperty(EHeroProperties.CRICITAL)
  1251. );
  1252. }
  1253. public float getCriticalForBattle_PrimaryGrade()
  1254. {
  1255. return this.getCritical();
  1256. }
  1257. public float getCriticalForBattle_NextGrade()
  1258. {
  1259. string gradeNew = "S";
  1260. if (this.curStar < 5)
  1261. {
  1262. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1263. }
  1264. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.CRICITAL, level, gradeNew);
  1265. //return (int)(heroAr
  1266. // + getEquipExtraProperty(EHeroProperties.CRICITAL)
  1267. // + getYanlingExtraProperty(EHeroProperties.CRICITAL)
  1268. // );
  1269. }
  1270. public int getKangbaojiForBattle()
  1271. {
  1272. return (int)(getKangbaoji()
  1273. //+ getEquipExtraProperty(EHeroProperties.KANGBAOJI)//武器没有抗暴击
  1274. + getYanlingExtraProperty(EHeroProperties.KANGBAOJI)
  1275. );
  1276. }
  1277. public float getKangbaojiForBattle_PrimaryGrade()
  1278. {
  1279. return this.getKangbaoji();
  1280. }
  1281. public float getKangbaojiForBattle_NextGrade()
  1282. {
  1283. string gradeNew = "S";
  1284. if (this.curStar < 5)
  1285. {
  1286. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1287. }
  1288. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.KANGBAOJI, level, gradeNew);
  1289. //return (int)(heroAr
  1290. // + getYanlingExtraProperty(EHeroProperties.KANGBAOJI)
  1291. // );
  1292. }
  1293. public int getYanliForBattle()
  1294. {
  1295. return (int)(getYanli()
  1296. + getEquipExtraProperty(EHeroProperties.YANLI)
  1297. + getYanlingExtraProperty(EHeroProperties.YANLI)
  1298. );
  1299. }
  1300. public float getYanliForBattle_PrimaryGrade()
  1301. {
  1302. return this.getYanli();
  1303. }
  1304. public float getYanliForBattle_NextGrade()
  1305. {
  1306. string gradeNew = "S";
  1307. if (this.curStar < 5)
  1308. {
  1309. gradeNew = sm_heroextra_level_tupo.GetMoById(int.Parse(this.typeId), this.curStar + 1).quality;
  1310. }
  1311. return HeroProxy.Instance.getHeroProperty(typeId, EHeroProperties.YANLI, level, gradeNew);
  1312. //return (int)(heroAr
  1313. // +getEquipExtraProperty(EHeroProperties.YANLI)
  1314. // + getYanlingExtraProperty(EHeroProperties.YANLI)
  1315. // );
  1316. }
  1317. /// <summary>
  1318. /// 获取暴击率(战斗中使用)(2020.6.3)
  1319. /// </summary>
  1320. /// <returns></returns>
  1321. public float getCriticalRatioInBattle()
  1322. {
  1323. return this.getCriticalForBattle() / (75 + level * 5);
  1324. }
  1325. #endregion
  1326. /// <summary>
  1327. /// 获取唤灵师下所有言灵的属性信息
  1328. /// </summary>
  1329. public Dictionary<EHeroProperties, int> GetYanLingBaseAttr
  1330. {
  1331. get
  1332. {
  1333. Dictionary<EHeroProperties, int> dic = new Dictionary<EHeroProperties, int>();
  1334. if (this.yanling.Count <= 0)
  1335. {
  1336. return dic;
  1337. }
  1338. Dictionary<int, UserYanlingVo> items = UserProxy.Instance.player.collectYanling.items;
  1339. int hp = 0;
  1340. int crit = 0;
  1341. int phyAtk = 0;
  1342. int phyDef = 0;
  1343. int atkSpeed = 0;
  1344. int fashuqiangdu = 0;
  1345. int mofakangxing = 0;
  1346. foreach (KeyValuePair<int, HeroGameVo_Yanling> kv in this.yanling)
  1347. {
  1348. if (!items.ContainsKey(kv.Value.itemuid))
  1349. {
  1350. continue;
  1351. }
  1352. Dictionary<EHeroProperties, int> baseAttr = items[kv.Value.itemuid].baseAttr;
  1353. if (baseAttr.ContainsKey(EHeroProperties.HP))
  1354. {
  1355. hp += baseAttr[EHeroProperties.HP];
  1356. }
  1357. if (baseAttr.ContainsKey(EHeroProperties.CRICITAL))
  1358. {
  1359. crit += baseAttr[EHeroProperties.CRICITAL];
  1360. }
  1361. if (baseAttr.ContainsKey(EHeroProperties.WULIGONGJI))
  1362. {
  1363. phyAtk += baseAttr[EHeroProperties.WULIGONGJI];
  1364. }
  1365. if (baseAttr.ContainsKey(EHeroProperties.FANGYUHUJIA))
  1366. {
  1367. phyDef += baseAttr[EHeroProperties.FANGYUHUJIA];
  1368. }
  1369. if (baseAttr.ContainsKey(EHeroProperties.ATKSPEED))
  1370. {
  1371. atkSpeed += baseAttr[EHeroProperties.ATKSPEED];
  1372. }
  1373. if (baseAttr.ContainsKey(EHeroProperties.FASHUQIANGDU))
  1374. {
  1375. fashuqiangdu += baseAttr[EHeroProperties.FASHUQIANGDU];
  1376. }
  1377. if (baseAttr.ContainsKey(EHeroProperties.MOFAKANGXING))
  1378. {
  1379. mofakangxing += baseAttr[EHeroProperties.MOFAKANGXING];
  1380. }
  1381. }
  1382. if (hp != 0)
  1383. {
  1384. dic[EHeroProperties.HP] = hp;
  1385. }
  1386. if (crit != 0)
  1387. {
  1388. dic[EHeroProperties.CRICITAL] = crit;
  1389. }
  1390. if (phyAtk != 0)
  1391. {
  1392. dic[EHeroProperties.WULIGONGJI] = phyAtk;
  1393. }
  1394. if (phyDef != 0)
  1395. {
  1396. dic[EHeroProperties.FANGYUHUJIA] = phyDef;
  1397. }
  1398. if (atkSpeed != 0)
  1399. {
  1400. dic[EHeroProperties.ATKSPEED] = atkSpeed;
  1401. }
  1402. if (fashuqiangdu != 0)
  1403. {
  1404. dic[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
  1405. }
  1406. if (mofakangxing != 0)
  1407. {
  1408. dic[EHeroProperties.MOFAKANGXING] = mofakangxing;
  1409. }
  1410. return dic;
  1411. }
  1412. }
  1413. /// <summary>
  1414. /// 获取唤灵师下所有言灵的随机属性
  1415. /// </summary>
  1416. public Dictionary<EHeroAddProperties, int> GetYanLingRandAttr
  1417. {
  1418. get
  1419. {
  1420. Dictionary<EHeroAddProperties, int> dic = new Dictionary<EHeroAddProperties, int>();
  1421. if (this.yanling.Count <= 0)
  1422. {
  1423. return dic;
  1424. }
  1425. Dictionary<int, UserYanlingVo> items = UserProxy.Instance.player.collectYanling.items;
  1426. int hp = 0;
  1427. int manaUpperlimit = 0;
  1428. int phyDamage = 0;
  1429. int magDamage = 0;
  1430. int phyDefend = 0;
  1431. int magDefend = 0;
  1432. int phyDamagereduce = 0;
  1433. int magDamagereduce = 0;
  1434. int additional_monsterExp = 0;
  1435. int additional_atkSpeed = 0;
  1436. int additional_moveSpeed = 0;
  1437. int additional_critProbability = 0;
  1438. int additional_critDamage = 0;
  1439. int skillCoolTs = 0;
  1440. foreach (KeyValuePair<int, HeroGameVo_Yanling> kv in this.yanling)
  1441. {
  1442. if (!items.ContainsKey(kv.Value.itemuid))
  1443. {
  1444. continue;
  1445. }
  1446. Dictionary<EHeroAddProperties, int> randAttr = items[kv.Value.itemuid].randAttr;
  1447. if (randAttr.ContainsKey(EHeroAddProperties.additional_hpUpperlimit))
  1448. {
  1449. hp += randAttr[EHeroAddProperties.additional_hpUpperlimit];
  1450. }
  1451. if (randAttr.ContainsKey(EHeroAddProperties.additional_manaUpperlimit))
  1452. {
  1453. manaUpperlimit += randAttr[EHeroAddProperties.additional_manaUpperlimit];
  1454. }
  1455. if (randAttr.ContainsKey(EHeroAddProperties.additional_phyDamage))
  1456. {
  1457. phyDamage += randAttr[EHeroAddProperties.additional_phyDamage];
  1458. }
  1459. if (randAttr.ContainsKey(EHeroAddProperties.additional_magDamage))
  1460. {
  1461. magDamage += randAttr[EHeroAddProperties.additional_magDamage];
  1462. }
  1463. if (randAttr.ContainsKey(EHeroAddProperties.additional_phyDefend))
  1464. {
  1465. phyDefend += randAttr[EHeroAddProperties.additional_phyDefend];
  1466. }
  1467. if (randAttr.ContainsKey(EHeroAddProperties.additional_magDefend))
  1468. {
  1469. magDefend += randAttr[EHeroAddProperties.additional_magDefend];
  1470. }
  1471. if (randAttr.ContainsKey(EHeroAddProperties.additional_phyDamagereduce))
  1472. {
  1473. phyDamagereduce += randAttr[EHeroAddProperties.additional_phyDamagereduce];
  1474. }
  1475. if (randAttr.ContainsKey(EHeroAddProperties.additional_magDamagereduce))
  1476. {
  1477. magDamagereduce += randAttr[EHeroAddProperties.additional_magDamagereduce];
  1478. }
  1479. if (randAttr.ContainsKey(EHeroAddProperties.additional_monsterExp))
  1480. {
  1481. additional_monsterExp += randAttr[EHeroAddProperties.additional_monsterExp];
  1482. }
  1483. if (randAttr.ContainsKey(EHeroAddProperties.additional_atkSpeed))
  1484. {
  1485. additional_atkSpeed += randAttr[EHeroAddProperties.additional_atkSpeed];
  1486. }
  1487. if (randAttr.ContainsKey(EHeroAddProperties.additional_moveSpeed))
  1488. {
  1489. additional_moveSpeed += randAttr[EHeroAddProperties.additional_moveSpeed];
  1490. }
  1491. if (randAttr.ContainsKey(EHeroAddProperties.additional_critProbability))
  1492. {
  1493. additional_critProbability += randAttr[EHeroAddProperties.additional_critProbability];
  1494. }
  1495. if (randAttr.ContainsKey(EHeroAddProperties.additional_critDamage))
  1496. {
  1497. additional_critDamage += randAttr[EHeroAddProperties.additional_critDamage];
  1498. }
  1499. if (randAttr.ContainsKey(EHeroAddProperties.skillCoolTs))
  1500. {
  1501. additional_critDamage += randAttr[EHeroAddProperties.skillCoolTs];
  1502. }
  1503. }
  1504. if (hp != 0)
  1505. {
  1506. dic[EHeroAddProperties.additional_hpUpperlimit] = hp;
  1507. }
  1508. if (manaUpperlimit != 0)
  1509. {
  1510. dic[EHeroAddProperties.additional_manaUpperlimit] = manaUpperlimit;
  1511. }
  1512. if (phyDamage != 0)
  1513. {
  1514. dic[EHeroAddProperties.additional_phyDamage] = phyDamage;
  1515. }
  1516. if (magDamage != 0)
  1517. {
  1518. dic[EHeroAddProperties.additional_magDamage] = magDamage;
  1519. }
  1520. if (phyDefend != 0)
  1521. {
  1522. dic[EHeroAddProperties.additional_phyDefend] = phyDefend;
  1523. }
  1524. if (magDefend != 0)
  1525. {
  1526. dic[EHeroAddProperties.additional_magDefend] = magDefend;
  1527. }
  1528. if (phyDamagereduce != 0)
  1529. {
  1530. dic[EHeroAddProperties.additional_phyDamagereduce] = phyDamagereduce;
  1531. }
  1532. if (magDamagereduce != 0)
  1533. {
  1534. dic[EHeroAddProperties.additional_magDamagereduce] = magDamagereduce;
  1535. }
  1536. if (additional_monsterExp != 0)
  1537. {
  1538. dic[EHeroAddProperties.additional_monsterExp] = additional_monsterExp;
  1539. }
  1540. if (additional_atkSpeed != 0)
  1541. {
  1542. dic[EHeroAddProperties.additional_atkSpeed] = additional_atkSpeed;
  1543. }
  1544. if (additional_moveSpeed != 0)
  1545. {
  1546. dic[EHeroAddProperties.additional_moveSpeed] = additional_moveSpeed;
  1547. }
  1548. if (additional_critProbability != 0)
  1549. {
  1550. dic[EHeroAddProperties.additional_critProbability] = additional_critProbability;
  1551. }
  1552. if (additional_critDamage != 0)
  1553. {
  1554. dic[EHeroAddProperties.additional_critDamage] = additional_critDamage;
  1555. }
  1556. if (skillCoolTs != 0)
  1557. {
  1558. dic[EHeroAddProperties.skillCoolTs] = skillCoolTs;
  1559. }
  1560. return dic;
  1561. }
  1562. }
  1563. public void ReloadData(GameHeroVo from)
  1564. {
  1565. var tp = typeof(GameHeroVo);
  1566. var pps = tp.GetProperties();
  1567. foreach (var p in pps)
  1568. {
  1569. if (p.CanWrite)
  1570. {
  1571. p.SetValue(this, p.GetValue(from));
  1572. }
  1573. }
  1574. }
  1575. #endregion
  1576. }
  1577. /// <summary>
  1578. /// 英雄品阶枚举
  1579. /// </summary>
  1580. public enum EHeroQuality
  1581. {
  1582. D = 1,
  1583. C = 2,
  1584. B = 3,
  1585. A = 4,
  1586. S = 5
  1587. }
  1588. /// <summary>
  1589. /// 英雄属性
  1590. /// </summary>
  1591. public enum EHeroProperties
  1592. {
  1593. /// <summary>
  1594. /// 生命值
  1595. /// </summary>
  1596. HP,
  1597. /// <summary>
  1598. /// 能量值
  1599. /// </summary>
  1600. NENGLIANGZHI,
  1601. /// <summary>
  1602. /// 物理攻击
  1603. /// </summary>
  1604. WULIGONGJI,
  1605. /// <summary>
  1606. /// 防御护甲
  1607. /// </summary>
  1608. FANGYUHUJIA,
  1609. /// <summary>
  1610. /// 敏捷---废弃
  1611. /// </summary>
  1612. GONGJISUDU,
  1613. /// <summary>
  1614. /// 暴击
  1615. /// </summary>
  1616. CRICITAL,
  1617. /// <summary>
  1618. /// 法术强度
  1619. /// </summary>
  1620. FASHUQIANGDU,
  1621. /// <summary>
  1622. /// 魔法抗性
  1623. /// </summary>
  1624. MOFAKANGXING,
  1625. /// <summary>
  1626. ///攻击速度--废弃
  1627. /// </summary>
  1628. ATKSPEED,
  1629. /// <summary>
  1630. /// 抗暴击
  1631. /// </summary>
  1632. KANGBAOJI,
  1633. /// <summary>
  1634. /// 言力
  1635. /// </summary>
  1636. YANLI,
  1637. }
  1638. /// <summary>
  1639. /// 随机属性
  1640. /// </summary>
  1641. public enum EHeroAddProperties
  1642. {
  1643. /// <summary>
  1644. /// 生命上限加成
  1645. /// </summary>
  1646. additional_hpUpperlimit,
  1647. /// <summary>
  1648. /// 言能上限加成
  1649. /// </summary>
  1650. additional_manaUpperlimit,
  1651. /// <summary>
  1652. /// 物攻伤害加成
  1653. /// </summary>
  1654. additional_phyDamage,
  1655. /// <summary>
  1656. /// 护甲加成
  1657. /// </summary>
  1658. additional_phyDefend,
  1659. /// <summary>
  1660. /// 敏捷
  1661. /// </summary>
  1662. additional_moveSpeed,
  1663. /// <summary>
  1664. /// 暴击伤害加成
  1665. /// </summary>
  1666. additional_critDamage,
  1667. /// <summary>
  1668. /// 言攻伤害加成
  1669. /// </summary>
  1670. additional_magDamage,
  1671. /// <summary>
  1672. /// 言抗加成
  1673. /// </summary>
  1674. additional_magDefend,
  1675. /// <summary>
  1676. /// 攻击速度加成
  1677. /// </summary>
  1678. additional_atkSpeed,
  1679. /// <summary>
  1680. /// 物伤减免加成
  1681. /// </summary>
  1682. additional_phyDamagereduce,
  1683. /// <summary>
  1684. /// 言伤减免加成
  1685. /// </summary>
  1686. additional_magDamagereduce,
  1687. /// <summary>
  1688. ///怪物经验加成
  1689. /// </summary>
  1690. additional_monsterExp,
  1691. /// <summary>
  1692. /// 暴击几率加成
  1693. /// </summary>
  1694. additional_critProbability,
  1695. /// <summary>
  1696. /// 冷却时间
  1697. /// </summary>
  1698. skillCoolTs,
  1699. }
  1700. public class PropertiesComparison : Singleton<PropertiesComparison>
  1701. {
  1702. public static Dictionary<EHeroAddProperties, string> Comparison = new Dictionary<EHeroAddProperties, string>
  1703. {
  1704. { EHeroAddProperties.additional_hpUpperlimit,"生命上限"},
  1705. { EHeroAddProperties.additional_manaUpperlimit,"言能上限"},
  1706. { EHeroAddProperties.additional_phyDamage,"物攻伤害"},
  1707. { EHeroAddProperties.additional_magDamage,"言攻伤害"},
  1708. { EHeroAddProperties.additional_phyDefend,"护甲加成"},
  1709. { EHeroAddProperties.additional_magDefend,"言抗加成"},
  1710. { EHeroAddProperties.additional_phyDamagereduce,"物伤减免"},
  1711. { EHeroAddProperties.additional_magDamagereduce,"言伤减免"},
  1712. { EHeroAddProperties.additional_monsterExp,"经验加成"},
  1713. { EHeroAddProperties.additional_atkSpeed,"攻击速度"},
  1714. { EHeroAddProperties.additional_moveSpeed,"移动速度"},
  1715. { EHeroAddProperties.additional_critProbability,"暴击几率"},
  1716. { EHeroAddProperties.additional_critDamage,"暴击伤害"},
  1717. { EHeroAddProperties.skillCoolTs,"冷却时间"},
  1718. };
  1719. }
  1720. /// <summary>
  1721. /// 英雄的职业类别
  1722. /// </summary>
  1723. public enum HeroZhiye
  1724. {
  1725. 战士 = 1, //防
  1726. 法师 = 2,
  1727. 辅助 = 3, //辅
  1728. 坦克 = 4, //突
  1729. 刺客 = 5, //攻
  1730. }
  1731. /// <summary>
  1732. /// 英雄的所属元素元素类型//0 空的//1 金 //2 冰 //3 火 //4 风 //5 雷 //6 毒 //7 黑暗 //8 亡灵 // 9 物理
  1733. /// </summary>
  1734. public enum HeroYuansu
  1735. {
  1736. 金系 = 1,
  1737. 冰系 = 2,
  1738. 火系 = 3,
  1739. 风系 = 4,
  1740. 雷系 = 5,
  1741. 毒系 = 6,
  1742. 黑暗系 = 7,
  1743. 亡灵系 = 8,
  1744. 物理系 = 9,
  1745. }
  1746. /// <summary>
  1747. /// 英雄自身的装备数据
  1748. /// </summary>
  1749. public class HeroGameVo_Equip
  1750. {
  1751. /// <summary>
  1752. /// 装备的类型
  1753. /// </summary>
  1754. public string equipType { get; set; }
  1755. /// <summary>
  1756. /// 装备的物品UID
  1757. /// </summary>
  1758. public string equipItemUID { get; set; }
  1759. /// <summary>
  1760. /// 物品类型
  1761. /// </summary>
  1762. public int typeId
  1763. {
  1764. get
  1765. {
  1766. var player = UserProxy.Instance.player;
  1767. var uid = int.Parse(this.equipItemUID);
  1768. if (player.collectEquip.equipments.ContainsKey(uid))
  1769. {
  1770. return int.Parse(player.collectEquip.equipments[uid].typeId);
  1771. }
  1772. return 0;
  1773. }
  1774. }
  1775. /// <summary>
  1776. /// 物品等级
  1777. /// </summary>
  1778. public int level { get; set; }
  1779. /// <summary>
  1780. /// 获取装备的Mo(基础数据), 武器扩展数据请继续.GetWeaponExt();
  1781. /// </summary>
  1782. /// <returns></returns>
  1783. public sm_item_base EquipMo()
  1784. {
  1785. return sm_item_base.GetMoById(this.typeId);
  1786. }
  1787. /// <summary>
  1788. /// 把int隐式转换为HeroGameVo_Yanling对象
  1789. /// </summary>
  1790. /// <param name="i"></param>
  1791. public static implicit operator HeroGameVo_Equip(int i)
  1792. {
  1793. return i > 0 ? new HeroGameVo_Equip() { equipItemUID = i.ToString() } : null;
  1794. }
  1795. /// <summary>
  1796. /// 隐式转换为int值
  1797. /// </summary>
  1798. /// <param name="o"></param>
  1799. public static implicit operator int(HeroGameVo_Equip o)
  1800. {
  1801. return int.Parse(o.equipItemUID);
  1802. }
  1803. }
  1804. /// <summary>
  1805. /// 英雄自身的言灵数据
  1806. /// </summary>
  1807. public class HeroGameVo_Yanling
  1808. {
  1809. /// <summary>
  1810. /// 言灵的实例唯一ID
  1811. /// </summary>
  1812. public int itemuid { get; set; }
  1813. /// <summary>
  1814. /// 当前能量值
  1815. /// </summary>
  1816. public int sp_now { get; set; }
  1817. /// <summary>
  1818. /// 当前CD
  1819. /// </summary>
  1820. public float cd_now { get; set; }
  1821. /// <summary>
  1822. /// 物品类型
  1823. /// </summary>
  1824. public int typeId;
  1825. //{
  1826. private int getTypeIdFromUID()
  1827. {
  1828. var player = UserProxy.Instance.player;
  1829. var uid = this.itemuid;
  1830. if (player.collectYanling.items.ContainsKey(uid))
  1831. {
  1832. return int.Parse(player.collectYanling.items[uid].typeId);
  1833. }
  1834. return 0;
  1835. }
  1836. //}
  1837. /// <summary>
  1838. /// 获取言灵的Mo(基础数据), 获取扩展数据请继续.GetYanlingExt();
  1839. /// </summary>
  1840. /// <returns></returns>
  1841. public sm_item_base Mo()
  1842. {
  1843. return sm_item_base.GetMoById(this.typeId);
  1844. }
  1845. /// <summary>
  1846. /// 把int隐式转换为HeroGameVo_Yanling对象
  1847. /// </summary>
  1848. /// <param name="i"></param>
  1849. public static implicit operator HeroGameVo_Yanling(int i)
  1850. {
  1851. if (i > 0)
  1852. {
  1853. var p = UserProxy.Instance.player;
  1854. var hvo = new HeroGameVo_Yanling() { itemuid = i };
  1855. hvo.typeId = hvo.getTypeIdFromUID();
  1856. return hvo;
  1857. }
  1858. return null;
  1859. }
  1860. /// <summary>
  1861. /// 把int隐式转换为HeroGameVo_Yanling对象
  1862. /// </summary>
  1863. /// <param name="i"></param>
  1864. public static implicit operator HeroGameVo_Yanling(long i)
  1865. {
  1866. if (i > 0)
  1867. {
  1868. var p = UserProxy.Instance.player;
  1869. var hvo = new HeroGameVo_Yanling() { itemuid = (int)i };
  1870. hvo.typeId = hvo.getTypeIdFromUID();
  1871. return hvo;
  1872. }
  1873. return null;
  1874. }
  1875. /// <summary>
  1876. /// 隐式转换为int值
  1877. /// </summary>
  1878. /// <param name="o"></param>
  1879. public static implicit operator int(HeroGameVo_Yanling o)
  1880. {
  1881. return o.itemuid;
  1882. }
  1883. }