WuqiUpgrade.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7. public class WuqiUpgradeVo
  8. {
  9. public WuqiUpgradeVo(int id,List<ItemVo> costList, Enum_CostItemStonesType type = Enum_CostItemStonesType.Wuqi)
  10. {
  11. this.costList = costList;
  12. this.id = id;
  13. this.type = type;
  14. }
  15. /// <summary>
  16. /// 武器id
  17. /// </summary>
  18. public int id { get; set; }
  19. /// <summary>
  20. ///消耗道具
  21. /// </summary>
  22. public List<ItemVo> costList { get; set; }
  23. /// <summary>
  24. ///
  25. /// </summary>
  26. public Enum_CostItemStonesType type { get; set; }
  27. /// <summary>
  28. /// 增加的经验值
  29. /// </summary>
  30. public int addExp
  31. {
  32. get
  33. {
  34. if (this.costList.Count == 0)
  35. {
  36. return 0;
  37. }
  38. int totalNum = 0;
  39. foreach (ItemVo vo in this.costList)
  40. {
  41. if (vo.nMo.itemType == 1)
  42. {
  43. int baseExp = vo.nMo.GetWeaponExt().baseExp;
  44. UserEquipmentVo equip = UserProxy.Instance.player.collectEquip.equipments[int.Parse(vo.uid)];
  45. int exp = equip.exp;
  46. double expTemp = 1.0f * exp * 0.75;
  47. int num = baseExp + (int)expTemp;
  48. totalNum += num;
  49. }
  50. else if (vo.nMo.itemType == 4)
  51. {
  52. int baseExp = vo.nMo.GetYanlingExt().baseExp;
  53. UserYanlingVo equip = UserProxy.Instance.player.collectYanling.items[int.Parse(vo.uid)];
  54. int exp = equip.curStarExp;
  55. double expTemp = 1.0f * exp * 0.75;
  56. int num = baseExp + (int)expTemp;
  57. totalNum += num;
  58. //totalNum += vo.nMo.GetYanlingExt().baseExp;
  59. }
  60. else
  61. {
  62. totalNum += vo.nMo.GetStoneExt().baseExp* vo.count;
  63. }
  64. }
  65. return totalNum;
  66. }
  67. }
  68. /// <summary>
  69. /// 变化等级
  70. /// </summary>
  71. public int addLv
  72. {
  73. get
  74. {
  75. int lv = 0;
  76. if (this.type == Enum_CostItemStonesType.Wuqi)
  77. {
  78. UserEquipmentVo vo = UserProxy.Instance.player.collectEquip.equipments[this.id];
  79. int xp = vo.exp + this.addExp;
  80. int temp = 0;
  81. Dictionary<int, Dictionary<int, sm_weapon_levelexp>> weapon_levelexp = GameConfigData.Ins.weapon_levelexp;
  82. string typeId = UserProxy.Instance.player.collectEquip.equipments[this.id].typeId;
  83. if (weapon_levelexp.ContainsKey(sm_item_base.GetMoById(int.Parse(typeId)).quality))
  84. {
  85. Dictionary<int, sm_weapon_levelexp> dic = weapon_levelexp[sm_item_base.GetMoById(int.Parse(typeId)).quality];
  86. foreach (KeyValuePair<int, sm_weapon_levelexp> kv in dic)
  87. {
  88. if (kv.Key <= vo.level)
  89. {
  90. continue;
  91. }
  92. if (kv.Value.requiredExp > xp)
  93. {
  94. break;
  95. }
  96. lv += 1;
  97. }
  98. }
  99. }
  100. else if(this.type == Enum_CostItemStonesType.YanLing)
  101. {
  102. UserYanlingVo vo = UserProxy.Instance.player.collectYanling.items[this.id];
  103. int xp = vo.curStarExp + this.addExp;
  104. int temp = 0;
  105. Dictionary<int, Dictionary<int, sm_yanlingLevel_type>> yanlingLevel_type = GameConfigData.Ins.yanlingLevel_type;
  106. string typeId = UserProxy.Instance.player.collectYanling.items[this.id].typeId;
  107. if (yanlingLevel_type.ContainsKey(sm_item_base.GetMoById(int.Parse(typeId)).quality))
  108. {
  109. Dictionary<int, sm_yanlingLevel_type> dic = yanlingLevel_type[sm_item_base.GetMoById(int.Parse(typeId)).quality];
  110. foreach (KeyValuePair<int, sm_yanlingLevel_type> kv in dic)
  111. {
  112. if (kv.Key <= vo.level)
  113. {
  114. continue;
  115. }
  116. if (kv.Value.requiredExp > xp)
  117. {
  118. break;
  119. }
  120. lv += 1;
  121. }
  122. }
  123. }
  124. return lv;
  125. }
  126. }
  127. /// <summary>
  128. /// 变化的金币
  129. /// </summary>
  130. public int gold
  131. {
  132. get
  133. {
  134. if (this.costList.Count == 0)
  135. {
  136. return 0;
  137. }
  138. int totalNum = 0;
  139. foreach (ItemVo vo in this.costList)
  140. {
  141. if (vo.nMo.itemType == 1)
  142. {
  143. totalNum += vo.nMo.GetWeaponExt().costGold * vo.count;
  144. }else if (vo.nMo.itemType == 4)
  145. {
  146. totalNum += vo.nMo.GetYanlingExt().costGold * vo.count;
  147. }
  148. else
  149. {
  150. totalNum += vo.nMo.GetStoneExt().costGold * vo.count;
  151. }
  152. }
  153. return totalNum;
  154. }
  155. }
  156. /// <summary>
  157. /// 属性值
  158. /// </summary>
  159. public Dictionary<EHeroProperties, int> changeAttr
  160. {
  161. get
  162. {
  163. Dictionary<EHeroProperties, int> attr = new Dictionary<EHeroProperties, int>();
  164. if (this.type == Enum_CostItemStonesType.Wuqi)
  165. {
  166. UserEquipmentVo vo = UserProxy.Instance.player.collectEquip.equipments[this.id];
  167. int lv = vo.level + this.addLv;
  168. sm_weaponextra_level mo = sm_weaponextra_level.GetMoById(int.Parse(vo.typeId), vo.starLevel);
  169. if (vo.starLevel < 5)
  170. {
  171. if (mo.promoteLv < lv)
  172. {
  173. lv = mo.promoteLv;
  174. }
  175. }
  176. //生命
  177. int hp = mo.hp + (lv - 1) * mo.hpRate;
  178. if (hp != 0)
  179. {
  180. attr[EHeroProperties.HP] = hp;
  181. }
  182. //暴击
  183. int crit = mo.baoji + (lv - 1) * mo.baojiRate;
  184. if (crit != 0)
  185. {
  186. attr[EHeroProperties.CRICITAL] = crit;
  187. }
  188. //物理攻击
  189. int phyAtk = mo.wuligongji + (lv - 1) * mo.wuligongjiRate;
  190. if (phyAtk != 0)
  191. {
  192. attr[EHeroProperties.WULIGONGJI] = phyAtk;
  193. }
  194. //防御护甲
  195. int phyDef = mo.fangyuhujia + (lv - 1) * mo.fangyuhujiaRate;
  196. //Debug.Log("升级后等级--phyDef-----------" + phyDef);
  197. //float addPhyDef = phyDef + phyDef * 1.0f * this.Mo().GetYanlingExt().additional_phyDefend/100;
  198. if (phyDef != 0)
  199. {
  200. attr[EHeroProperties.FANGYUHUJIA] = phyDef;
  201. }
  202. //攻击速度
  203. int atkSpeed = mo.gongjisudu + (lv - 1) * mo.gongjisuduRate;
  204. //Debug.Log("升级后等级--atkSpeed------------" + atkSpeed);
  205. //float addAtkSpeed = atkSpeed + atkSpeed * 1.0f * this.Mo().GetYanlingExt().additional_atkSpeed/100;
  206. if (atkSpeed != 0)
  207. {
  208. attr[EHeroProperties.ATKSPEED] = atkSpeed;
  209. }
  210. //法术强度
  211. int fashuqiangdu = mo.fashuqiangdu + (lv - 1) * mo.fashuqiangduRate;
  212. //Debug.Log("升级后等级--fashuqiangdu------------" + fashuqiangdu);
  213. if (fashuqiangdu != 0)
  214. {
  215. attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
  216. }
  217. //魔法抗性
  218. int mofakangxing = mo.mofakangxing + (lv - 1) * mo.mofakangxingRate;
  219. //Debug.Log("升级后等级--mofakangxing------------" + mofakangxing);
  220. if (mofakangxing != 0)
  221. {
  222. attr[EHeroProperties.MOFAKANGXING] = mofakangxing;
  223. }
  224. }
  225. else
  226. {
  227. UserYanlingVo vo = UserProxy.Instance.player.collectYanling.items[this.id];
  228. int lv = vo.level + this.addLv;
  229. sm_yanlingextra_level mo = sm_yanlingextra_level.GetMoById(int.Parse(vo.typeId), vo.starLv);
  230. if (vo.starLv < 5)
  231. {
  232. if (mo.promoteLv < lv)
  233. {
  234. lv = mo.promoteLv;
  235. }
  236. }
  237. //生命
  238. int hp = mo.hp + (lv - 1) * mo.hpRate;
  239. if (hp != 0)
  240. {
  241. attr[EHeroProperties.HP] = hp;
  242. }
  243. //暴击
  244. int crit = mo.baoji + (lv - 1) * mo.baojiRate;
  245. if (crit != 0)
  246. {
  247. attr[EHeroProperties.CRICITAL] = crit;
  248. }
  249. //物理攻击
  250. int phyAtk = mo.wuligongji + (lv - 1) * mo.wuligongjiRate;
  251. if (phyAtk != 0)
  252. {
  253. attr[EHeroProperties.WULIGONGJI] = phyAtk;
  254. }
  255. //防御护甲
  256. int phyDef = mo.fangyuhujia + (lv - 1) * mo.fangyuhujiaRate;
  257. if (phyDef != 0)
  258. {
  259. attr[EHeroProperties.FANGYUHUJIA] = phyDef;
  260. }
  261. //攻击速度
  262. int atkSpeed = mo.gongjisudu + (lv - 1) * mo.gongjisuduRate;
  263. if (atkSpeed != 0)
  264. {
  265. attr[EHeroProperties.ATKSPEED] = atkSpeed;
  266. }
  267. //法术强度
  268. int fashuqiangdu = mo.fashuqiangdu + (lv - 1) * mo.fashuqiangduRate;
  269. if (fashuqiangdu != 0)
  270. {
  271. attr[EHeroProperties.FASHUQIANGDU] = fashuqiangdu;
  272. }
  273. //魔法抗性
  274. int mofakangxing = mo.mofakangxing + (lv - 1) * mo.mofakangxingRate;
  275. //Debug.Log("升级后等级--mofakangxing------------" + mofakangxing);
  276. if (mofakangxing != 0)
  277. {
  278. attr[EHeroProperties.MOFAKANGXING] = mofakangxing;
  279. }
  280. }
  281. return attr;
  282. }
  283. }
  284. ///// <summary>
  285. ///// 增加的经验值
  286. ///// </summary>
  287. //public int addExp
  288. //{
  289. // get
  290. // {
  291. // return 0;
  292. // }
  293. //}
  294. }