EquipGem.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. EquipGem = {}
  2. function gemtest(actor, msgData)
  3. -- local a = {}
  4. -- a.schemepos = 1
  5. -- a.idxOfBag = 10102
  6. -- a.idxOfEquip = 65538
  7. -- EquipGem.schemeInfo(actor,msgData)
  8. -- EquipGem.putOnGemOrSlabstone(actor,a)
  9. -- EquipGem.takeOffGemOrSlabstone(actor,a)
  10. -- EquipGem.schemeSwitch(actor,a)
  11. end
  12. -- 萤石方案详情
  13. function EquipGem.schemeInfo(actor, msgData)
  14. local gemScheme = getGemscheme(actor)
  15. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_SCHEME, gemScheme)
  16. end
  17. -- 萤石方案镶嵌宝石或者石板
  18. function EquipGem.putOnGemOrSlabstone(actor, msgData)
  19. local idx = msgData.idxOfBag
  20. local idxOfEquip = msgData.idxOfEquip
  21. local pos = idxOfEquip
  22. local wearBar = nil
  23. if idx < 10000 then
  24. tipinfo(actor, "找不到物品")
  25. return
  26. end
  27. local gem = getbagiteminfo(actor, idx)
  28. -- 判断镶嵌的是宝石还是石板 有wearBar的是宝石
  29. if tonumber(idxOfEquip) > 0xFFFF then
  30. wearBar = gameequip.wearBar(idxOfEquip)
  31. pos = gameequip.pos(idxOfEquip)
  32. end
  33. if not gem then
  34. tipinfo(actor, "找不到物品")
  35. return
  36. end
  37. local gemId = gem.cfgid
  38. if not cellVerify(actor, gemId, idxOfEquip) then
  39. return
  40. end
  41. if not removeitembyidxlist(actor, { [idx] = 1 },9999,'荧石') then
  42. tipinfo(actor, "移除物品失败")
  43. return
  44. end
  45. local gemScheme = getGemscheme(actor)
  46. local schemepos = gemScheme.cur
  47. local schemeData = gemScheme.data[schemepos]
  48. local part = schemeData.scheme[pos]
  49. if part == nil then
  50. schemeData.scheme[pos] = {}
  51. part = schemeData.scheme[pos]
  52. part.active = true
  53. end
  54. -- 判断镶嵌的是宝石还是石板
  55. if wearBar ~= nil then
  56. if part.gems == nil then
  57. part.gems = {}
  58. end
  59. local filledGem = part.gems[wearBar]
  60. if filledGem then
  61. additemtobag(actor, tonumber(filledGem), 1,0,9999,'荧石')
  62. end
  63. part.gems[wearBar] = gemId
  64. else
  65. if part.stone then
  66. additemtobag(actor, tonumber(part.stone), 1,0,9999,'荧石')
  67. end
  68. part.stone = gemId
  69. end
  70. setplaydef(actor, "T$gemscheme", gemScheme)
  71. updateAttr(actor, gemScheme)
  72. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_CURRENT_SCHEME, schemeData)
  73. -- 刷新任务进度
  74. EquipGem.flushGemTask(actor)
  75. end
  76. -- 萤石方案里卸载宝石或者石板
  77. function EquipGem.takeOffGemOrSlabstone(actor, msgData)
  78. local idxOfEquip = msgData.idxOfEquip
  79. local pos = idxOfEquip
  80. local wearBar = nil
  81. -- 判断镶嵌的是宝石还是石板 有wearBar的是宝石
  82. if idxOfEquip > 0xFFFF then
  83. wearBar = gameequip.wearBar(idxOfEquip)
  84. pos = gameequip.pos(idxOfEquip)
  85. end
  86. local gemScheme = getGemscheme(actor)
  87. local schemepos = gemScheme.cur
  88. local schemeData = gemScheme.data[schemepos]
  89. local part = schemeData.scheme[pos]
  90. if part == nil then
  91. schemeData.scheme[pos] = {}
  92. part = schemeData.scheme[pos]
  93. end
  94. -- 判断镶嵌的是宝石还是石板
  95. if wearBar ~= nil then
  96. if part.gems == nil then
  97. part.gems = {}
  98. end
  99. local filledGem = part.gems[wearBar]
  100. if filledGem then
  101. additemtobag(actor, tonumber(filledGem), 1,0,9999,'荧石')
  102. else
  103. tipinfo(actor, "找不到物品")
  104. return
  105. end
  106. part.gems[wearBar] = nil
  107. else
  108. if part.stone then
  109. additemtobag(actor, tonumber(part.stone), 1,0,9999,'荧石')
  110. else
  111. tipinfo(actor, "找不到物品")
  112. return
  113. end
  114. part.stone = nil
  115. end
  116. setplaydef(actor, "T$gemscheme", gemScheme)
  117. updateAttr(actor, gemScheme)
  118. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_CURRENT_SCHEME, schemeData)
  119. EquipGem.flushGemTask(actor)
  120. end
  121. -- 萤石方案切换
  122. function EquipGem.schemeSwitch(actor, msgData)
  123. local schemepos = msgData.schemepos
  124. local gemScheme = getGemscheme(actor)
  125. local scheme = gemScheme.data[schemepos]
  126. if scheme == nil then
  127. tipinfo(actor, "找不到方案")
  128. return
  129. end
  130. local oldpos = gemScheme.cur
  131. local oldscheme = gemScheme.data[oldpos]
  132. if oldscheme == nil then
  133. tipinfo(actor, "找不到方案")
  134. return
  135. end
  136. if gemScheme.cur == schemepos then
  137. tipinfo(actor, "方案已激活")
  138. return
  139. end
  140. -- 老方案的宝石全部返回背包
  141. -- if oldscheme.scheme then
  142. -- for _,part in pairs(oldscheme.scheme) do
  143. -- if part.gems then
  144. -- for _, gemId in pairs(part.gems) do
  145. -- additemtobag(actor, tonumber(gemId), 1)
  146. -- end
  147. -- end
  148. -- if part.stone then
  149. -- additemtobag(actor, tonumber(part.stone), 1)
  150. -- end
  151. -- end
  152. -- end
  153. -- 新方案的宝石从背包里扣除 不够扣移除宝石
  154. -- if scheme.scheme then
  155. -- for _,part in pairs(scheme.scheme) do
  156. -- if part.gems then
  157. -- local removes = {}
  158. -- for key, gemId in pairs(part.gems) do
  159. -- if not removeitemfrombag(actor, tonumber(gemId), 1) then
  160. -- --记录宝石不足的遍历后移除
  161. -- table.insert(removes, gemId)
  162. -- end
  163. -- end
  164. -- for _, key in pairs(removes) do
  165. -- part.gems[key] = nil
  166. -- end
  167. -- end
  168. -- if part.stone then
  169. -- if not removeitemfrombag(actor, tonumber(part.stone), 1) then
  170. -- part.stone = nil
  171. -- end
  172. -- end
  173. -- end
  174. -- end
  175. oldscheme.active = false
  176. scheme.active = true
  177. gemScheme.cur = schemepos
  178. setplaydef(actor, "T$gemscheme", gemScheme)
  179. updateAttr(actor, gemScheme)
  180. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_CURRENT_SCHEME, scheme)
  181. EquipGem.flushGemTask(actor)
  182. end
  183. -- 刷新镶嵌宝石任务进度
  184. function EquipGem.flushGemTask(actor)
  185. TaskHandler.TriggerTaskGoal(actor, TaskTargetType.INLAID_GEMSTONES)
  186. end
  187. function EquipGem.getAllGemCount(actor)
  188. local final_count = 0
  189. local gem_info = getGemscheme(actor)
  190. local scheme_info = gem_info.data[gem_info.cur].scheme
  191. if table.isEmpty(scheme_info) then
  192. return final_count
  193. end
  194. for _, info in pairs(scheme_info) do
  195. if info.active then
  196. local value = table.isEmpty(info.gems) and 0 or #info.gems
  197. final_count = final_count + value
  198. end
  199. end
  200. return final_count
  201. end
  202. -- 装备是否生效影响 萤石方案属性 是否失效
  203. function EquipGem.schemeEffectByBoolean(actor, map, effect)
  204. local gemScheme = getGemscheme(actor)
  205. local cur = gemScheme.cur
  206. -- local scheme = gemScheme.data[gemScheme.cur]
  207. for schemeIndex, scheme in pairs(gemScheme.data) do
  208. local update = false
  209. for _, pos in pairs(map) do
  210. local data = scheme.scheme[pos]
  211. if data and data.active ~= effect then
  212. data.active = effect
  213. update = true
  214. end
  215. end
  216. -- 当前方案某装备激活,更新对应属性
  217. local isCur = (cur == schemeIndex)
  218. if update and isCur then
  219. updateAttr(actor, gemScheme)
  220. end
  221. setplaydef(actor, "T$gemscheme", gemScheme)
  222. -- 测试看数据 sendluamsg(actor,LuaMessageIdToClient.RES_GEM_SCHEME,gemScheme)
  223. end
  224. end
  225. function EquipGem.getOtherGemScheme(actor, msgData)
  226. local rid = msgData.rid
  227. if not rid then
  228. return
  229. end
  230. local player = getactor(actor, rid)
  231. if not player then
  232. return
  233. end
  234. local gemScheme = getGemscheme(player)
  235. if actor:toString() ~= player:toString() then
  236. gemScheme.rid = rid
  237. end
  238. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_SCHEME, gemScheme)
  239. end
  240. -- 更新萤石方案属性
  241. function updateAttr(actor, gemScheme)
  242. local cur = gemScheme.cur
  243. local gemScheme = gemScheme.data[cur]
  244. local allattr = {}
  245. local suit = {}
  246. for _, data in pairs(gemScheme.scheme) do
  247. if data.active == true then
  248. local stoneId = data.stone
  249. local attrUp = nil
  250. if stoneId then
  251. -- 石板属性
  252. local stoneAtt = string.getAttrByStr(ConfigDataManager.getTableValue("cfg_equip_stoneBoard", "stoneAtt",
  253. "id", stoneId))
  254. table.mergeAdd(allattr, stoneAtt)
  255. attrUp = string.getAttrByStr(ConfigDataManager.getTableValue("cfg_equip_stoneBoard", "stoneAtt2", "id",
  256. stoneId))
  257. end
  258. -- 萤石属性
  259. if data.gems then
  260. for _, gemId in pairs(data.gems) do
  261. local gemAtt = string.getAttrByStr(ConfigDataManager.getTableValue("cfg_equip_gem", "gemAtt", "id",
  262. gemId))
  263. local lr = string.LR(ConfigDataManager.getTableValue("cfg_equip_gem", "gemBelong", "id", gemId))
  264. -- 萤石属性增强
  265. if (attrUp ~= nil and attrUp[lr.left] ~= nil) then
  266. gemAtt = attrUpByPc(gemAtt, attrUp[lr.left])
  267. end
  268. suit[lr.left] = (suit[lr.left] and suit[lr.left] or 0) + tonumber(lr.right)
  269. table.mergeAdd(allattr, gemAtt)
  270. end
  271. end
  272. end
  273. end
  274. -- 萤石套装属性
  275. local suitConfigs = ConfigDataManager.getList("cfg_equip_gemSuit")
  276. local suitAttr = {}
  277. local activeSuitConfig = {}
  278. for k, v in pairs(suit) do
  279. for _, config in pairs(suitConfigs) do
  280. local lr = string.LR(config.gemcondition)
  281. if k == lr.left and v >= tonumber(lr.right) then
  282. if activeSuitConfig[k] == nil or tonumber(lr.right) > tonumber(string.LR(activeSuitConfig[k].gemcondition).right) then
  283. activeSuitConfig[k] = config
  284. end
  285. end
  286. end
  287. end
  288. -- 学习套装技能
  289. -- for k, config in pairs(activeSuitConfig) do
  290. -- table.mergeAdd(suitAttr,string.getAttrByStr(config.suitatt)) 暂时无属性不加成套装属性
  291. -- local lr = string.LR(config.skill)
  292. -- levelupskill(actor,lr.left,lr.right)
  293. -- print("套装id:"..config.id.." 套装类型:"..k)
  294. -- print("学习技能id:"..lr.left.." 技能等级:"..lr.right)
  295. -- end
  296. table.mergeAdd(allattr, suitAttr)
  297. local activeIds = {}
  298. for _, config in pairs(activeSuitConfig) do
  299. table.insert(activeIds, config.id)
  300. end
  301. -- setplaydef(actor, "T$gemSuitConfig", activeSuitConfig)
  302. setplaydef(actor, "T$gemSuitConfig", activeIds)
  303. -- 测试看数据 sendluamsg(actor,LuaMessageIdToClient.RES_GEM_SCHEME,{["总属性"]= allattr})
  304. addrolekmlattributes(actor, "gemscheme", allattr)
  305. end
  306. function attrUpByPc(attr_map, attr_up)
  307. attr = {}
  308. for key, value in pairs(attr_map) do
  309. attr[key] = math.ceil(value * (1 + attr_up / 10000.0))
  310. end
  311. return attr
  312. end
  313. function cellVerify(actor, itemid, idxOfEquip)
  314. -- 判断镶嵌的是宝石还是石板
  315. if idxOfEquip > 0xFFFF then
  316. local reqWearBar = gameequip.wearBar(idxOfEquip)
  317. local reqPos = gameequip.pos(idxOfEquip)
  318. local configPos = ConfigDataManager.getTableValue("cfg_equip_gem", "wearbarPos", "id", itemid)
  319. local configWearbar = ConfigDataManager.getTableValue("cfg_equip_gem", "wearbar", "id", itemid)
  320. if not string.contains(configWearbar, reqWearBar) or not string.contains(configPos, reqPos) then
  321. tipinfo(actor, "该位置无法镶嵌")
  322. return false
  323. end
  324. else
  325. local reqPos = idxOfEquip
  326. local configPos = ConfigDataManager.getTableValue("cfg_equip_stoneBoard", "pos", "id", itemid)
  327. if not string.contains(configPos, reqPos) then
  328. tipinfo(actor, "该位置无法镶嵌")
  329. return false
  330. end
  331. end
  332. return true
  333. end
  334. function getGemscheme(actor)
  335. local playData = getplaydef(actor, "T$gemscheme")
  336. if playData == nil then
  337. playData = gemschemeInit(actor)
  338. end
  339. return playData;
  340. end
  341. function gemschemeInit(actor)
  342. local gemScheme = {}
  343. gemScheme.data = {}
  344. for i = 1, 2, 1 do
  345. local scheme = {}
  346. scheme.pos = i
  347. scheme.scheme = {}
  348. if i == 1 then
  349. scheme.active = true
  350. gemScheme.cur = i
  351. else
  352. scheme.active = false
  353. end
  354. table.insert(gemScheme.data, scheme.pos, scheme)
  355. end
  356. setplaydef(actor, "T$gemscheme", gemScheme)
  357. return gemScheme
  358. end
  359. -- =======套装属性相关=======
  360. function EquipGem.getConfigByAttr(configs, attrName)
  361. for _, cfg in pairs(configs) do
  362. local value = cfg[string.lower(attrName)]
  363. if value and value ~= "" then
  364. -- lg(value)
  365. return cfg
  366. end
  367. end
  368. return nil
  369. end
  370. function EquipGem.getConfigByIdAndAttr(activeIds, attrName)
  371. if not activeIds then
  372. return nil
  373. end
  374. for _, id in ipairs(activeIds) do
  375. local config = ConfigDataManager.getById("cfg_equip_gemsuit", id)
  376. if not config then
  377. return nil
  378. end
  379. local value = config[string.lower(attrName)]
  380. if value ~= "" and value ~= nil then
  381. return config
  382. end
  383. end
  384. return nil
  385. end
  386. function EquipGem.dataAndType(actor, attrName)
  387. local data = getplaydef(actor, "T$gemSuitConfig") or {}
  388. if table.isNullOrEmpty(data) then
  389. return nil
  390. end
  391. local dataType = 0
  392. for _, v in pairs(data) do
  393. if type(v) == "string" then
  394. dataType = 2
  395. break
  396. elseif type(v) == "table" then
  397. dataType = 1
  398. break
  399. end
  400. end
  401. if dataType == 0 then
  402. return nil
  403. elseif dataType == 1 then
  404. data = EquipGem.getConfigByAttr(data, attrName)
  405. return data
  406. else
  407. data = EquipGem.getConfigByIdAndAttr(data, attrName)
  408. return data
  409. end
  410. end
  411. function EquipGem.updateAttrGroup(actor, groupName, attrName, value)
  412. updateattrgroup(actor, groupName, attrName, value)
  413. end
  414. function EquipGem.sendHpChangeMessage(actor, recovery, target)
  415. sendluamsg(actor, LuaMessageIdToClient.RES_GEM_RECOVERY_HP_INFO,
  416. { text = recovery, hurtType = 118, targetId = target:toString() })
  417. end
  418. function EquipGem.selectRate(probability)
  419. local randomNum = math.random()
  420. return randomNum <= probability
  421. end
  422. function EquipGem.parseConfigValue(valueStr)
  423. local valueArr = string.splitByAll(valueStr, "#")
  424. local probability = tonumber(valueArr[1]) / 10000
  425. local ratio = tonumber(valueArr[2]) / 10000
  426. return probability, ratio
  427. end
  428. -- 检查时间
  429. function EquipGem.checkSpeedTime(actor, config)
  430. local timeInfo = getplaydef(actor, "@gemSpeedTimeInfo")
  431. if not timeInfo then
  432. return 0
  433. end
  434. local speedBonus = config["anispeedbonus"]
  435. local lastingtime = tonumber(string.splitByAll(speedBonus, "#")[3])
  436. local cd = tonumber(string.splitByAll(speedBonus, "#")[4])
  437. local nowSec = getbaseinfo(actor, "nowsec")
  438. local useTime = timeInfo["useTime"] or 0
  439. if nowSec - useTime <= lastingtime then
  440. return 1
  441. elseif nowSec - useTime > lastingtime and nowSec - useTime < lastingtime + cd then
  442. return 2
  443. else
  444. return 3
  445. end
  446. end
  447. function EquipGem.checkRecoveryHpTime(actor, config)
  448. local useTime = getplaydef(actor, "@gemHpRecoveryTime")
  449. if not useTime then
  450. return true
  451. end
  452. local beAttackRecover = config["beattackrecover"]
  453. local cd = tonumber(string.splitByAll(beAttackRecover, "#")[3])
  454. if not cd or cd == "" then
  455. return true
  456. end
  457. local nowSec = getbaseinfo(actor, "nowsec")
  458. if nowSec - useTime <= cd then
  459. return false
  460. end
  461. return true
  462. end
  463. function EquipGem.handleGemAttrs(caster, target, targetHurt, casterType, targetType)
  464. local hurt = EquipGem.setGemAttrs(caster, "damageRate", targetHurt)
  465. if casterType == MapObjectType.PLAYER and targetType == MapObjectType.PLAYER then
  466. hurt = EquipGem.setGemAttrs(target, "damageAbsorb", hurt)
  467. end
  468. return hurt
  469. end
  470. -- 设置宝石伤害增减
  471. function EquipGem.setGemAttrs(actor, attrName, hurt)
  472. local config = EquipGem.dataAndType(actor,attrName)
  473. -- lg("伤害增减:",attrName, config)
  474. if not config then
  475. return hurt
  476. end
  477. local probability, ratio = EquipGem.parseConfigValue(config[string.lower(attrName)])
  478. if EquipGem.selectRate(probability) then
  479. if attrName == "damageRate" then
  480. hurt = hurt * (1 + ratio)
  481. elseif attrName == "damageAbsorb" then
  482. hurt = hurt * (1 - ratio)
  483. end
  484. end
  485. return hurt
  486. end
  487. -- 设置宝石恢复
  488. function EquipGem.setGemRecovery(actor, fightParam)
  489. local hurt = fightParam["targethurt"]
  490. local casterType = fightParam["castertype"]
  491. local targetType = fightParam["targettype"]
  492. if casterType == MapObjectType.PLAYER and targetType == MapObjectType.PLAYER then
  493. local config = EquipGem.dataAndType(actor,"beattackrecover")
  494. -- lg("恢复:", config)
  495. if not config then
  496. return
  497. end
  498. if not EquipGem.checkRecoveryHpTime(actor, config) then
  499. return
  500. end
  501. local probability, ratio = EquipGem.parseConfigValue(config["beattackrecover"])
  502. if EquipGem.selectRate(probability) then
  503. local recovery = math.ceil(hurt * ratio)
  504. local currHp = getbaseinfo(actor, "hp")
  505. local fixHp = recovery + currHp
  506. sethp(actor, fixHp)
  507. -- local caster = fightParam["caster"]
  508. EquipGem.sendHpChangeMessage(actor, recovery, actor)
  509. -- local nearPlayers = getnarplayer(actor)
  510. -- for _, playInfo in ipairs(nearPlayers) do
  511. -- local play = playInfo["luaplayer"]
  512. -- if play:toString() ~= actor:toString() then
  513. -- EquipGem.sendHpChangeMessage(play, recovery, actor)
  514. -- end
  515. -- end
  516. setplaydef(actor, "@gemHpRecoveryTime", getbaseinfo(actor, "nowsec"))
  517. end
  518. end
  519. end
  520. -- 设置速度加成
  521. function EquipGem.setSpeedBonus(actor)
  522. local config = EquipGem.dataAndType(actor,"anispeedbonus")
  523. -- lg("速度:", config)
  524. local timeInfo = getplaydef(actor, "@gemSpeedTimeInfo")
  525. if not config and not timeInfo then
  526. return
  527. elseif not config and timeInfo then
  528. local configId = timeInfo["cfgId"]
  529. config = ConfigDataManager.getById("cfg_equip_gemSuit", configId)
  530. end
  531. if not config then
  532. return
  533. end
  534. local nowSec = getbaseinfo(actor, "nowsec")
  535. local configId = tonumber(config["id"])
  536. local probability, ratio = EquipGem.parseConfigValue(config["anispeedbonus"])
  537. local value = getattrinfo(actor, "AniSpeedBonus")
  538. local id = attrname2id("AniSpeedBonus")
  539. local remarks = tonumber(ConfigDataManager.getTableValue("cfg_att_info", "remarks", "id", id))
  540. -- lg(value)
  541. if timeInfo then
  542. local preCfgId = timeInfo["cfgId"]
  543. local preConfig = ConfigDataManager.getById("cfg_equip_gemSuit", preCfgId)
  544. local stage = EquipGem.checkSpeedTime(actor, preConfig)
  545. if stage == 1 then
  546. -- lg(1)
  547. return
  548. elseif stage == 2 then
  549. -- lg(2)
  550. EquipGem.updateAttrGroup(actor, "gemSuitAttr", "AniSpeedBonus", 0)
  551. elseif stage == 3 then
  552. -- lg(3)
  553. if EquipGem.selectRate(probability) then
  554. local num = value * ratio
  555. if remarks == 2 then
  556. num = num * 10000 < 0 and 0 or num * 10000
  557. end
  558. -- lg("攻击速度选中:", num)
  559. EquipGem.updateAttrGroup(actor, "gemSuitAttr", "AniSpeedBonus", num)
  560. setplaydef(actor, "@gemSpeedTimeInfo", { useTime = nowSec, cfgId = configId })
  561. end
  562. end
  563. else
  564. if EquipGem.selectRate(probability) then
  565. -- lg(0)
  566. local num = value * ratio
  567. if remarks == 2 then
  568. num = num * 10000 < 0 and 0 or num * 10000
  569. end
  570. EquipGem.updateAttrGroup(actor, "gemSuitAttr", "AniSpeedBonus", num)
  571. setplaydef(actor, "@gemSpeedTimeInfo", { useTime = nowSec, cfgId = configId })
  572. end
  573. end
  574. -- lg(getattrinfo(actor, "AniSpeedBonus"))
  575. -- lg("====================================")
  576. end
  577. function testgem(actor, hurt)
  578. hurt = EquipGem.setGemAttrs(actor, "damageRate", hurt)
  579. hurt = EquipGem.setGemAttrs(actor, "damageAbsorb", hurt)
  580. lg(hurt)
  581. end