CombatBuff.lua 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811
  1. local Util = require("common.Util")
  2. local RoleAttr = require("role.RoleAttr")
  3. local CombatDefine = require("combat.CombatDefine")
  4. local CombatObj = require("combat.CombatObj")
  5. local CombatImpl = require("combat.CombatImpl")
  6. local TargetMode = require("combat.TargetMode")
  7. local CombatCalc = require("combat.CombatCalc")
  8. local RoleDefine = require("role.RoleDefine")
  9. local BeSkill = require("combat.BeSkill")
  10. local BufferExcel = require("excel.buffer")
  11. local Skill = require("combat.Skill")
  12. local SkillExcel = require("excel.skill").skill
  13. local HeroExcel = require("excel.hero").hero
  14. local FuwenExcel = require("excel.fuwen")
  15. local ProjectLogic = require("platform.ProjectLogic")
  16. --和血量相关的作用
  17. local function isHpCmd(cmd)
  18. if cmd == "hp" or cmd == "hurt" or cmd == "hurt1" or cmd == "liuxue" or cmd == "zhongdu" or cmd == "ranshao" or cmd == "ranshao1" or cmd == "huiheYinji" then
  19. return true
  20. end
  21. return false
  22. end
  23. --控制类buff
  24. function isControlCmd(cmd)
  25. if cmd == "xuanyun" or cmd == "shihua" or cmd == "bingdong" or cmd == "chanrao" then
  26. return true
  27. end
  28. end
  29. --跳过行动回合
  30. function isStop(obj)
  31. if obj == nil then
  32. return
  33. end
  34. local bufferCmd = obj.bufferCmd
  35. local ret
  36. if bufferCmd["xuanyun"] or bufferCmd["shihua"] or bufferCmd["bingdong"] or bufferCmd["chanrao"] then
  37. ret = 1
  38. elseif bufferCmd["xuanyun"] then
  39. ret = 2
  40. end
  41. return ret
  42. end
  43. --使用主动技能
  44. function isJingji(obj)
  45. if obj.bufferCmd["jinmo"] then
  46. return true
  47. end
  48. end
  49. --是否缠绕
  50. function isChanRao(obj)
  51. for j = obj.buffer[0], 1, -1 do
  52. local buffer = obj.buffer[j]
  53. local conf = BufferExcel.buffer[buffer.id]
  54. local cmd = conf.cmd
  55. if cmd == "chanrao" then
  56. return true
  57. end
  58. end
  59. end
  60. --是否被嘲讽
  61. function isChaofen(obj)
  62. if obj and obj.buffer then
  63. for j = obj.buffer[0], 1, -1 do
  64. local buffer = obj.buffer[j]
  65. local conf = BufferExcel.buffer[buffer.id]
  66. local cmd = conf.cmd
  67. if cmd == "chaofeng" then
  68. local attackPos = buffer.attackPos
  69. local attacker = CombatImpl.objList[attackPos]
  70. if attacker and attacker.pos ~= obj.pos then
  71. return true,attackPos
  72. end
  73. end
  74. end
  75. end
  76. return false,0
  77. end
  78. --是否被控制
  79. function isAtControl(obj)
  80. if obj and obj.buffer then
  81. for j = obj.buffer[0], 1, -1 do
  82. local buffer = obj.buffer[j]
  83. local conf = BufferExcel.buffer[buffer.id]
  84. local cmd = conf.cmd
  85. if isControlCmd(cmd) then
  86. return true
  87. end
  88. end
  89. end
  90. end
  91. -- 检查能否复活
  92. function canRevive(obj)
  93. if obj then
  94. if obj.hp > 0 then
  95. return
  96. end
  97. if obj.beBackup then
  98. return
  99. end
  100. if obj.dieSkill then
  101. local skillConf = SkillExcel[obj.dieSkill]
  102. if skillConf.otherArgs.noRevive == 1 then
  103. return false
  104. end
  105. end
  106. if obj.bufferCmd and obj.bufferCmd["noRevive"] then
  107. return false
  108. end
  109. for k,v in ipairs(CombatImpl.frameReviceList) do
  110. if v[1] == obj.pos then
  111. return false
  112. end
  113. end
  114. return true
  115. end
  116. end
  117. --是否对某种状态免疫
  118. CMD2KEY = {
  119. ["xuanyun"] = RoleDefine.STATUS_MIANYI_RATE1,
  120. ["shihua"] = RoleDefine.STATUS_MIANYI_RATE2,
  121. ["bingdong"] = RoleDefine.STATUS_MIANYI_RATE3,
  122. ["jinmo"] = RoleDefine.STATUS_MIANYI_RATE4,
  123. ["ranshao"] = RoleDefine.STATUS_MIANYI_RATE5,
  124. ["ranshao1"] = RoleDefine.STATUS_MIANYI_RATE5,
  125. ["liuxue"] = RoleDefine.STATUS_MIANYI_RATE6,
  126. ["zhongdu"] = RoleDefine.STATUS_MIANYI_RATE7,
  127. ["hunluan"] = RoleDefine.STATUS_MIANYI_RATE9,
  128. }
  129. function isMianyi(obj,cmd)
  130. local key = CMD2KEY[cmd]
  131. local r = math.random(0,10000)
  132. if key and obj.attr[key] >= r then
  133. return true
  134. end
  135. initCombatBufferType()
  136. -- 免疫所有负面状态
  137. if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == 1 then
  138. local r = math.random(0,10000)
  139. if obj.attr[RoleDefine.STATUS_MIANYI_RATE8] >= r then
  140. return true
  141. end
  142. end
  143. end
  144. local function isMiankong(obj, cmd, attacker, skillKongRate)
  145. if not isControlCmd(cmd) then return end
  146. if not attacker then return end
  147. if not skillKongRate then return end
  148. -- 新手剧情 100%控制
  149. if CombatImpl.fightMode[1] == CombatDefine.FIGHT_MODE2 then
  150. return false
  151. end
  152. local kongRate = attacker.attr[RoleDefine.KONG_RATE]
  153. -- 附带技能控制率
  154. kongRate = kongRate + skillKongRate
  155. local mianKongRate = obj.attr[RoleDefine.MIANKONG_RATE]
  156. kongRate = kongRate * (1 - mianKongRate/10000)
  157. kongRate = kongRate < 0 and 0 or kongRate
  158. -- 连击模式 控制概率
  159. if CombatImpl.comboType > 0 then
  160. kongRate = kongRate * CombatImpl.comboHurtRate / 10000
  161. end
  162. local r = math.random(1,10000)
  163. if r >= kongRate then
  164. return true
  165. end
  166. end
  167. function getStatus(obj)
  168. return obj.bufferCmd or {}
  169. end
  170. function isStatus(obj,status)
  171. local bufferCmd = obj.bufferCmd
  172. if not bufferCmd then return end
  173. for j = 1,#status do
  174. if bufferCmd[status[j]] then
  175. return true,status[j],bufferCmd[status[j]][1]
  176. end
  177. end
  178. end
  179. function isJob(obj,jobs)
  180. local job = obj.job
  181. for i = 1,#jobs do
  182. if job == jobs[i] then
  183. return true
  184. end
  185. end
  186. end
  187. function isCamp(obj,camps)
  188. local camp = obj.camp
  189. for i = 1,#camps do
  190. if camp == camps[i] then
  191. return true
  192. end
  193. end
  194. end
  195. function isSide(obj,sides, attacker)
  196. if not attacker then return end
  197. local side = obj.side
  198. -- 只能对敌方
  199. if sides == 1 then
  200. if side == attacker.side then
  201. return true
  202. end
  203. -- 只能对友方
  204. elseif sides == 2 then
  205. if side ~= attacker.side then
  206. return true
  207. end
  208. end
  209. end
  210. local function isPos(obj,posList)
  211. local pos = obj.pos
  212. for i = 1,#posList do
  213. if pos == posList[i] then
  214. return true
  215. end
  216. end
  217. end
  218. function getBuffer(obj)
  219. return obj.buffer
  220. end
  221. function onBufferChange(obj)
  222. local bufferAttr = obj.bufferAttr
  223. RoleAttr.initCombatAttr(bufferAttr)
  224. local bufferCmd = obj.bufferCmd
  225. for k,v in pairs(bufferCmd) do
  226. bufferCmd[k] = nil
  227. end
  228. local changeList = {}
  229. for i = 1, obj.buffer[0] do
  230. local buffer = obj.buffer[i]
  231. local conf = BufferExcel.buffer[buffer.id]
  232. if conf.cmd == "stealattr" or
  233. conf.cmd == "handleattr" or
  234. conf.cmd == "attr" or
  235. conf.cmd == "attrdne" or
  236. conf.cmd == "attr1" or
  237. conf.cmd == "pojia" or
  238. conf.cmd == "jiansu" or
  239. conf.cmd == "defRate" or
  240. conf.cmd == "defRate2" or
  241. conf.cmd == "attrQusan" then
  242. if type(buffer.arg) == "table" then
  243. for j = 1,#buffer.arg do
  244. local attrData = buffer.arg[j]
  245. local key = attrData[1]
  246. local value = 0
  247. if not conf.attrRate then
  248. value = attrData[2]
  249. else
  250. value = conf.attrRate
  251. end
  252. RoleAttr.updateValue(key,value,bufferAttr,true)
  253. end
  254. else
  255. for j = 1,#conf.args do
  256. local attrData = conf.args[j]
  257. local key = attrData[1]
  258. local value = 0
  259. if not conf.attrRate then
  260. value = attrData[2]
  261. else
  262. value = conf.attrRate
  263. end
  264. RoleAttr.updateValue(key,buffer.arg or (value * buffer.cnt),bufferAttr,true)
  265. end
  266. end
  267. end
  268. if conf.cmd == "xuruo" then
  269. RoleAttr.updateValue(RoleDefine.XURUO,buffer.arg or conf.args[1],bufferAttr,true)
  270. end
  271. if conf.cmd == "fansheZhuangjia" then
  272. RoleAttr.updateValue(RoleDefine.FANSHE_ZHUANGJIA,conf.args[1],bufferAttr,true)
  273. end
  274. if conf.cmd == "hudun" then
  275. RoleAttr.updateValue(RoleDefine.HUDUN_COMBAT, buffer.arg, bufferAttr,true)
  276. end
  277. --标识,给其他英雄加属性的buff
  278. if conf.cmd == "biaoshi" then
  279. local attacker = buffer.attackPos and CombatImpl.objList[buffer.attackPos]
  280. if attacker then
  281. if not changeList[attacker.pos] then
  282. changeList[attacker.pos] = 1
  283. attacker.bufferAttr2[obj.pos] = {}
  284. RoleAttr.initCombatAttr(attacker.bufferAttr2[obj.pos])
  285. end
  286. for j = 1,#conf.args do
  287. local attrData = conf.args[j]
  288. local key = attrData[1]
  289. local value = attrData[2]
  290. RoleAttr.updateValue(key,buffer.arg or (value * buffer.cnt),attacker.bufferAttr2[obj.pos],true)
  291. end
  292. end
  293. end
  294. bufferCmd[conf.cmd] = bufferCmd[conf.cmd] or {}
  295. bufferCmd[conf.cmd][#bufferCmd[conf.cmd] + 1] = i
  296. end
  297. CombatObj.calcAttr(obj)
  298. for pos in pairs(changeList) do
  299. CombatObj.calcAttr(CombatImpl.objList[pos])
  300. end
  301. end
  302. local function canAdd(obj, id, random, attacker, skillConfig)
  303. local conf = BufferExcel.buffer[id]
  304. if not conf then
  305. return
  306. end
  307. -- 非控制buff 走随机
  308. if not isControlCmd(conf.cmd) then
  309. -- 新手剧情 100%控制
  310. if CombatImpl.fightMode[1] == CombatDefine.FIGHT_MODE2 then
  311. random = 10000
  312. end
  313. if random and not Util.checkRandom(random) then
  314. return
  315. end
  316. end
  317. if obj.pos > CombatDefine.COMBAT_HERO_ALL_CNT then
  318. return
  319. end
  320. if obj.hp <= 0 then
  321. if conf.cmd == "revive" then
  322. return true
  323. else
  324. if conf.cmd == "noRevive" then
  325. return true
  326. end
  327. end
  328. return
  329. end
  330. if conf.cmd == "fixPos" then
  331. return true
  332. end
  333. if #conf.jobs > 0 and not isJob(obj,conf.jobs) then
  334. return
  335. end
  336. if conf.camp and #conf.camp > 0 and not isCamp(obj,conf.camp) then
  337. return
  338. end
  339. -- 只能给友方或者敌对方加
  340. if conf.side and conf.side > 0 and isSide(obj, conf.side, attacker) then
  341. return
  342. end
  343. if #conf.status > 0 and not isStatus(obj,conf.status) then
  344. return
  345. end
  346. if #conf.pos > 0 and not isPos(obj,conf.pos) then
  347. return
  348. end
  349. if isMianyi(obj,conf.cmd) then
  350. return
  351. end
  352. if isMiankong(obj,conf.cmd, attacker, random) then
  353. return
  354. end
  355. --连击 BUFF率为 本来的一半
  356. if CombatImpl.comboType > 0 then
  357. local random = math.random(1, 10000)
  358. if random < 5000 then
  359. return
  360. end
  361. end
  362. return true
  363. end
  364. --根据cmd删除buff
  365. local function delBufferByCmd(obj,cmd,cnt)
  366. local delCnt = 0
  367. for j = obj.buffer[0], 1, -1 do
  368. local buffer = obj.buffer[j]
  369. local conf = BufferExcel.buffer[buffer.id]
  370. local bufferCmd = conf.cmd
  371. if bufferCmd == cmd then
  372. local bufferCnt = delBuffer(obj, j)
  373. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  374. delCnt = delCnt + 1
  375. if delCnt == cnt then
  376. return
  377. end
  378. end
  379. end
  380. end
  381. --删除所有buff
  382. local function delAllBuff(obj)
  383. for i = 1, obj.buffer[0] do
  384. obj.buffer[i] = nil
  385. end
  386. obj.buffer[0] = 0
  387. end
  388. --判断是否抵消buff
  389. local function cancelBuffer(obj,conf)
  390. local cancelCmd = conf.cancelCmd[1]
  391. local cnt = conf.cancelCmd[2]
  392. if not (cancelCmd and cnt) then
  393. return
  394. end
  395. local nowCnt = getBuffCnt(obj,cancelCmd)
  396. if cnt < 0 then --全删抵消buff
  397. if nowCnt > 0 then
  398. delBufferByCmd(obj,cancelCmd,cnt)
  399. return true
  400. end
  401. elseif cnt == 0 then--不删抵消buff
  402. if nowCnt > 0 then
  403. return true
  404. end
  405. elseif cnt > 0 then--删指定数量抵消buff
  406. if nowCnt >= cnt then
  407. delBufferByCmd(obj,cancelCmd,cnt)
  408. return true
  409. end
  410. end
  411. end
  412. DELAY_BUFF_OP = false
  413. DELAY_LIST = nil
  414. --不可以延迟加的buffcmd(加的时候可能会触发删除其他buff的cmd)
  415. NO_DELAY_BUFFCMD = {
  416. ["convert"] = 1
  417. }
  418. local function delayBegin()
  419. if DELAY_BUFF_OP then
  420. return
  421. end
  422. DELAY_BUFF_OP = true
  423. DELAY_LIST = {del = {},add = {}}
  424. end
  425. local function delayEnd()
  426. if not DELAY_BUFF_OP then
  427. return
  428. end
  429. table.sort(DELAY_LIST.del,function(a,b)
  430. return a[2] > b[2]
  431. end)
  432. DELAY_BUFF_OP = false
  433. local delRecord = {}
  434. for k,v in ipairs(DELAY_LIST.del) do
  435. delRecord[v[1]] =delRecord[v[1]] or {}
  436. if not delRecord[v[1]][v[2]] then
  437. delBuffer(v[1], v[2])
  438. delRecord[v[1]][v[2]] = 1
  439. end
  440. end
  441. for k,v in ipairs(DELAY_LIST.add) do
  442. addBuffer(v[1],v[2], v[3], v[4],v[5],v[6])
  443. end
  444. DELAY_LIST = {del = {},add = {}}
  445. end
  446. local function beforeAddBuffer(attackPos,obj, id, skillID,arg,parentConf)
  447. local conf = BufferExcel.buffer[id]
  448. local bufferCmd = conf.cmd
  449. if bufferCmd == "fixPos" then
  450. elseif cancelBuffer(obj,conf) then
  451. return true
  452. elseif bufferCmd == "shengling" then
  453. elseif conf.holdOnDie ~= 1 and obj.hp <= 0 then
  454. return true
  455. elseif conf.roundOne == 1 then
  456. for j = obj.buffer[0], 1, -1 do
  457. local buffer = obj.buffer[j]
  458. if buffer.id == id and buffer.attackPos == attackPos and buffer.round == conf.round then
  459. return true
  460. end
  461. end
  462. end
  463. if conf.type == CombatDefine.BUFFER_TYPE4 then
  464. if handler[bufferCmd] then
  465. local attacker = CombatImpl.objList[attackPos]
  466. handler[bufferCmd](attacker,obj,conf)
  467. end
  468. return true
  469. end
  470. if bufferCmd == "convert" then
  471. local bufferList = {}
  472. for j = obj.buffer[0], 1, -1 do
  473. local buffer = obj.buffer[j]
  474. if buffer.id == id then
  475. bufferList[#bufferList + 1] = j
  476. end
  477. end
  478. local needCnt = conf.args[1]
  479. if #bufferList + 1 < needCnt then
  480. return
  481. end
  482. for _,v in ipairs(bufferList) do
  483. local buffer = obj.buffer[v]
  484. local bufferCnt = delBuffer(obj, v)
  485. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  486. end
  487. addBuffer(attackPos,obj, conf.args[2], skillID,arg,parentConf)
  488. return true
  489. end
  490. end
  491. -- 添加到复活列表
  492. local function checkRevive(attackPos,obj,bufferID,skillID)
  493. local conf = BufferExcel.buffer[bufferID]
  494. if conf.cmd ~= "revive" then
  495. return
  496. end
  497. if not canRevive(obj) then
  498. return true
  499. end
  500. CombatImpl.addRevice(attackPos, obj, bufferID, skillID)
  501. return true
  502. end
  503. -- 复活对象
  504. function reviceObj(attackPos, obj, bufferID, skillID)
  505. local conf = BufferExcel.buffer[bufferID]
  506. if not conf then return end
  507. local skillConf = skillID and SkillExcel[skillID]
  508. if not skillConf then return end
  509. local attacker = CombatImpl.objList[attackPos]
  510. local hpRevive = CombatCalc.calcHp(attacker, obj, conf.args[1], conf.args[2], true)
  511. local hpAddRate = CombatObj.getValue(attacker,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
  512. hpRevive = hpRevive * (1 + hpAddRate)
  513. hpRevive = hpRevive < 0 and 1 or hpRevive
  514. local d = CombatObj.updateHp(obj, hpRevive, true, nil, nil, CombatObj.EXTRA_HP_TYPE)
  515. local attrs = {}
  516. attrs[RoleDefine.REVIVE_COMBAT] = attackPos
  517. CombatImpl.setSkillID(attacker, skillID)
  518. CombatImpl.setSkillHit(obj,0, nil, nil, attacker, skillID)
  519. CombatImpl.setSaySkill(attacker.pos,skillConf.id,skillConf.contentType)
  520. CombatImpl.setExtraHit(obj,d,Skill.getCMD2ID("revive"),attrs)
  521. if skillConf and skillConf.type == 0 then
  522. onExtraCombatRecord(attackPos, 1, "reviveBeUse")
  523. else
  524. onExtraCombatRecord(attackPos, 1, "revive")
  525. end
  526. if skillConf.cmd == "revive" then
  527. local buffers = skillConf.args
  528. local addBufferID = buffers[1]
  529. if addBufferID then
  530. local targetMode = buffers[2]
  531. local random = buffers[3]
  532. local targets = TargetMode.getTargets(obj, targetMode)
  533. if #targets > 0 then
  534. for _,target in ipairs(targets) do
  535. if canAdd(target, addBufferID, random, obj, skillConf) then
  536. addBuffer(obj.pos, target, addBufferID, skillConf.id, arg)
  537. end
  538. end
  539. end
  540. end
  541. end
  542. BeSkill.onAddBuffer(obj,{id = bufferID})
  543. end
  544. function addBuffer(attackPos,obj, id, skillID,arg,parentConf)
  545. local conf = BufferExcel.buffer[id]
  546. local bufferCmd = conf.cmd
  547. if DELAY_BUFF_OP then
  548. if not NO_DELAY_BUFFCMD[bufferCmd] then
  549. DELAY_LIST.add[#DELAY_LIST.add + 1] = {attackPos,obj, id, skillID,arg,parentConf}
  550. end
  551. return
  552. end
  553. if checkRevive(attackPos,obj, id, skillID) then
  554. return
  555. end
  556. if beforeAddBuffer(attackPos,obj, id, skillID,arg,parentConf) then
  557. return
  558. end
  559. local bufferCnt = 1
  560. local index
  561. local buffer
  562. local bufferCmdInd
  563. local bufferInd
  564. local tround = 0
  565. local index = 0
  566. local groupCnt = 0
  567. local group = conf.group[1]
  568. for i = 1, obj.buffer[0] do
  569. buffer = obj.buffer[i]
  570. if buffer.id == id then
  571. bufferCnt = bufferCnt + 1
  572. bufferInd = i
  573. if tround > buffer.round or tround == 0 then
  574. tround = buffer.round
  575. index = i
  576. end
  577. end
  578. local nowBuffConf = BufferExcel.buffer[buffer.id]
  579. if nowBuffConf.cmd == bufferCmd then
  580. bufferCmdInd = i
  581. end
  582. if group and group == nowBuffConf.group[1] then
  583. groupCnt = groupCnt + 1
  584. end
  585. end
  586. local groupCmd = conf.group[2]
  587. if groupCmd and groupCnt > 0 and groupCnt >= groupCmd then
  588. return
  589. end
  590. if bufferCnt > 100 then
  591. return
  592. end
  593. local canAppend = parentConf and parentConf.canAppend or conf.canAppend
  594. local round = parentConf and parentConf.round or conf.round
  595. round = round == 0 and 1 or round
  596. if canAppend == 1 then
  597. local appendCnt = conf.appendCnt or 0
  598. if appendCnt > 0 and bufferCnt > conf.appendCnt then
  599. if conf.type == CombatDefine.BUFFER_TYPE2 then
  600. buffer = obj.buffer[index]
  601. buffer.round = round
  602. --bingdong清除buffer参数
  603. if conf.cmd == "bingdong" then
  604. buffer.arg = nil
  605. end
  606. CombatImpl.onAddBuffer(id)
  607. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_ADD,0)
  608. return
  609. end
  610. return
  611. end
  612. else
  613. if bufferCnt > 1 then
  614. if conf.type == CombatDefine.BUFFER_TYPE2 then
  615. buffer = obj.buffer[bufferInd]
  616. buffer.round = round
  617. --bingdong清除buffer参数
  618. if conf.cmd == "bingdong" then
  619. buffer.arg = nil
  620. end
  621. CombatImpl.onAddBuffer(id)
  622. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_ADD,0)
  623. return
  624. end
  625. return
  626. end
  627. end
  628. if isControlCmd(bufferCmd) and bufferCmdInd then
  629. buffer = obj.buffer[bufferCmdInd]
  630. if buffer.round < round then
  631. buffer.round = round
  632. end
  633. if conf.cmd == "bingdong" then
  634. buffer.arg = nil
  635. end
  636. return
  637. end
  638. obj.buffer[0] = obj.buffer[0] + 1
  639. index = obj.buffer[0]
  640. buffer = obj.buffer[index]
  641. if not buffer then
  642. obj.buffer[index] = {}
  643. buffer = obj.buffer[index]
  644. end
  645. buffer.id = id
  646. buffer.round = nil -- 剩余回合
  647. buffer.attrs = nil
  648. buffer.attackPos = nil
  649. buffer.skillID = nil
  650. buffer.cnt = 1
  651. buffer.arg = nil
  652. if round then
  653. buffer.round = round
  654. elseif conf.type == CombatDefine.BUFFER_TYPE1 then
  655. buffer.round = 1
  656. elseif conf.type == CombatDefine.BUFFER_TYPE2 then
  657. buffer.round = round
  658. elseif conf.type == CombatDefine.BUFFER_TYPE3 then
  659. buffer.round = nil
  660. else
  661. assert()
  662. end
  663. local attacker
  664. if attackPos > CombatDefine.COMBAT_HERO_ALL_CNT then
  665. attacker = CombatImpl.helpList[attackPos]
  666. else
  667. attacker = CombatImpl.objList[attackPos]
  668. end
  669. if arg then
  670. buffer.arg = arg
  671. elseif isHpCmd(conf.cmd) then
  672. local isAddHp = conf.cmd == "hp"
  673. buffer.arg = CombatCalc.calcBufferHp(attacker,obj,id,isAddHp)
  674. end
  675. buffer.attackPos = attackPos
  676. buffer.skillID = skillID
  677. buffer.attrs = {}
  678. if bufferCmd == "shengling" then
  679. buffer.arg = conf.args[3]
  680. elseif bufferCmd == "hudun" then
  681. local attackerHp = CombatCalc.calcHp(attacker, obj, conf.args[1], conf.args[2], true)
  682. local hudunValue = math.floor(conf.args[2] * attackerHp / 10000)
  683. buffer.arg = hudunValue
  684. end
  685. onBufferChange(obj)
  686. if conf.isAddCmd == 1 and handler[conf.cmd] then
  687. handler[conf.cmd](obj,buffer,conf)
  688. HANDLER_ONCE[conf.cmd] = nil
  689. end
  690. if conf.type ~= CombatDefine.BUFFER_TYPE1 then
  691. CombatImpl.onAddBuffer(id)
  692. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_ADD)
  693. end
  694. BeSkill.onAddBuffer(obj,buffer)
  695. if bufferCmd == "xuanyun" then
  696. print("======================= xuanyun boss success")
  697. end
  698. onExtraCombatRecord(attackPos,1,bufferCmd)
  699. return buffer
  700. end
  701. local function delBufferByTotem(obj,totemId)
  702. for j = obj.buffer[0], 1, -1 do
  703. local buffer = obj.buffer[j]
  704. local conf = BufferExcel.buffer[buffer.id]
  705. if bufferCmd ~= "totem" and buffer.totem == totemId then
  706. delBuffer(obj,j)
  707. end
  708. end
  709. end
  710. local function beforeDelBuffer(obj, buffer)
  711. local conf = BufferExcel.buffer[buffer.id]
  712. if conf.cmd == "fentan" and buffer.round < 1 then
  713. local hurt = CombatCalc.calcHp(obj, obj, conf.args[1], conf.args[2])
  714. if hurt > 0 then
  715. local d = CombatObj.updateHp(obj, hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  716. CombatImpl.setExtraHit(obj, hurt)
  717. CombatObj.onHpCB(obj, d, obj.pos)
  718. end
  719. end
  720. end
  721. function delBuffer(obj, ind)
  722. if not obj.buffer[ind] then
  723. return
  724. end
  725. if DELAY_BUFF_OP then
  726. for k,v in ipairs(DELAY_LIST.del) do
  727. if v[2] == ind then
  728. return
  729. end
  730. end
  731. DELAY_LIST.del[#DELAY_LIST.del + 1] = {obj, ind}
  732. return
  733. end
  734. local id = obj.buffer[ind].id
  735. beforeDelBuffer(obj,obj.buffer[ind])
  736. obj.buffer[ind] = obj.buffer[obj.buffer[0]]
  737. obj.buffer[obj.buffer[0]] = nil
  738. obj.buffer[0] = obj.buffer[0] - 1
  739. onBufferChange(obj)
  740. local bufferCnt = 0
  741. for i = 1, obj.buffer[0] do
  742. local buffer = obj.buffer[i]
  743. if buffer.id == id then
  744. bufferCnt = bufferCnt + 1
  745. end
  746. end
  747. return bufferCnt
  748. end
  749. -- 战斗回合开始时添加buffer
  750. function beforeCombat()
  751. end
  752. function getSkillBuffers(skillConfig)
  753. local randBuffCnt = skillConfig.otherArgs.randBuffCnt
  754. if not randBuffCnt then
  755. return skillConfig.buffers
  756. end
  757. local ret = {}
  758. local c = #skillConfig.buffers
  759. if randBuffCnt >= c then
  760. return skillConfig.buffers
  761. end
  762. for i = 1,c do
  763. ret[i] = skillConfig.buffers[i]
  764. end
  765. for i = 1,c do
  766. if i <= randBuffCnt then
  767. local r = math.random(i,c)
  768. ret[i],ret[r] = ret[r],ret[i]
  769. else
  770. ret[i] = nil
  771. end
  772. end
  773. return ret
  774. end
  775. -- 战斗回合中触发buffer
  776. function onHit(attacker, skillTargets, skillConfig, cmdTargets, otherArgs)
  777. -- 处理施法者身上的buff
  778. if skillConfig.type == CombatDefine.SKILL_TYPE2 and
  779. attacker.buffer ~= nil then
  780. delayBegin()
  781. for j = attacker.buffer[0], 1, -1 do
  782. local buffer = attacker.buffer[j]
  783. local conf = BufferExcel.buffer[buffer.id]
  784. buffer.attrs = { }
  785. if attacker.hp > 0 and handlerEx[conf.cmd] then
  786. if handlerEx[conf.cmd](attacker, buffer, conf) then
  787. CombatImpl.addFrameBuffer(attacker, buffer, CombatDefine.BUFFER_OP_HOLD)
  788. end
  789. end
  790. end
  791. delayEnd()
  792. end
  793. for k, v in ipairs(skillTargets) do
  794. if attacker.helpType == 0 and attacker.side ~= v.side then
  795. local fantanBufferInd = v.bufferCmd["fantan"] and v.bufferCmd["fantan"][1]
  796. local fantanBuffer = v.buffer[fantanBufferInd]
  797. if fantanBuffer then
  798. local conf = BufferExcel.buffer[fantanBuffer.id]
  799. -- 是否限制技能类型
  800. local bHit = false
  801. if conf.args[3] then
  802. if conf.args[3] == skillConfig.type then
  803. bHit = true
  804. end
  805. else
  806. bHit = true
  807. end
  808. if bHit then
  809. local hurt = CombatCalc.calcHp(attacker, v, conf.args[1], conf.args[2])
  810. local d = CombatObj.updateHp(attacker, - hurt, nil, nil, v.pos, CombatObj.BUFFER_HP_TYPE)
  811. CombatImpl.setExtraHit(attacker, d)
  812. CombatObj.onHpCB(attacker, d, v.pos)
  813. end
  814. end
  815. end
  816. -- 只能敌方攻击触发降低冰冻
  817. if not(otherArgs and otherArgs.noFirst) and skillConfig.hurtRate[1] then
  818. local bufferCmd = v.bufferCmd["bingdong"]
  819. if bufferCmd then
  820. local delList = { }
  821. for i = #bufferCmd, 1, -1 do
  822. local bingdongBuffer = v.buffer[bufferCmd[i]]
  823. local conf = BufferExcel.buffer[bingdongBuffer.id]
  824. bingdongBuffer.arg = bingdongBuffer.arg or 0
  825. bingdongBuffer.arg = bingdongBuffer.arg + 1
  826. if bingdongBuffer.arg >=(conf.args[1] or 0) then
  827. delList[#delList + 1] = bufferCmd[i]
  828. end
  829. end
  830. --冰冻buffer被打碎
  831. if #delList > 0 then
  832. local delBuffer = v.buffer[delList[1]]
  833. BeSkill.onDelBingDongBuffer(v, delBuffer)
  834. end
  835. for k1, v1 in ipairs(delList) do
  836. local buffer = v.buffer[v1]
  837. local bufferCnt = delBuffer(v, v1)
  838. CombatImpl.addFrameBuffer(v, buffer, CombatDefine.BUFFER_OP_DEL)
  839. end
  840. end
  841. end
  842. end
  843. local buffers = getSkillBuffers(skillConfig)
  844. local statusBuffRate = skillConfig.otherArgs.statusBuffRate
  845. for i = 1, #buffers do
  846. local bufferID = buffers[i][1]
  847. if type(bufferID) == "table" then
  848. local r = math.random(1, #bufferID)
  849. bufferID = bufferID[r]
  850. end
  851. local targetMode = buffers[i][2]
  852. local random = buffers[i][3]
  853. local bufferEx = buffers[i][4]
  854. local delayRound = buffers[i][5]
  855. if attacker.isPet and #skillConfig.bufferGrow > 0 then
  856. local growRate = 0
  857. local bufLv = attacker.lv
  858. if attacker.quality > 1 then
  859. bufLv = attacker.lv -(attacker.quality - 1) * 30
  860. end
  861. if skillConfig.bufferGrow and skillConfig.bufferGrow[i] then
  862. local gorwRat = skillConfig.bufferGrow[i][1]
  863. local growLv = skillConfig.bufferGrow[i][2]
  864. growRate = math.floor(bufLv / growLv) * gorwRat
  865. end
  866. random = random + growRate
  867. end
  868. local targets = TargetMode.getTargets(attacker, targetMode, skillTargets, cmdTargets, nil, nil, skillConfig.id)
  869. if #targets > 0 then
  870. local bufferConf = BufferExcel.buffer[bufferID]
  871. for _, target in ipairs(targets) do
  872. local r = random
  873. if statusBuffRate and bufferConf.cmd == statusBuffRate[1] and isStatus(target, statusBuffRate[2]) then
  874. r = r + statusBuffRate[3]
  875. end
  876. if canAdd(target, bufferID, r, attacker, skillConfig) then
  877. local arg
  878. if bufferConf.cmd == "zuzhou" then
  879. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
  880. arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
  881. end
  882. if bufferConf.cmd == "stealattr" then
  883. local value = CombatCalc.calcValue(attacker, target, bufferConf.args[1], bufferConf.args[2])
  884. arg = { { bufferConf.args[3], value } }
  885. end
  886. if bufferConf.cmd == "handleattr" then
  887. arg = { }
  888. if attacker.handleAttr then
  889. local value = attacker.handleAttr[2] *(bufferConf.args[1] / 10000)
  890. if target.side == attacker.side then
  891. arg = { { attacker.handleAttr[1], value * bufferConf.args[2] } }
  892. else
  893. arg = { { attacker.handleAttr[1], - value } }
  894. end
  895. end
  896. end
  897. if delayRound and delayRound > 0 then
  898. target.delayAddBuffer = target.delayAddBuffer or { }
  899. target.delayAddBuffer[#target.delayAddBuffer + 1] = { delayRound, attacker.pos, bufferID, skillConfig.id, arg }
  900. else
  901. addBuffer(attacker.pos, target, bufferID, skillConfig.id, arg)
  902. end
  903. if bufferEx then
  904. local bufferID = bufferEx[1]
  905. local random = bufferEx[2]
  906. local delayRound = bufferEx[3]
  907. local bufferConf = BufferExcel.buffer[bufferID]
  908. for _, target in ipairs(targets) do
  909. local r = random
  910. if canAdd(target, bufferID, r, attacker, skillConfig) then
  911. local arg
  912. if bufferConf.cmd == "zuzhou" then
  913. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
  914. arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
  915. end
  916. if bufferConf.cmd == "stealattr" then
  917. local value = CombatCalc.calcValue(attacker, target, bufferConf.args[1], bufferConf.args[2])
  918. arg = { { bufferConf.args[3], value } }
  919. end
  920. if bufferConf.cmd == "handleattr" then
  921. arg = { }
  922. if attacker.handleAttr then
  923. local value = attacker.handleAttr[2] *(bufferConf.args[1] / 10000)
  924. if target.side == attacker.side then
  925. arg = { { attacker.handleAttr[1], value * bufferConf.args[2] } }
  926. else
  927. arg = { { attacker.handleAttr[1], - value } }
  928. end
  929. end
  930. end
  931. if delayRound and delayRound > 0 then
  932. target.delayAddBuffer = target.delayAddBuffer or { }
  933. target.delayAddBuffer[#target.delayAddBuffer + 1] = { delayRound, attacker.pos, bufferID, skillConfig.id, arg }
  934. else
  935. addBuffer(attacker.pos, target, bufferID, skillConfig.id, arg)
  936. end
  937. end
  938. end
  939. end
  940. end
  941. end
  942. end
  943. end
  944. end
  945. local function getBeskillBuffers(attacker,skillConfig)
  946. if skillConfig.otherArgs.buffer then
  947. local checkArg = skillConfig.otherArgs.buffer
  948. local checkValue
  949. if checkArg.cmd == "hurtRate" then
  950. checkValue = -attacker.combatResult[1]
  951. elseif checkArg.cmd == "hpRate" then
  952. checkValue = attacker.combatResult[2]
  953. end
  954. if checkValue and checkValue > 0 then
  955. local hpMax = attacker.attr[RoleDefine.HP]
  956. local rate = (10000 * checkValue)/(hpMax * checkArg.param[1])
  957. if rate > 1 then
  958. local retArg = {}
  959. for k,v in ipairs(checkArg.param[2]) do
  960. retArg[#retArg + 1] = {v[1],math.floor(v[2] * rate)}
  961. end
  962. return skillConfig.buffers,retArg
  963. end
  964. end
  965. else
  966. return skillConfig.buffers
  967. end
  968. end
  969. function onUseBeSkill(attacker,skillConfig,objs,cmdTargets, arg)--attacker是被动技能释放者,objs是attacker的对立方(attacker是攻击者的话,objs是被攻击者,attacker是被攻击者的话,objs是攻击者),cmdTargets是额外作用对象
  970. local buffers,bufferArg = getBeskillBuffers(attacker,skillConfig)
  971. if not buffers then
  972. return
  973. end
  974. bufferArg = bufferArg or arg
  975. local isAddSkillFrame
  976. local bufferArg1
  977. for i = 1, #buffers do
  978. local bufferID = buffers[i][1]
  979. local bufferConf = BufferExcel.buffer[bufferID]
  980. local targetMode = buffers[i][2]
  981. local targets
  982. bufferArg1 = nil
  983. if targetMode[1] == 13 then
  984. targets = objs
  985. else
  986. targets = TargetMode.getTargets(attacker, targetMode,objs,cmdTargets)
  987. end
  988. if #targets > 0 then
  989. if bufferConf.cmd == "zuzhou" then
  990. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker,bufferID)
  991. bufferArg1 = {CombatCalc.calcHp(attacker,targets[1],bufferConf.args[1],rate)}
  992. end
  993. local attackPos = attacker.pos
  994. if bufferConf.roundOne == 1 and objs and objs[1] then
  995. attackPos = objs[1].pos
  996. end
  997. for _,target in ipairs(targets) do
  998. if canAdd(target,bufferID,buffers[i][3], attacker, skillConfig) then
  999. isAddSkillFrame = true
  1000. addBuffer(attackPos,target, bufferID,skillConfig.id,bufferArg1 or bufferArg)
  1001. end
  1002. end
  1003. end
  1004. end
  1005. return isAddSkillFrame
  1006. end
  1007. --战斗回合结束时处理buffer效果。删除失效buffer
  1008. --只执行一次的cmd,比如持续加血。
  1009. HANDLER_ONCE = HANDLER_ONCE or {}
  1010. function onRoundEnd(attacker,isRoundEnd)
  1011. --处理施法者身上的buff
  1012. for i = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1013. local obj = CombatImpl.objList[i]
  1014. if obj then
  1015. for k,v in pairs(HANDLER_ONCE) do
  1016. HANDLER_ONCE[k] = nil
  1017. end
  1018. delayBegin()
  1019. for j = obj.buffer[0], 1, -1 do
  1020. local buffer = obj.buffer[j]
  1021. local conf = BufferExcel.buffer[buffer.id]
  1022. if conf.type == CombatDefine.BUFFER_TYPE1 or isRoundEnd then
  1023. buffer.attrs = {}
  1024. local setFrame = false
  1025. if conf.type ~= CombatDefine.BUFFER_TYPE4 and handler[conf.cmd] then
  1026. if obj.hp > 0 or conf.cmd == "totem" then
  1027. if conf.cmd == "zuzhou" then
  1028. -- 最后一回合生效
  1029. if buffer.round == 1 then
  1030. handler[conf.cmd](obj, buffer,conf)
  1031. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_HOLD)
  1032. end
  1033. else
  1034. handler[conf.cmd](obj, buffer,conf)
  1035. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_HOLD)
  1036. end
  1037. end
  1038. end
  1039. if buffer.round then
  1040. local cmd = conf.cmd
  1041. buffer.round = buffer.round - 1
  1042. if buffer.round < 1 then
  1043. local bufferCnt = delBuffer(obj, j)
  1044. if (conf.type ~= CombatDefine.BUFFER_TYPE1 and obj.hp > 0) or conf.cmd == "fixPos" or conf.holdOnDie == 1 then
  1045. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1046. end
  1047. end
  1048. end
  1049. end
  1050. end
  1051. if isRoundEnd and obj.delayAddBuffer then
  1052. --{delayRound,attacker.pos,bufferID,skillConfig.id,arg}
  1053. for k,v in ipairs(obj.delayAddBuffer) do
  1054. v[1] = v[1] - 1
  1055. end
  1056. local temp = {}
  1057. for i = 1,#obj.delayAddBuffer do
  1058. local data = obj.delayAddBuffer[i]
  1059. if data[1] > 0 then
  1060. temp[#temp + 1] = data
  1061. else
  1062. addBuffer(data[2],obj,data[3],data[4],data[5])
  1063. end
  1064. end
  1065. if #temp > 0 then
  1066. obj.delayAddBuffer = temp
  1067. else
  1068. obj.delayAddBuffer = nil
  1069. end
  1070. end
  1071. delayEnd()
  1072. end
  1073. end
  1074. for k,v in pairs(HANDLER_ONCE) do
  1075. HANDLER_ONCE[k] = nil
  1076. end
  1077. end
  1078. --攻击结束后,反击前,整合buffer前处理buffer效果
  1079. function beforeFanji()
  1080. local isFanshe = false
  1081. for i = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1082. local obj = CombatImpl.objList[i]
  1083. if obj then
  1084. for k,v in pairs(obj.combatResult[3]) do
  1085. if k ~= i and v[1] and v[1] < 0 then
  1086. local target = CombatImpl.objList[k]
  1087. if target and target.hp > 0 then
  1088. local d = CombatObj.updateHp(target, v[1], nil, nil, obj.pos,CombatObj.BUFFER_HP_TYPE)
  1089. CombatImpl.setExtraHit(target,d)
  1090. CombatObj.onHpCB(target,d, obj.pos)
  1091. isFanshe = true
  1092. end
  1093. end
  1094. end
  1095. if isFanshe then
  1096. delBufferByCmd(obj,"fansheZhuangjia",1)
  1097. end
  1098. end
  1099. end
  1100. end
  1101. function getExtraHurtRate(attacker,target,skillConfig)
  1102. local skillID = skillConfig.id
  1103. local isBaoji = target.isBaoji
  1104. local baojiHurtRate = 0
  1105. local guanxinzheHurtRate = 0
  1106. local huiheHurtRate = 0
  1107. local shandianHurtRate = 0
  1108. local attackerHurtRat = 0
  1109. local biaoshiHurtRate = 0
  1110. local biaoshiCnt = 0
  1111. local biaoshiCntLimit
  1112. if skillConfig.otherArgs.biaoshiHurtRate then
  1113. biaoshiCntLimit = skillConfig.otherArgs.biaoshiHurtRate[1]
  1114. end
  1115. for j = target.buffer[0], 1, -1 do
  1116. local obj = target
  1117. local buffer = obj.buffer[j]
  1118. local conf = BufferExcel.buffer[buffer.id]
  1119. if conf.cmd == "guanxinzheYinji" then --观星者印记
  1120. guanxinzheHurtRate = guanxinzheHurtRate + conf.args[2]
  1121. elseif conf.cmd == "shandianYinji" then --闪电印记
  1122. for _,v in ipairs(conf.args[2]) do
  1123. if skillID == v then
  1124. shandianHurtRate = shandianHurtRate + conf.args[3]
  1125. break
  1126. end
  1127. end
  1128. elseif conf.cmd == "biaoshi" then
  1129. biaoshiCnt = biaoshiCnt + 1
  1130. end
  1131. end
  1132. guanxinzheHurtRate = guanxinzheHurtRate > 30000 and 30000 or guanxinzheHurtRate --300%限制
  1133. if biaoshiCntLimit and biaoshiCnt >= biaoshiCntLimit then
  1134. biaoshiHurtRate = skillConfig.otherArgs.biaoshiHurtRate[2]
  1135. end
  1136. local extraHurtRate = baojiHurtRate + guanxinzheHurtRate + huiheHurtRate + shandianHurtRate + attackerHurtRat + biaoshiHurtRate
  1137. return extraHurtRate
  1138. end
  1139. function getExtraHurt(attacker, target, skillConfig)
  1140. local extraHurt = 0
  1141. for j = target.buffer[0], 1, -1 do
  1142. local obj = target
  1143. local buffer = obj.buffer[j]
  1144. local conf = BufferExcel.buffer[buffer.id]
  1145. if conf.cmd == "shenhuo" then
  1146. local hurt = CombatCalc.calcHp(attacker, target, conf.args[1], conf.args[2], true)
  1147. extraHurt = extraHurt + hurt
  1148. end
  1149. end
  1150. return extraHurt
  1151. end
  1152. --处理器
  1153. local function chixuHurtDel(target,buffer)
  1154. local hurt = buffer.arg
  1155. local hurtDelRate = target.attr[RoleDefine.CHIXU_HURT_DEL_RATE] / 10000
  1156. --持续类buff 伤害加成
  1157. local attacker = CombatImpl.objList[buffer.attackPos]
  1158. local conf = BufferExcel.buffer[buffer.id]
  1159. local beSkillHurtRate = BeSkill.getBuffChixuHurt(attacker, conf.cmd)
  1160. hurtDelRate = hurtDelRate > 1 and 1 or hurtDelRate
  1161. if hurtDelRate > 0 or beSkillHurtRate > 0 then
  1162. hurt = hurt * (1 - hurtDelRate + beSkillHurtRate)
  1163. end
  1164. return hurt
  1165. end
  1166. handler = {}
  1167. --持续伤害
  1168. function handler.hurt(target, buffer,conf)
  1169. local hurt = chixuHurtDel(target,buffer)
  1170. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1171. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1172. end
  1173. --燃烧
  1174. function handler.hurt1(target, buffer,conf)
  1175. local hurt = chixuHurtDel(target,buffer)
  1176. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1177. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1178. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1179. -- 删除attr1 buffer
  1180. local attacker = CombatImpl.objList[buffer.attackPos]
  1181. if attacker and attacker.bufferCmd["attr1"] then
  1182. for i = #attacker.bufferCmd["attr1"],1,-1 do
  1183. local ind = attacker.bufferCmd["attr1"][i]
  1184. local buff = attacker.buffer[ind]
  1185. local conf = BufferExcel.buffer[buff.id]
  1186. local bufferCnt = delBuffer(attacker, ind)
  1187. CombatImpl.addFrameBuffer(attacker, buff, CombatDefine.BUFFER_OP_DEL)
  1188. end
  1189. end
  1190. end
  1191. --持续治疗
  1192. function handler.hp(target, buffer,conf)
  1193. if target.bufferCmd["noHp"] then
  1194. return
  1195. end
  1196. if HANDLER_ONCE["hp"] == target.pos then
  1197. return
  1198. end
  1199. local hp = buffer.arg
  1200. local attacker = CombatImpl.objList[buffer.attackPos]
  1201. if attacker and attacker.attr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
  1202. local hpAddRate = attacker.attr[RoleDefine.ZAOCHENG_HP_ADD_RATE] / 10000
  1203. hp = hp * (1 + hpAddRate)
  1204. end
  1205. local calcType = conf and conf.args[1] or 0
  1206. if CombatCalc.NO_EXCALC_LIST[calcType] and target.attr[RoleDefine.HP_ADD_RATE] then
  1207. local hpAddRate = target.attr[RoleDefine.HP_ADD_RATE] / 10000
  1208. hp = hp * (1 + hpAddRate)
  1209. end
  1210. hp = hp < 0 and 1 or hp
  1211. if target.side == CombatDefine.DEFEND_SIDE then
  1212. hp = CombatImpl.commonArgs.hpLimit or hp
  1213. end
  1214. local d = CombatObj.updateHp(target, hp, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1215. buffer.attrs[RoleDefine.HP_COMBAT] = hp
  1216. HANDLER_ONCE["hp"] = target.pos
  1217. end
  1218. --流血
  1219. function handler.liuxue(target, buffer,conf)
  1220. local hurt = chixuHurtDel(target,buffer)
  1221. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1222. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1223. onExtraCombatRecord(buffer.attackPos,hurt,"liuxue")
  1224. end
  1225. --中毒
  1226. function handler.zhongdu(target, buffer,conf)
  1227. local hurt = chixuHurtDel(target,buffer)
  1228. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1229. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1230. onExtraCombatRecord(buffer.attackPos,hurt,"zhongdu")
  1231. end
  1232. --燃烧
  1233. function handler.ranshao(target, buffer,conf)
  1234. local hurt = chixuHurtDel(target,buffer)
  1235. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1236. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1237. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1238. end
  1239. --燃烧
  1240. function handler.ranshao1(target, buffer,conf)
  1241. local hurt = chixuHurtDel(target,buffer)
  1242. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1243. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1244. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1245. end
  1246. --回合印记
  1247. function handler.huiheYinji(target, buffer,conf)
  1248. if buffer.round > 1 then return end --最后一回合才生效
  1249. local hurt = chixuHurtDel(target,buffer)
  1250. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1251. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1252. end
  1253. --种子
  1254. function handler.zhongzi(target, buffer, conf)
  1255. if buffer.round > 1 then return end --最后一回合才生效
  1256. local cnt = #conf.args
  1257. for i= 1, cnt do
  1258. local bufferID = conf.args[i]
  1259. if canAdd(target,bufferID) then
  1260. addBuffer(buffer.attackPos, target, bufferID)
  1261. end
  1262. end
  1263. end
  1264. --buffer包处理器
  1265. --偷取护甲
  1266. function handler.touquhujia(attacker,target,conf)
  1267. local arg = conf.args[1]/10000
  1268. local targetBufferID = conf.args[2]
  1269. local attackerBufferID = conf.args[3]
  1270. local def = CombatObj.getValue(target,RoleDefine.DEF)
  1271. --local rate = CombatObj.getValue(target,RoleDefine.DEF_RATE)/10000
  1272. --def = def * (1 + rate)
  1273. def = def > 0 and def or 0
  1274. local arg = def * arg
  1275. if arg > 0 then
  1276. if canAdd(attacker,attackerBufferID) then
  1277. addBuffer(target.pos,attacker, attackerBufferID,nil,arg,conf)
  1278. end
  1279. if canAdd(target,targetBufferID) then
  1280. addBuffer(attacker.pos,target, targetBufferID,nil,-arg,conf)
  1281. end
  1282. end
  1283. end
  1284. --偷取攻击
  1285. function handler.touqugongji(attacker,target,conf)
  1286. local arg = conf.args[1]/10000
  1287. local targetBufferID = conf.args[2]
  1288. local attackerBufferID = conf.args[3]
  1289. local atk = CombatObj.getValue(target,RoleDefine.ATK)
  1290. --local rate = CombatObj.getValue(target,RoleDefine.ATK_RATE)/10000
  1291. --def = def * (1 + rate)
  1292. atk = atk > 0 and atk or 0
  1293. local arg = atk * arg
  1294. if arg > 0 then
  1295. if canAdd(attacker,attackerBufferID) then
  1296. addBuffer(target.pos,attacker, attackerBufferID,nil,arg,conf)
  1297. end
  1298. if canAdd(target,targetBufferID) then
  1299. addBuffer(attacker.pos,target, targetBufferID,nil,-arg,conf)
  1300. end
  1301. end
  1302. end
  1303. function handler.totem(obj,buffer,conf)
  1304. --图腾逻辑
  1305. local buffers = conf.args
  1306. for i = 1, #buffers do
  1307. local bufferID = buffers[i][1]
  1308. if type(bufferID) == "table" then
  1309. local r = math.random(1,#bufferID)
  1310. bufferID = bufferID[r]
  1311. end
  1312. local targetMode = buffers[i][2]
  1313. local random = buffers[i][3]
  1314. local targets = TargetMode.getTargets(obj, targetMode,{})
  1315. if #targets > 0 then
  1316. for _,target in ipairs(targets) do
  1317. if canAdd(target,bufferID,random) then
  1318. addBuffer(obj.pos,target, bufferID)
  1319. end
  1320. end
  1321. end
  1322. end
  1323. end
  1324. function handler.groupbuffer(attacker,target,conf)
  1325. for _,bufferID in ipairs(conf.args) do
  1326. if canAdd(target,bufferID) then
  1327. addBuffer(attacker.pos,target, bufferID,nil,nil,conf)
  1328. end
  1329. end
  1330. end
  1331. function handler.zuzhou(target,buffer,conf)
  1332. local hurt = buffer.arg[1]
  1333. local attacker = CombatImpl.objList[buffer.attackPos]
  1334. -- 二次元结算方式调整成
  1335. if BeSkill.getRandomBuffCmd(attacker, target, conf.cmd) and target.bufferCmd[conf.cmd] then
  1336. hurt = hurt * #target.bufferCmd[conf.cmd]
  1337. end
  1338. local beSkillHurtRate = BeSkill.getBuffChixuHurt(attacker, conf.cmd)
  1339. hurt = hurt * (1 + beSkillHurtRate)
  1340. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1341. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1342. BeSkill.handlerBuff(attacker, target, hurt, conf.cmd)
  1343. end
  1344. function yinbaoZuzhou(obj, skillTargets, skillConfig)
  1345. local newFrame = nil
  1346. for k,v in ipairs(skillTargets) do
  1347. if v.bufferCmd["zuzhou"] then
  1348. for i = #v.bufferCmd["zuzhou"],1,-1 do
  1349. local ind = v.bufferCmd["zuzhou"][i]
  1350. local buffer = v.buffer[ind]
  1351. local conf = BufferExcel.buffer[buffer.id]
  1352. if conf and handler[conf.cmd] then
  1353. handler[conf.cmd](v, buffer, conf)
  1354. CombatImpl.addFrameBuffer(v,buffer,CombatDefine.BUFFER_OP_HOLD)
  1355. end
  1356. local bufferCnt = delBuffer(v, ind)
  1357. CombatImpl.addFrameBuffer(v,buffer,CombatDefine.BUFFER_OP_DEL)
  1358. newFrame = true
  1359. end
  1360. end
  1361. end
  1362. -- 有引爆成功的
  1363. if newFrame and ProjectLogic.isSsecy() then
  1364. CombatImpl.addFrame()
  1365. end
  1366. end
  1367. --主动技能释放后buff作用
  1368. handlerEx = {}
  1369. --印记
  1370. function handlerEx.yinJi(target, buffer, conf)
  1371. local attacker = CombatImpl.objList[buffer.attackPos]
  1372. if attacker == nil then
  1373. return
  1374. end
  1375. local hurtRate = conf.args[1]
  1376. local hurtRateMax = conf.args[2]
  1377. local hpMax = CombatObj.getHpMax(target)
  1378. local hurt = hurtRate * hpMax / 10000
  1379. local atk = CombatObj.getValue(attacker,RoleDefine.ATK) * hurtRateMax / 10000
  1380. if hurt > atk then
  1381. hurt = atk
  1382. end
  1383. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1384. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1385. return true
  1386. end
  1387. function qingsuan(target)
  1388. if target.hp <= 0 then
  1389. return 0
  1390. end
  1391. local baseValue = 0
  1392. local round
  1393. for j = target.buffer[0], 1, -1 do
  1394. local buffer = target.buffer[j]
  1395. local conf = BufferExcel.buffer[buffer.id]
  1396. local cmd = conf.cmd
  1397. if cmd == "ranshao" or cmd == "ranshao1" or cmd == "liuxue" or cmd == "zhongdu" or cmd == "hurt" or cmd == "hurt1" then
  1398. round = 1
  1399. if buffer.round and buffer.round > 0 then
  1400. round = buffer.round
  1401. end
  1402. baseValue = baseValue + buffer.arg * round
  1403. local bufferCnt = delBuffer(target, j)
  1404. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1405. end
  1406. end
  1407. return baseValue
  1408. end
  1409. --解控
  1410. function jiekong(target)
  1411. if target.hp <= 0 then
  1412. return 0
  1413. end
  1414. local baseValue = 0
  1415. local state = false
  1416. for j = target.buffer[0], 1, -1 do
  1417. local buffer = target.buffer[j]
  1418. local conf = BufferExcel.buffer[buffer.id]
  1419. local cmd = conf.cmd
  1420. if isControlCmd(cmd) then
  1421. local bufferCnt = delBuffer(target, j)
  1422. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1423. state = true
  1424. end
  1425. end
  1426. if state == true then
  1427. CombatImpl.setExtraHit(target,nil, Skill.getCMD2ID("jiekong"))
  1428. end
  1429. end
  1430. --杀意
  1431. function delShayi(target)
  1432. if target.hp <= 0 then
  1433. return 0
  1434. end
  1435. for j = target.buffer[0], 1, -1 do
  1436. local buffer = target.buffer[j]
  1437. local conf = BufferExcel.buffer[buffer.id]
  1438. local cmd = conf.cmd
  1439. if cmd == "shayi" then
  1440. local bufferCnt = delBuffer(target, j)
  1441. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1442. end
  1443. end
  1444. end
  1445. function getBuffCnt(target,checkCmd)
  1446. if target.hp <= 0 then
  1447. return 0
  1448. end
  1449. local cnt = 0
  1450. for j = target.buffer[0], 1, -1 do
  1451. local buffer = target.buffer[j]
  1452. local conf = BufferExcel.buffer[buffer.id]
  1453. local cmd = conf.cmd
  1454. if cmd == checkCmd then
  1455. cnt = cnt + 1
  1456. end
  1457. end
  1458. return cnt
  1459. end
  1460. -- 获取护盾值
  1461. function getBuffHuDun(obj)
  1462. if obj and obj.bufferAttr and obj.bufferAttr[RoleDefine.HUDUN_COMBAT] then
  1463. return obj.bufferAttr[RoleDefine.HUDUN_COMBAT]
  1464. end
  1465. return 0
  1466. end
  1467. -- 护盾值的修改
  1468. function updateHuDun(obj, value)
  1469. if obj and obj.bufferAttr then
  1470. local oldValue = obj.bufferAttr[RoleDefine.HUDUN_COMBAT] or 0
  1471. local newValue = oldValue + value
  1472. if newValue <= 0 then
  1473. obj.bufferAttr[RoleDefine.HUDUN_COMBAT] = 0
  1474. delBufferByCmd(obj,"hudun", 0)
  1475. else
  1476. obj.bufferAttr[RoleDefine.HUDUN_COMBAT] = newValue
  1477. end
  1478. -- 护盾值没有全部去除 则 在对应英雄上吧 BUF 上的arg 数值 减除 防止 BufChange 重置 属性
  1479. if value < 0 and newValue > 0 then
  1480. if obj and obj.buffer then
  1481. for j = 1 , obj.buffer[0] do -- 从最早的护盾BUF中删除arg
  1482. local buffer = obj.buffer[j]
  1483. local conf = BufferExcel.buffer[buffer.id]
  1484. local bufferCmd = conf.cmd
  1485. if bufferCmd == "hudun" then
  1486. local have = buffer.arg
  1487. if have > -value then
  1488. buffer.arg = have + value
  1489. else
  1490. buffer.arg = 0
  1491. local bufferCnt = delBuffer(obj, j)
  1492. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1493. break
  1494. end
  1495. end
  1496. end
  1497. end
  1498. end
  1499. end
  1500. end
  1501. BUFFER_COMBAT_TYPE = nil
  1502. function initCombatBufferType()
  1503. if BUFFER_COMBAT_TYPE then return end
  1504. BUFFER_COMBAT_TYPE = {}
  1505. for k,conf in pairs(BufferExcel.qusan) do
  1506. if conf then
  1507. BUFFER_COMBAT_TYPE[conf.buffcmd] = conf.type
  1508. end
  1509. end
  1510. end
  1511. --
  1512. function getCombatBufferCnt(target, qusanType)
  1513. initCombatBufferType()
  1514. local buffCnt = 0
  1515. for i = target.buffer[0], 1, -1 do
  1516. local buffer = target.buffer[i]
  1517. local conf = BufferExcel.buffer[buffer.id]
  1518. local cmd = conf.cmd
  1519. if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == qusanType then
  1520. buffCnt = buffCnt + 1
  1521. end
  1522. end
  1523. return buffCnt
  1524. end
  1525. --抵抗
  1526. QUSAN_CMD2KEY = {
  1527. ["zuzhou"] = RoleDefine.STATUS_DIKANG_RATE9,
  1528. }
  1529. function qusan(target, qusanType,cnt)
  1530. if target.isPet or not qusanType then
  1531. return 0
  1532. end
  1533. initCombatBufferType()
  1534. local state = false
  1535. local delIndex = {}
  1536. for i = target.buffer[0], 1, -1 do
  1537. local buffer = target.buffer[i]
  1538. local conf = BufferExcel.buffer[buffer.id]
  1539. local cmd = conf.cmd
  1540. if conf.noQusan ~= 1 then
  1541. if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == qusanType then
  1542. local isDiKang = nil
  1543. local key = QUSAN_CMD2KEY[cmd]
  1544. local r = math.random(1,10000)
  1545. if key and target.attr[key] >= r then
  1546. isDiKang = true
  1547. end
  1548. if not isDiKang then
  1549. delIndex[#delIndex + 1] = i
  1550. end
  1551. elseif cmd == "attr" or cmd == "attrdne" then
  1552. if conf.args and conf.args[1][2] < 0 and qusanType == 1 then
  1553. delIndex[#delIndex + 1] = i
  1554. elseif conf.args and conf.args[1][2] > 0 and qusanType == 2 then
  1555. delIndex[#delIndex + 1] = i
  1556. end
  1557. end
  1558. end
  1559. end
  1560. cnt = cnt or 0
  1561. if cnt > 0 and cnt < #delIndex then
  1562. for i = cnt + 1,#delIndex do
  1563. delIndex[i] = nil
  1564. end
  1565. end
  1566. for k,v in ipairs(delIndex) do
  1567. local buffer = target.buffer[v]
  1568. if not buffer then break end
  1569. local bufferCnt = delBuffer(target, v)
  1570. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1571. end
  1572. return #delIndex
  1573. end
  1574. function qusanAddBuff(attacker, targets, bufferID)
  1575. for _,target in ipairs(targets) do
  1576. if canAdd(target,bufferID) then
  1577. addBuffer(attacker.pos, target, bufferID)
  1578. end
  1579. end
  1580. end
  1581. function beforeUpdateHp(obj,sum)
  1582. local isStatus,cmd,ind = isStatus(obj,{"miansi","waitMiansi"})
  1583. if not isStatus then
  1584. return
  1585. end
  1586. --免死逻辑
  1587. if cmd == "miansi" then
  1588. return true
  1589. end
  1590. if sum == 0 and cmd == "waitMiansi" then
  1591. local buffer = obj.buffer[ind]
  1592. local bufferCnt = delBuffer(obj, ind)
  1593. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1594. local conf = BufferExcel.buffer[buffer.id]
  1595. local bufferID = conf.args[1]
  1596. if canAdd(obj,bufferID) then
  1597. addBuffer(obj.pos,obj, bufferID)
  1598. end
  1599. return true
  1600. end
  1601. end
  1602. function checkBaohu(obj,value)
  1603. local isStatus,cmd,ind = isStatus(obj,{"baohu"})
  1604. if not isStatus then
  1605. return value
  1606. end
  1607. local buffer = obj.buffer[ind]
  1608. local attackPos = buffer.attackPos
  1609. local attacker = CombatImpl.objList[attackPos]
  1610. if attacker.hp <= 0 then
  1611. return value
  1612. end
  1613. value = BeSkill.onCheckBuffer(attacker,obj,value)
  1614. return value
  1615. end
  1616. function onExtraCombatRecord(pos,value,param)
  1617. local obj = CombatObj.getObjByPos(pos)
  1618. if not obj then return end
  1619. obj.extraCombatRecord = obj.extraCombatRecord or {}
  1620. if param == "zhongdu" then
  1621. obj.extraCombatRecord.zhongdu = (obj.extraCombatRecord.zhongdu or 0) + value
  1622. elseif param == "liuxue" then
  1623. obj.extraCombatRecord.liuxue = (obj.extraCombatRecord.liuxue or 0) + value
  1624. elseif param == "ranshao" then
  1625. obj.extraCombatRecord.ranshao = (obj.extraCombatRecord.ranshao or 0) + value
  1626. elseif param == "xuanyun" then
  1627. obj.extraCombatRecord.xuanyun = (obj.extraCombatRecord.xuanyun or 0) + value
  1628. elseif param == "revive" then
  1629. obj.extraCombatRecord.revive = (obj.extraCombatRecord.revive or 0) + value
  1630. elseif param == "reviveBeUse" then
  1631. obj.extraCombatRecord.reviveBeUse = (obj.extraCombatRecord.reviveBeUse or 0) + value
  1632. elseif param == "kill" then
  1633. obj.extraCombatRecord.kill = (obj.extraCombatRecord.kill or 0) + value
  1634. end
  1635. end