BaseItemConstroller.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. // Learn cc.Class:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/class.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. cc.Class({
  8. extends: cc.Component,
  9. properties: {
  10. },
  11. // LIFE-CYCLE CALLBACKS:
  12. onLoad() {},
  13. start() {
  14. },
  15. // update (dt) {},
  16. //各品级生成随机属性
  17. /**
  18. * 左手武器:主属性加攻击 0
  19. * 右手武器:主属性加连击率 1
  20. * 衣服:主属性加防御 2
  21. * 裤子:主属性加血 3
  22. * 腰带:主属性加蓝 4
  23. * 头盔:主属性加格挡回血量 5
  24. * 项链:主属性加暴击率 6
  25. * 鞋子:主属性加闪避回蓝量 7
  26. * 手套:主属性被动回蓝 8
  27. * 护膝:主属性被动回血 9
  28. */
  29. //装备类型、、品级、、属性/
  30. //
  31. generate_properties(item_type, gradetype) {
  32. if (item_type == 0) {
  33. this.item_name = "左手拳套";
  34. this.item_grade = 0;
  35. this.item_master_type = "攻击"; //主属性类型
  36. //白 * (白色装备:主属性1)
  37. if (gradetype == 0) {
  38. this.spriteFrame_name = "left_gloves1";
  39. this.item_master_value = 1;
  40. this.item_Attached_num = 0; //附属属性数量
  41. if (this.item_Attached_num == 0) return;
  42. else {
  43. for (let i = 0; i < this.item_Attached_num; i++) {
  44. this.item_Attached_type[i] = 0; //10种类型附属属性
  45. this.item_Attached_value[i] = 0; //附属属性类型值
  46. }
  47. }
  48. }
  49. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  50. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  51. if (gradetype == 1) {
  52. this.spriteFrame_name = "left_gloves2";
  53. this.item_master_value = this.random_num(1, 2); //主属性值
  54. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  55. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  56. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  57. }
  58. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  59. if (gradetype == 2) {
  60. this.spriteFrame_name = "left_gloves3";
  61. this.item_master_value = this.random_num(1, 3); //主属性值
  62. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  63. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  64. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  65. }
  66. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  67. if (gradetype == 3) {
  68. this.spriteFrame_name = "left_gloves4";
  69. this.item_master_value = this.random_num(1, 4); //主属性值
  70. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  71. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  72. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  73. }
  74. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  75. if (gradetype == 4) {
  76. this.item_master_value = this.random_num(1, 5); //主属性值
  77. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  78. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  79. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  80. this.spriteFrame_name = "left_gloves5";
  81. }
  82. }
  83. if (item_type == 1) {
  84. this.item_name = "右手拳套";
  85. this.item_grade = 0;
  86. this.item_master_type = "连击率"; //主属性类型
  87. //白 * (白色装备:主属性1)
  88. if (gradetype == 0) {
  89. this.item_master_value = 1;
  90. this.item_Attached_num = 0; //附属属性数量
  91. this.item_Attached_type = 0; //10种类型附属属性
  92. this.item_Attached_value = 0; //附属属性类型值
  93. this.spriteFrame_name = "right_gloves1";
  94. }
  95. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  96. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  97. if (gradetype == 1) {
  98. this.item_master_value = this.random_num(1, 2); //主属性值
  99. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  100. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  101. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  102. this.spriteFrame_name = "right_gloves2";
  103. }
  104. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  105. if (gradetype == 2) {
  106. this.item_master_value = this.random_num(1, 3); //主属性值
  107. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  108. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  109. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  110. this.spriteFrame_name = "right_gloves3";
  111. }
  112. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  113. if (gradetype == 3) {
  114. this.item_master_value = this.random_num(1, 4); //主属性值
  115. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  116. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  117. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  118. this.spriteFrame_name = "right_gloves4";
  119. }
  120. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  121. if (gradetype == 4) {
  122. this.item_master_value = this.random_num(1, 5); //主属性值
  123. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  124. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  125. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  126. this.spriteFrame_name = "right_gloves5";
  127. }
  128. }
  129. if (item_type == 2) {
  130. this.item_name = "衣服";
  131. this.item_grade = 0;
  132. this.item_master_type = "防御"; //主属性类型
  133. //白 * (白色装备:主属性1)
  134. if (gradetype == 0) {
  135. this.item_master_value = 1;
  136. this.item_Attached_num = 0; //附属属性数量
  137. this.item_Attached_type = 0; //10种类型附属属性
  138. this.item_Attached_value = 0; //附属属性类型值
  139. this.spriteFrame_name = "clothes1";
  140. }
  141. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  142. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  143. if (gradetype == 1) {
  144. this.item_master_value = this.random_num(1, 2); //主属性值
  145. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  146. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  147. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  148. this.spriteFrame_name = "clothes2";
  149. }
  150. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  151. if (gradetype == 2) {
  152. this.item_master_value = this.random_num(1, 3); //主属性值
  153. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  154. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  155. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  156. this.spriteFrame_name = "clothes3";
  157. }
  158. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  159. if (gradetype == 3) {
  160. this.item_master_value = this.random_num(1, 4); //主属性值
  161. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  162. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  163. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  164. this.spriteFrame_name = "clothes4";
  165. }
  166. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  167. if (gradetype == 4) {
  168. this.item_master_value = this.random_num(1, 5); //主属性值
  169. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  170. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  171. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  172. this.spriteFrame_name = "clothes5";
  173. }
  174. }
  175. if (item_type == 3) {
  176. this.item_name = "裤子";
  177. this.item_grade = 0;
  178. this.item_master_type = "血量"; //主属性类型
  179. //白 * (白色装备:主属性1)
  180. if (gradetype == 0) {
  181. this.item_master_value = 1;
  182. this.item_Attached_num = 0; //附属属性数量
  183. this.item_Attached_type = 0; //10种类型附属属性
  184. this.item_Attached_value = 0; //附属属性类型值
  185. this.spriteFrame_name = "trousers1";
  186. }
  187. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  188. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  189. if (gradetype == 1) {
  190. this.item_master_value = this.random_num(1, 2); //主属性值
  191. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  192. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  193. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  194. this.spriteFrame_name = "trousers2";
  195. }
  196. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  197. if (gradetype == 2) {
  198. this.item_master_value = this.random_num(1, 3); //主属性值
  199. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  200. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  201. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  202. this.spriteFrame_name = "trousers3";
  203. }
  204. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  205. if (gradetype == 3) {
  206. this.item_master_value = this.random_num(1, 4); //主属性值
  207. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  208. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  209. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  210. this.spriteFrame_name = "trousers4";
  211. }
  212. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  213. if (gradetype == 4) {
  214. this.item_master_value = this.random_num(1, 5); //主属性值
  215. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  216. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  217. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  218. this.spriteFrame_name = "trousers5";
  219. }
  220. }
  221. if (item_type == 4) {
  222. this.item_name = "腰带";
  223. this.item_grade = 0;
  224. this.item_master_type = "蓝量"; //主属性类型
  225. //白 * (白色装备:主属性1)
  226. if (gradetype == 0) {
  227. this.item_master_value = 1;
  228. this.item_Attached_num = 0; //附属属性数量
  229. this.item_Attached_type = 0; //10种类型附属属性
  230. this.item_Attached_value = 0; //附属属性类型值
  231. this.spriteFrame_name = "belt1";
  232. }
  233. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  234. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  235. if (gradetype == 1) {
  236. this.item_master_value = this.random_num(1, 2); //主属性值
  237. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  238. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  239. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  240. this.spriteFrame_name = "belt2";
  241. }
  242. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  243. if (gradetype == 2) {
  244. this.item_master_value = this.random_num(1, 3); //主属性值
  245. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  246. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  247. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  248. this.spriteFrame_name = "belt3";
  249. }
  250. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  251. if (gradetype == 3) {
  252. this.item_master_value = this.random_num(1, 4); //主属性值
  253. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  254. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  255. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  256. this.spriteFrame_name = "belt4";
  257. }
  258. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  259. if (gradetype == 4) {
  260. this.item_master_value = this.random_num(1, 5); //主属性值
  261. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  262. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  263. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  264. this.spriteFrame_name = "belt5";
  265. }
  266. }
  267. if (item_type == 5) {
  268. this.item_name = "头盔";
  269. this.item_grade = 0;
  270. this.item_master_type = "格挡回血量"; //主属性类型
  271. //白 * (白色装备:主属性1)
  272. if (gradetype == 0) {
  273. this.item_master_value = 1;
  274. this.item_Attached_num = 0; //附属属性数量
  275. this.item_Attached_type = 0; //10种类型附属属性
  276. this.item_Attached_value = 0; //附属属性类型值
  277. this.spriteFrame_name = "helmet1";
  278. }
  279. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  280. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  281. if (gradetype == 1) {
  282. this.item_master_value = this.random_num(1, 2); //主属性值
  283. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  284. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  285. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  286. this.spriteFrame_name = "helmet2";
  287. }
  288. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  289. if (gradetype == 2) {
  290. this.item_master_value = this.random_num(1, 3); //主属性值
  291. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  292. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  293. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  294. this.spriteFrame_name = "helmet3";
  295. }
  296. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  297. if (gradetype == 3) {
  298. this.item_master_value = this.random_num(1, 4); //主属性值
  299. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  300. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  301. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  302. this.spriteFrame_name = "helmet4";
  303. }
  304. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  305. if (gradetype == 4) {
  306. this.item_master_value = this.random_num(1, 5); //主属性值
  307. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  308. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  309. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  310. this.spriteFrame_name = "helmet5";
  311. }
  312. }
  313. if (item_type == 6) {
  314. this.item_name = "项链";
  315. this.item_grade = 0;
  316. this.item_master_type = "暴击率"; //主属性类型
  317. //白 * (白色装备:主属性1)
  318. if (gradetype == 0) {
  319. this.item_master_value = 1;
  320. this.item_Attached_num = 0; //附属属性数量
  321. this.item_Attached_type = 0; //10种类型附属属性
  322. this.item_Attached_value = 0; //附属属性类型值
  323. this.spriteFrame_name = "necklace1";
  324. }
  325. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  326. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  327. if (gradetype == 1) {
  328. this.item_master_value = this.random_num(1, 2); //主属性值
  329. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  330. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  331. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  332. this.spriteFrame_name = "necklace2";
  333. }
  334. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  335. if (gradetype == 2) {
  336. this.item_master_value = this.random_num(1, 3); //主属性值
  337. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  338. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  339. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  340. this.spriteFrame_name = "necklace3";
  341. }
  342. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  343. if (gradetype == 3) {
  344. this.item_master_value = this.random_num(1, 4); //主属性值
  345. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  346. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  347. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  348. this.spriteFrame_name = "necklace4";
  349. }
  350. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  351. if (gradetype == 4) {
  352. this.item_master_value = this.random_num(1, 5); //主属性值
  353. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  354. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  355. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  356. this.spriteFrame_name = "necklace5";
  357. }
  358. }
  359. if (item_type == 7) {
  360. this.item_name = "鞋子";
  361. this.item_grade = 0;
  362. this.item_master_type = "闪避回蓝量"; //主属性类型
  363. //白 * (白色装备:主属性1)
  364. if (gradetype == 0) {
  365. this.item_master_value = 1;
  366. this.item_Attached_num = 0; //附属属性数量
  367. this.item_Attached_type = 0; //10种类型附属属性
  368. this.item_Attached_value = 0; //附属属性类型值
  369. this.spriteFrame_name = "shoe1";
  370. }
  371. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  372. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  373. if (gradetype == 1) {
  374. this.item_master_value = this.random_num(1, 2); //主属性值
  375. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  376. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  377. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  378. this.spriteFrame_name = "shoe2";
  379. }
  380. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  381. if (gradetype == 2) {
  382. this.item_master_value = this.random_num(1, 3); //主属性值
  383. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  384. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  385. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  386. this.spriteFrame_name = "shoe3";
  387. }
  388. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  389. if (gradetype == 3) {
  390. this.item_master_value = this.random_num(1, 4); //主属性值
  391. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  392. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  393. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  394. this.spriteFrame_name = "shoe4";
  395. }
  396. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  397. if (gradetype == 4) {
  398. this.item_master_value = this.random_num(1, 5); //主属性值
  399. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  400. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  401. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  402. this.spriteFrame_name = "shoe5";
  403. }
  404. }
  405. if (item_type == 8) {
  406. this.item_name = "手套";
  407. this.item_grade = 0;
  408. this.item_master_type = "被动回蓝"; //主属性类型
  409. //白 * (白色装备:主属性1)
  410. if (gradetype == 0) {
  411. this.item_master_value = 1;
  412. this.item_Attached_num = 0; //附属属性数量
  413. this.item_Attached_type = 0; //10种类型附属属性
  414. this.item_Attached_value = 0; //附属属性类型值
  415. this.spriteFrame_name = "wristsupport1";
  416. }
  417. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  418. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  419. if (gradetype == 1) {
  420. this.item_master_value = this.random_num(1, 2); //主属性值
  421. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  422. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  423. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  424. this.spriteFrame_name = "wristsupport2";
  425. }
  426. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  427. if (gradetype == 2) {
  428. this.item_master_value = this.random_num(1, 3); //主属性值
  429. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  430. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  431. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  432. this.spriteFrame_name = "wristsupport3";
  433. }
  434. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  435. if (gradetype == 3) {
  436. this.item_master_value = this.random_num(1, 4); //主属性值
  437. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  438. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  439. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  440. this.spriteFrame_name = "wristsupport4";
  441. }
  442. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  443. if (gradetype == 4) {
  444. this.item_master_value = this.random_num(1, 5); //主属性值
  445. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  446. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  447. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  448. this.spriteFrame_name = "wristsupport5";
  449. }
  450. }
  451. if (item_type == 9) {
  452. this.item_name = "护膝";
  453. this.item_grade = 0;
  454. this.item_master_type = "被动回血"; //主属性类型
  455. //白 * (白色装备:主属性1)
  456. if (gradetype == 0) {
  457. this.item_master_value = 1;
  458. this.item_Attached_num = 0; //附属属性数量
  459. this.item_Attached_type = 0; //10种类型附属属性
  460. this.item_Attached_value = 0; //附属属性类型值
  461. this.spriteFrame_name = "kneecap1";
  462. }
  463. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  464. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  465. if (gradetype == 1) {
  466. this.item_master_value = this.random_num(1, 2); //主属性值
  467. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  468. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  469. this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
  470. this.spriteFrame_name = "kneecap2";
  471. }
  472. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  473. if (gradetype == 2) {
  474. this.item_master_value = this.random_num(1, 3); //主属性值
  475. this.item_Attached_num = this.random_num(1, 1); //附属属性数量
  476. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  477. this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
  478. this.spriteFrame_name = "kneecap3";
  479. }
  480. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  481. if (gradetype == 3) {
  482. this.item_master_value = this.random_num(1, 4); //主属性值
  483. this.item_Attached_num = this.random_num(2, 2); //附属属性数量
  484. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  485. this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
  486. this.spriteFrame_name = "kneecap4";
  487. }
  488. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  489. if (gradetype == 4) {
  490. this.item_master_value = this.random_num(1, 5); //主属性值
  491. this.item_Attached_num = this.random_num(3, 3); //附属属性数量
  492. this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
  493. this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
  494. this.spriteFrame_name = "kneecap5";
  495. }
  496. }
  497. },
  498. //return Math.floor(Math.random() * (max - min + 1)) + min;[min max];
  499. //随机物品类型
  500. random_num(minnum, maxnum) {
  501. return Math.floor(Math.random() * (maxnum - minnum + 1)) + minnum;
  502. },
  503. _item_name(itemnum) { //物品名字
  504. if (itemnum == 0) return "左手拳套";
  505. if (itemnum == 1) return "右手拳套";
  506. if (itemnum == 2) return "衣服";
  507. if (itemnum == 3) return "裤子";
  508. if (itemnum == 4) return "腰带";
  509. if (itemnum == 5) return "头盔";
  510. if (itemnum == 6) return "项链";
  511. if (itemnum == 7) return "鞋子";
  512. if (itemnum == 8) return "手套";
  513. if (itemnum == 9) return "护膝";
  514. }
  515. // //随机品级
  516. // random_grade(maxnum) { //max 5
  517. // return Math.floor(Math.random() * maxnum); //[0-4]
  518. // },
  519. // //随机属性条数
  520. // random_argu(maxnum) { //max 4
  521. // return Math.floor(Math.random() * maxnum + 1); //[1-3]
  522. // },
  523. // //随机属性类型
  524. // random_argu_type() {
  525. // return Math.floor(Math.random() * 10); //[0-9]
  526. // },
  527. // //随机值[0-(maxnum-1)]+1 [1,maxnum]
  528. // random_Num(maxnum) { //max 5
  529. // return Math.floor(Math.random() * maxnum + 1); //[1-5]
  530. // },
  531. });