CombatBuff.lua 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808
  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. onExtraCombatRecord(attackPos,1,bufferCmd)
  696. return buffer
  697. end
  698. local function delBufferByTotem(obj,totemId)
  699. for j = obj.buffer[0], 1, -1 do
  700. local buffer = obj.buffer[j]
  701. local conf = BufferExcel.buffer[buffer.id]
  702. if bufferCmd ~= "totem" and buffer.totem == totemId then
  703. delBuffer(obj,j)
  704. end
  705. end
  706. end
  707. local function beforeDelBuffer(obj, buffer)
  708. local conf = BufferExcel.buffer[buffer.id]
  709. if conf.cmd == "fentan" and buffer.round < 1 then
  710. local hurt = CombatCalc.calcHp(obj, obj, conf.args[1], conf.args[2])
  711. if hurt > 0 then
  712. local d = CombatObj.updateHp(obj, hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  713. CombatImpl.setExtraHit(obj, hurt)
  714. CombatObj.onHpCB(obj, d, obj.pos)
  715. end
  716. end
  717. end
  718. function delBuffer(obj, ind)
  719. if not obj.buffer[ind] then
  720. return
  721. end
  722. if DELAY_BUFF_OP then
  723. for k,v in ipairs(DELAY_LIST.del) do
  724. if v[2] == ind then
  725. return
  726. end
  727. end
  728. DELAY_LIST.del[#DELAY_LIST.del + 1] = {obj, ind}
  729. return
  730. end
  731. local id = obj.buffer[ind].id
  732. beforeDelBuffer(obj,obj.buffer[ind])
  733. obj.buffer[ind] = obj.buffer[obj.buffer[0]]
  734. obj.buffer[obj.buffer[0]] = nil
  735. obj.buffer[0] = obj.buffer[0] - 1
  736. onBufferChange(obj)
  737. local bufferCnt = 0
  738. for i = 1, obj.buffer[0] do
  739. local buffer = obj.buffer[i]
  740. if buffer.id == id then
  741. bufferCnt = bufferCnt + 1
  742. end
  743. end
  744. return bufferCnt
  745. end
  746. -- 战斗回合开始时添加buffer
  747. function beforeCombat()
  748. end
  749. function getSkillBuffers(skillConfig)
  750. local randBuffCnt = skillConfig.otherArgs.randBuffCnt
  751. if not randBuffCnt then
  752. return skillConfig.buffers
  753. end
  754. local ret = {}
  755. local c = #skillConfig.buffers
  756. if randBuffCnt >= c then
  757. return skillConfig.buffers
  758. end
  759. for i = 1,c do
  760. ret[i] = skillConfig.buffers[i]
  761. end
  762. for i = 1,c do
  763. if i <= randBuffCnt then
  764. local r = math.random(i,c)
  765. ret[i],ret[r] = ret[r],ret[i]
  766. else
  767. ret[i] = nil
  768. end
  769. end
  770. return ret
  771. end
  772. -- 战斗回合中触发buffer
  773. function onHit(attacker, skillTargets, skillConfig, cmdTargets, otherArgs)
  774. -- 处理施法者身上的buff
  775. if skillConfig.type == CombatDefine.SKILL_TYPE2 and
  776. attacker.buffer ~= nil then
  777. delayBegin()
  778. for j = attacker.buffer[0], 1, -1 do
  779. local buffer = attacker.buffer[j]
  780. local conf = BufferExcel.buffer[buffer.id]
  781. buffer.attrs = { }
  782. if attacker.hp > 0 and handlerEx[conf.cmd] then
  783. if handlerEx[conf.cmd](attacker, buffer, conf) then
  784. CombatImpl.addFrameBuffer(attacker, buffer, CombatDefine.BUFFER_OP_HOLD)
  785. end
  786. end
  787. end
  788. delayEnd()
  789. end
  790. for k, v in ipairs(skillTargets) do
  791. if attacker.helpType == 0 and attacker.side ~= v.side then
  792. local fantanBufferInd = v.bufferCmd["fantan"] and v.bufferCmd["fantan"][1]
  793. local fantanBuffer = v.buffer[fantanBufferInd]
  794. if fantanBuffer then
  795. local conf = BufferExcel.buffer[fantanBuffer.id]
  796. -- 是否限制技能类型
  797. local bHit = false
  798. if conf.args[3] then
  799. if conf.args[3] == skillConfig.type then
  800. bHit = true
  801. end
  802. else
  803. bHit = true
  804. end
  805. if bHit then
  806. local hurt = CombatCalc.calcHp(attacker, v, conf.args[1], conf.args[2])
  807. local d = CombatObj.updateHp(attacker, - hurt, nil, nil, v.pos, CombatObj.BUFFER_HP_TYPE)
  808. CombatImpl.setExtraHit(attacker, d)
  809. CombatObj.onHpCB(attacker, d, v.pos)
  810. end
  811. end
  812. end
  813. -- 只能敌方攻击触发降低冰冻
  814. if not(otherArgs and otherArgs.noFirst) and skillConfig.hurtRate[1] then
  815. local bufferCmd = v.bufferCmd["bingdong"]
  816. if bufferCmd then
  817. local delList = { }
  818. for i = #bufferCmd, 1, -1 do
  819. local bingdongBuffer = v.buffer[bufferCmd[i]]
  820. local conf = BufferExcel.buffer[bingdongBuffer.id]
  821. bingdongBuffer.arg = bingdongBuffer.arg or 0
  822. bingdongBuffer.arg = bingdongBuffer.arg + 1
  823. if bingdongBuffer.arg >=(conf.args[1] or 0) then
  824. delList[#delList + 1] = bufferCmd[i]
  825. end
  826. end
  827. --冰冻buffer被打碎
  828. if #delList > 0 then
  829. local delBuffer = v.buffer[delList[1]]
  830. BeSkill.onDelBingDongBuffer(v, delBuffer)
  831. end
  832. for k1, v1 in ipairs(delList) do
  833. local buffer = v.buffer[v1]
  834. local bufferCnt = delBuffer(v, v1)
  835. CombatImpl.addFrameBuffer(v, buffer, CombatDefine.BUFFER_OP_DEL)
  836. end
  837. end
  838. end
  839. end
  840. local buffers = getSkillBuffers(skillConfig)
  841. local statusBuffRate = skillConfig.otherArgs.statusBuffRate
  842. for i = 1, #buffers do
  843. local bufferID = buffers[i][1]
  844. if type(bufferID) == "table" then
  845. local r = math.random(1, #bufferID)
  846. bufferID = bufferID[r]
  847. end
  848. local targetMode = buffers[i][2]
  849. local random = buffers[i][3]
  850. local bufferEx = buffers[i][4]
  851. local delayRound = buffers[i][5]
  852. if attacker.isPet and #skillConfig.bufferGrow > 0 then
  853. local growRate = 0
  854. local bufLv = attacker.lv
  855. if attacker.quality > 1 then
  856. bufLv = attacker.lv -(attacker.quality - 1) * 30
  857. end
  858. if skillConfig.bufferGrow and skillConfig.bufferGrow[i] then
  859. local gorwRat = skillConfig.bufferGrow[i][1]
  860. local growLv = skillConfig.bufferGrow[i][2]
  861. growRate = math.floor(bufLv / growLv) * gorwRat
  862. end
  863. random = random + growRate
  864. end
  865. local targets = TargetMode.getTargets(attacker, targetMode, skillTargets, cmdTargets, nil, nil, skillConfig.id)
  866. if #targets > 0 then
  867. local bufferConf = BufferExcel.buffer[bufferID]
  868. for _, target in ipairs(targets) do
  869. local r = random
  870. if statusBuffRate and bufferConf.cmd == statusBuffRate[1] and isStatus(target, statusBuffRate[2]) then
  871. r = r + statusBuffRate[3]
  872. end
  873. if canAdd(target, bufferID, r, attacker, skillConfig) then
  874. local arg
  875. if bufferConf.cmd == "zuzhou" then
  876. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
  877. arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
  878. end
  879. if bufferConf.cmd == "stealattr" then
  880. local value = CombatCalc.calcValue(attacker, target, bufferConf.args[1], bufferConf.args[2])
  881. arg = { { bufferConf.args[3], value } }
  882. end
  883. if bufferConf.cmd == "handleattr" then
  884. arg = { }
  885. if attacker.handleAttr then
  886. local value = attacker.handleAttr[2] *(bufferConf.args[1] / 10000)
  887. if target.side == attacker.side then
  888. arg = { { attacker.handleAttr[1], value * bufferConf.args[2] } }
  889. else
  890. arg = { { attacker.handleAttr[1], - value } }
  891. end
  892. end
  893. end
  894. if delayRound and delayRound > 0 then
  895. target.delayAddBuffer = target.delayAddBuffer or { }
  896. target.delayAddBuffer[#target.delayAddBuffer + 1] = { delayRound, attacker.pos, bufferID, skillConfig.id, arg }
  897. else
  898. addBuffer(attacker.pos, target, bufferID, skillConfig.id, arg)
  899. end
  900. if bufferEx then
  901. local bufferID = bufferEx[1]
  902. local random = bufferEx[2]
  903. local delayRound = bufferEx[3]
  904. local bufferConf = BufferExcel.buffer[bufferID]
  905. for _, target in ipairs(targets) do
  906. local r = random
  907. if canAdd(target, bufferID, r, attacker, skillConfig) then
  908. local arg
  909. if bufferConf.cmd == "zuzhou" then
  910. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker, bufferID, bufferConf.cmd)
  911. arg = { CombatCalc.calcHp(attacker, target, bufferConf.args[1], rate) }
  912. end
  913. if bufferConf.cmd == "stealattr" then
  914. local value = CombatCalc.calcValue(attacker, target, bufferConf.args[1], bufferConf.args[2])
  915. arg = { { bufferConf.args[3], value } }
  916. end
  917. if bufferConf.cmd == "handleattr" then
  918. arg = { }
  919. if attacker.handleAttr then
  920. local value = attacker.handleAttr[2] *(bufferConf.args[1] / 10000)
  921. if target.side == attacker.side then
  922. arg = { { attacker.handleAttr[1], value * bufferConf.args[2] } }
  923. else
  924. arg = { { attacker.handleAttr[1], - value } }
  925. end
  926. end
  927. end
  928. if delayRound and delayRound > 0 then
  929. target.delayAddBuffer = target.delayAddBuffer or { }
  930. target.delayAddBuffer[#target.delayAddBuffer + 1] = { delayRound, attacker.pos, bufferID, skillConfig.id, arg }
  931. else
  932. addBuffer(attacker.pos, target, bufferID, skillConfig.id, arg)
  933. end
  934. end
  935. end
  936. end
  937. end
  938. end
  939. end
  940. end
  941. end
  942. local function getBeskillBuffers(attacker,skillConfig)
  943. if skillConfig.otherArgs.buffer then
  944. local checkArg = skillConfig.otherArgs.buffer
  945. local checkValue
  946. if checkArg.cmd == "hurtRate" then
  947. checkValue = -attacker.combatResult[1]
  948. elseif checkArg.cmd == "hpRate" then
  949. checkValue = attacker.combatResult[2]
  950. end
  951. if checkValue and checkValue > 0 then
  952. local hpMax = attacker.attr[RoleDefine.HP]
  953. local rate = (10000 * checkValue)/(hpMax * checkArg.param[1])
  954. if rate > 1 then
  955. local retArg = {}
  956. for k,v in ipairs(checkArg.param[2]) do
  957. retArg[#retArg + 1] = {v[1],math.floor(v[2] * rate)}
  958. end
  959. return skillConfig.buffers,retArg
  960. end
  961. end
  962. else
  963. return skillConfig.buffers
  964. end
  965. end
  966. function onUseBeSkill(attacker,skillConfig,objs,cmdTargets, arg)--attacker是被动技能释放者,objs是attacker的对立方(attacker是攻击者的话,objs是被攻击者,attacker是被攻击者的话,objs是攻击者),cmdTargets是额外作用对象
  967. local buffers,bufferArg = getBeskillBuffers(attacker,skillConfig)
  968. if not buffers then
  969. return
  970. end
  971. bufferArg = bufferArg or arg
  972. local isAddSkillFrame
  973. local bufferArg1
  974. for i = 1, #buffers do
  975. local bufferID = buffers[i][1]
  976. local bufferConf = BufferExcel.buffer[bufferID]
  977. local targetMode = buffers[i][2]
  978. local targets
  979. bufferArg1 = nil
  980. if targetMode[1] == 13 then
  981. targets = objs
  982. else
  983. targets = TargetMode.getTargets(attacker, targetMode,objs,cmdTargets)
  984. end
  985. if #targets > 0 then
  986. if bufferConf.cmd == "zuzhou" then
  987. local rate = bufferConf.args[2] + BeSkill.getBufferExtraHurt(attacker,bufferID)
  988. bufferArg1 = {CombatCalc.calcHp(attacker,targets[1],bufferConf.args[1],rate)}
  989. end
  990. local attackPos = attacker.pos
  991. if bufferConf.roundOne == 1 and objs and objs[1] then
  992. attackPos = objs[1].pos
  993. end
  994. for _,target in ipairs(targets) do
  995. if canAdd(target,bufferID,buffers[i][3], attacker, skillConfig) then
  996. isAddSkillFrame = true
  997. addBuffer(attackPos,target, bufferID,skillConfig.id,bufferArg1 or bufferArg)
  998. end
  999. end
  1000. end
  1001. end
  1002. return isAddSkillFrame
  1003. end
  1004. --战斗回合结束时处理buffer效果。删除失效buffer
  1005. --只执行一次的cmd,比如持续加血。
  1006. HANDLER_ONCE = HANDLER_ONCE or {}
  1007. function onRoundEnd(attacker,isRoundEnd)
  1008. --处理施法者身上的buff
  1009. for i = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1010. local obj = CombatImpl.objList[i]
  1011. if obj then
  1012. for k,v in pairs(HANDLER_ONCE) do
  1013. HANDLER_ONCE[k] = nil
  1014. end
  1015. delayBegin()
  1016. for j = obj.buffer[0], 1, -1 do
  1017. local buffer = obj.buffer[j]
  1018. local conf = BufferExcel.buffer[buffer.id]
  1019. if conf.type == CombatDefine.BUFFER_TYPE1 or isRoundEnd then
  1020. buffer.attrs = {}
  1021. local setFrame = false
  1022. if conf.type ~= CombatDefine.BUFFER_TYPE4 and handler[conf.cmd] then
  1023. if obj.hp > 0 or conf.cmd == "totem" then
  1024. if conf.cmd == "zuzhou" then
  1025. -- 最后一回合生效
  1026. if buffer.round == 1 then
  1027. handler[conf.cmd](obj, buffer,conf)
  1028. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_HOLD)
  1029. end
  1030. else
  1031. handler[conf.cmd](obj, buffer,conf)
  1032. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_HOLD)
  1033. end
  1034. end
  1035. end
  1036. if buffer.round then
  1037. local cmd = conf.cmd
  1038. buffer.round = buffer.round - 1
  1039. if buffer.round < 1 then
  1040. local bufferCnt = delBuffer(obj, j)
  1041. if (conf.type ~= CombatDefine.BUFFER_TYPE1 and obj.hp > 0) or conf.cmd == "fixPos" or conf.holdOnDie == 1 then
  1042. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1043. end
  1044. end
  1045. end
  1046. end
  1047. end
  1048. if isRoundEnd and obj.delayAddBuffer then
  1049. --{delayRound,attacker.pos,bufferID,skillConfig.id,arg}
  1050. for k,v in ipairs(obj.delayAddBuffer) do
  1051. v[1] = v[1] - 1
  1052. end
  1053. local temp = {}
  1054. for i = 1,#obj.delayAddBuffer do
  1055. local data = obj.delayAddBuffer[i]
  1056. if data[1] > 0 then
  1057. temp[#temp + 1] = data
  1058. else
  1059. addBuffer(data[2],obj,data[3],data[4],data[5])
  1060. end
  1061. end
  1062. if #temp > 0 then
  1063. obj.delayAddBuffer = temp
  1064. else
  1065. obj.delayAddBuffer = nil
  1066. end
  1067. end
  1068. delayEnd()
  1069. end
  1070. end
  1071. for k,v in pairs(HANDLER_ONCE) do
  1072. HANDLER_ONCE[k] = nil
  1073. end
  1074. end
  1075. --攻击结束后,反击前,整合buffer前处理buffer效果
  1076. function beforeFanji()
  1077. local isFanshe = false
  1078. for i = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1079. local obj = CombatImpl.objList[i]
  1080. if obj then
  1081. for k,v in pairs(obj.combatResult[3]) do
  1082. if k ~= i and v[1] and v[1] < 0 then
  1083. local target = CombatImpl.objList[k]
  1084. if target and target.hp > 0 then
  1085. local d = CombatObj.updateHp(target, v[1], nil, nil, obj.pos,CombatObj.BUFFER_HP_TYPE)
  1086. CombatImpl.setExtraHit(target,d)
  1087. CombatObj.onHpCB(target,d, obj.pos)
  1088. isFanshe = true
  1089. end
  1090. end
  1091. end
  1092. if isFanshe then
  1093. delBufferByCmd(obj,"fansheZhuangjia",1)
  1094. end
  1095. end
  1096. end
  1097. end
  1098. function getExtraHurtRate(attacker,target,skillConfig)
  1099. local skillID = skillConfig.id
  1100. local isBaoji = target.isBaoji
  1101. local baojiHurtRate = 0
  1102. local guanxinzheHurtRate = 0
  1103. local huiheHurtRate = 0
  1104. local shandianHurtRate = 0
  1105. local attackerHurtRat = 0
  1106. local biaoshiHurtRate = 0
  1107. local biaoshiCnt = 0
  1108. local biaoshiCntLimit
  1109. if skillConfig.otherArgs.biaoshiHurtRate then
  1110. biaoshiCntLimit = skillConfig.otherArgs.biaoshiHurtRate[1]
  1111. end
  1112. for j = target.buffer[0], 1, -1 do
  1113. local obj = target
  1114. local buffer = obj.buffer[j]
  1115. local conf = BufferExcel.buffer[buffer.id]
  1116. if conf.cmd == "guanxinzheYinji" then --观星者印记
  1117. guanxinzheHurtRate = guanxinzheHurtRate + conf.args[2]
  1118. elseif conf.cmd == "shandianYinji" then --闪电印记
  1119. for _,v in ipairs(conf.args[2]) do
  1120. if skillID == v then
  1121. shandianHurtRate = shandianHurtRate + conf.args[3]
  1122. break
  1123. end
  1124. end
  1125. elseif conf.cmd == "biaoshi" then
  1126. biaoshiCnt = biaoshiCnt + 1
  1127. end
  1128. end
  1129. guanxinzheHurtRate = guanxinzheHurtRate > 30000 and 30000 or guanxinzheHurtRate --300%限制
  1130. if biaoshiCntLimit and biaoshiCnt >= biaoshiCntLimit then
  1131. biaoshiHurtRate = skillConfig.otherArgs.biaoshiHurtRate[2]
  1132. end
  1133. local extraHurtRate = baojiHurtRate + guanxinzheHurtRate + huiheHurtRate + shandianHurtRate + attackerHurtRat + biaoshiHurtRate
  1134. return extraHurtRate
  1135. end
  1136. function getExtraHurt(attacker, target, skillConfig)
  1137. local extraHurt = 0
  1138. for j = target.buffer[0], 1, -1 do
  1139. local obj = target
  1140. local buffer = obj.buffer[j]
  1141. local conf = BufferExcel.buffer[buffer.id]
  1142. if conf.cmd == "shenhuo" then
  1143. local hurt = CombatCalc.calcHp(attacker, target, conf.args[1], conf.args[2], true)
  1144. extraHurt = extraHurt + hurt
  1145. end
  1146. end
  1147. return extraHurt
  1148. end
  1149. --处理器
  1150. local function chixuHurtDel(target,buffer)
  1151. local hurt = buffer.arg
  1152. local hurtDelRate = target.attr[RoleDefine.CHIXU_HURT_DEL_RATE] / 10000
  1153. --持续类buff 伤害加成
  1154. local attacker = CombatImpl.objList[buffer.attackPos]
  1155. local conf = BufferExcel.buffer[buffer.id]
  1156. local beSkillHurtRate = BeSkill.getBuffChixuHurt(attacker, conf.cmd)
  1157. hurtDelRate = hurtDelRate > 1 and 1 or hurtDelRate
  1158. if hurtDelRate > 0 or beSkillHurtRate > 0 then
  1159. hurt = hurt * (1 - hurtDelRate + beSkillHurtRate)
  1160. end
  1161. return hurt
  1162. end
  1163. handler = {}
  1164. --持续伤害
  1165. function handler.hurt(target, buffer,conf)
  1166. local hurt = chixuHurtDel(target,buffer)
  1167. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1168. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1169. end
  1170. --燃烧
  1171. function handler.hurt1(target, buffer,conf)
  1172. local hurt = chixuHurtDel(target,buffer)
  1173. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1174. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1175. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1176. -- 删除attr1 buffer
  1177. local attacker = CombatImpl.objList[buffer.attackPos]
  1178. if attacker and attacker.bufferCmd["attr1"] then
  1179. for i = #attacker.bufferCmd["attr1"],1,-1 do
  1180. local ind = attacker.bufferCmd["attr1"][i]
  1181. local buff = attacker.buffer[ind]
  1182. local conf = BufferExcel.buffer[buff.id]
  1183. local bufferCnt = delBuffer(attacker, ind)
  1184. CombatImpl.addFrameBuffer(attacker, buff, CombatDefine.BUFFER_OP_DEL)
  1185. end
  1186. end
  1187. end
  1188. --持续治疗
  1189. function handler.hp(target, buffer,conf)
  1190. if target.bufferCmd["noHp"] then
  1191. return
  1192. end
  1193. if HANDLER_ONCE["hp"] == target.pos then
  1194. return
  1195. end
  1196. local hp = buffer.arg
  1197. local attacker = CombatImpl.objList[buffer.attackPos]
  1198. if attacker and attacker.attr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
  1199. local hpAddRate = attacker.attr[RoleDefine.ZAOCHENG_HP_ADD_RATE] / 10000
  1200. hp = hp * (1 + hpAddRate)
  1201. end
  1202. local calcType = conf and conf.args[1] or 0
  1203. if CombatCalc.NO_EXCALC_LIST[calcType] and target.attr[RoleDefine.HP_ADD_RATE] then
  1204. local hpAddRate = target.attr[RoleDefine.HP_ADD_RATE] / 10000
  1205. hp = hp * (1 + hpAddRate)
  1206. end
  1207. hp = hp < 0 and 1 or hp
  1208. if target.side == CombatDefine.DEFEND_SIDE then
  1209. hp = CombatImpl.commonArgs.hpLimit or hp
  1210. end
  1211. local d = CombatObj.updateHp(target, hp, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1212. buffer.attrs[RoleDefine.HP_COMBAT] = hp
  1213. HANDLER_ONCE["hp"] = target.pos
  1214. end
  1215. --流血
  1216. function handler.liuxue(target, buffer,conf)
  1217. local hurt = chixuHurtDel(target,buffer)
  1218. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1219. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1220. onExtraCombatRecord(buffer.attackPos,hurt,"liuxue")
  1221. end
  1222. --中毒
  1223. function handler.zhongdu(target, buffer,conf)
  1224. local hurt = chixuHurtDel(target,buffer)
  1225. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1226. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1227. onExtraCombatRecord(buffer.attackPos,hurt,"zhongdu")
  1228. end
  1229. --燃烧
  1230. function handler.ranshao(target, buffer,conf)
  1231. local hurt = chixuHurtDel(target,buffer)
  1232. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1233. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1234. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1235. end
  1236. --燃烧
  1237. function handler.ranshao1(target, buffer,conf)
  1238. local hurt = chixuHurtDel(target,buffer)
  1239. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1240. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1241. onExtraCombatRecord(buffer.attackPos,hurt,"ranshao")
  1242. end
  1243. --回合印记
  1244. function handler.huiheYinji(target, buffer,conf)
  1245. if buffer.round > 1 then return end --最后一回合才生效
  1246. local hurt = chixuHurtDel(target,buffer)
  1247. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1248. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1249. end
  1250. --种子
  1251. function handler.zhongzi(target, buffer, conf)
  1252. if buffer.round > 1 then return end --最后一回合才生效
  1253. local cnt = #conf.args
  1254. for i= 1, cnt do
  1255. local bufferID = conf.args[i]
  1256. if canAdd(target,bufferID) then
  1257. addBuffer(buffer.attackPos, target, bufferID)
  1258. end
  1259. end
  1260. end
  1261. --buffer包处理器
  1262. --偷取护甲
  1263. function handler.touquhujia(attacker,target,conf)
  1264. local arg = conf.args[1]/10000
  1265. local targetBufferID = conf.args[2]
  1266. local attackerBufferID = conf.args[3]
  1267. local def = CombatObj.getValue(target,RoleDefine.DEF)
  1268. --local rate = CombatObj.getValue(target,RoleDefine.DEF_RATE)/10000
  1269. --def = def * (1 + rate)
  1270. def = def > 0 and def or 0
  1271. local arg = def * arg
  1272. if arg > 0 then
  1273. if canAdd(attacker,attackerBufferID) then
  1274. addBuffer(target.pos,attacker, attackerBufferID,nil,arg,conf)
  1275. end
  1276. if canAdd(target,targetBufferID) then
  1277. addBuffer(attacker.pos,target, targetBufferID,nil,-arg,conf)
  1278. end
  1279. end
  1280. end
  1281. --偷取攻击
  1282. function handler.touqugongji(attacker,target,conf)
  1283. local arg = conf.args[1]/10000
  1284. local targetBufferID = conf.args[2]
  1285. local attackerBufferID = conf.args[3]
  1286. local atk = CombatObj.getValue(target,RoleDefine.ATK)
  1287. --local rate = CombatObj.getValue(target,RoleDefine.ATK_RATE)/10000
  1288. --def = def * (1 + rate)
  1289. atk = atk > 0 and atk or 0
  1290. local arg = atk * arg
  1291. if arg > 0 then
  1292. if canAdd(attacker,attackerBufferID) then
  1293. addBuffer(target.pos,attacker, attackerBufferID,nil,arg,conf)
  1294. end
  1295. if canAdd(target,targetBufferID) then
  1296. addBuffer(attacker.pos,target, targetBufferID,nil,-arg,conf)
  1297. end
  1298. end
  1299. end
  1300. function handler.totem(obj,buffer,conf)
  1301. --图腾逻辑
  1302. local buffers = conf.args
  1303. for i = 1, #buffers do
  1304. local bufferID = buffers[i][1]
  1305. if type(bufferID) == "table" then
  1306. local r = math.random(1,#bufferID)
  1307. bufferID = bufferID[r]
  1308. end
  1309. local targetMode = buffers[i][2]
  1310. local random = buffers[i][3]
  1311. local targets = TargetMode.getTargets(obj, targetMode,{})
  1312. if #targets > 0 then
  1313. for _,target in ipairs(targets) do
  1314. if canAdd(target,bufferID,random) then
  1315. addBuffer(obj.pos,target, bufferID)
  1316. end
  1317. end
  1318. end
  1319. end
  1320. end
  1321. function handler.groupbuffer(attacker,target,conf)
  1322. for _,bufferID in ipairs(conf.args) do
  1323. if canAdd(target,bufferID) then
  1324. addBuffer(attacker.pos,target, bufferID,nil,nil,conf)
  1325. end
  1326. end
  1327. end
  1328. function handler.zuzhou(target,buffer,conf)
  1329. local hurt = buffer.arg[1]
  1330. local attacker = CombatImpl.objList[buffer.attackPos]
  1331. -- 二次元结算方式调整成
  1332. if BeSkill.getRandomBuffCmd(attacker, target, conf.cmd) and target.bufferCmd[conf.cmd] then
  1333. hurt = hurt * #target.bufferCmd[conf.cmd]
  1334. end
  1335. local beSkillHurtRate = BeSkill.getBuffChixuHurt(attacker, conf.cmd)
  1336. hurt = hurt * (1 + beSkillHurtRate)
  1337. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1338. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1339. BeSkill.handlerBuff(attacker, target, hurt, conf.cmd)
  1340. end
  1341. function yinbaoZuzhou(obj, skillTargets, skillConfig)
  1342. local newFrame = nil
  1343. for k,v in ipairs(skillTargets) do
  1344. if v.bufferCmd["zuzhou"] then
  1345. for i = #v.bufferCmd["zuzhou"],1,-1 do
  1346. local ind = v.bufferCmd["zuzhou"][i]
  1347. local buffer = v.buffer[ind]
  1348. local conf = BufferExcel.buffer[buffer.id]
  1349. if conf and handler[conf.cmd] then
  1350. handler[conf.cmd](v, buffer, conf)
  1351. CombatImpl.addFrameBuffer(v,buffer,CombatDefine.BUFFER_OP_HOLD)
  1352. end
  1353. local bufferCnt = delBuffer(v, ind)
  1354. CombatImpl.addFrameBuffer(v,buffer,CombatDefine.BUFFER_OP_DEL)
  1355. newFrame = true
  1356. end
  1357. end
  1358. end
  1359. -- 有引爆成功的
  1360. if newFrame and ProjectLogic.isSsecy() then
  1361. CombatImpl.addFrame()
  1362. end
  1363. end
  1364. --主动技能释放后buff作用
  1365. handlerEx = {}
  1366. --印记
  1367. function handlerEx.yinJi(target, buffer, conf)
  1368. local attacker = CombatImpl.objList[buffer.attackPos]
  1369. if attacker == nil then
  1370. return
  1371. end
  1372. local hurtRate = conf.args[1]
  1373. local hurtRateMax = conf.args[2]
  1374. local hpMax = CombatObj.getHpMax(target)
  1375. local hurt = hurtRate * hpMax / 10000
  1376. local atk = CombatObj.getValue(attacker,RoleDefine.ATK) * hurtRateMax / 10000
  1377. if hurt > atk then
  1378. hurt = atk
  1379. end
  1380. local d = CombatObj.updateHp(target, -hurt, nil, nil, buffer.attackPos,CombatObj.BUFFER_HP_TYPE)
  1381. buffer.attrs[RoleDefine.HP_COMBAT] = -hurt
  1382. return true
  1383. end
  1384. function qingsuan(target)
  1385. if target.hp <= 0 then
  1386. return 0
  1387. end
  1388. local baseValue = 0
  1389. local round
  1390. for j = target.buffer[0], 1, -1 do
  1391. local buffer = target.buffer[j]
  1392. local conf = BufferExcel.buffer[buffer.id]
  1393. local cmd = conf.cmd
  1394. if cmd == "ranshao" or cmd == "ranshao1" or cmd == "liuxue" or cmd == "zhongdu" or cmd == "hurt" or cmd == "hurt1" then
  1395. round = 1
  1396. if buffer.round and buffer.round > 0 then
  1397. round = buffer.round
  1398. end
  1399. baseValue = baseValue + buffer.arg * round
  1400. local bufferCnt = delBuffer(target, j)
  1401. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1402. end
  1403. end
  1404. return baseValue
  1405. end
  1406. --解控
  1407. function jiekong(target)
  1408. if target.hp <= 0 then
  1409. return 0
  1410. end
  1411. local baseValue = 0
  1412. local state = false
  1413. for j = target.buffer[0], 1, -1 do
  1414. local buffer = target.buffer[j]
  1415. local conf = BufferExcel.buffer[buffer.id]
  1416. local cmd = conf.cmd
  1417. if isControlCmd(cmd) then
  1418. local bufferCnt = delBuffer(target, j)
  1419. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1420. state = true
  1421. end
  1422. end
  1423. if state == true then
  1424. CombatImpl.setExtraHit(target,nil, Skill.getCMD2ID("jiekong"))
  1425. end
  1426. end
  1427. --杀意
  1428. function delShayi(target)
  1429. if target.hp <= 0 then
  1430. return 0
  1431. end
  1432. for j = target.buffer[0], 1, -1 do
  1433. local buffer = target.buffer[j]
  1434. local conf = BufferExcel.buffer[buffer.id]
  1435. local cmd = conf.cmd
  1436. if cmd == "shayi" then
  1437. local bufferCnt = delBuffer(target, j)
  1438. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1439. end
  1440. end
  1441. end
  1442. function getBuffCnt(target,checkCmd)
  1443. if target.hp <= 0 then
  1444. return 0
  1445. end
  1446. local cnt = 0
  1447. for j = target.buffer[0], 1, -1 do
  1448. local buffer = target.buffer[j]
  1449. local conf = BufferExcel.buffer[buffer.id]
  1450. local cmd = conf.cmd
  1451. if cmd == checkCmd then
  1452. cnt = cnt + 1
  1453. end
  1454. end
  1455. return cnt
  1456. end
  1457. -- 获取护盾值
  1458. function getBuffHuDun(obj)
  1459. if obj and obj.bufferAttr and obj.bufferAttr[RoleDefine.HUDUN_COMBAT] then
  1460. return obj.bufferAttr[RoleDefine.HUDUN_COMBAT]
  1461. end
  1462. return 0
  1463. end
  1464. -- 护盾值的修改
  1465. function updateHuDun(obj, value)
  1466. if obj and obj.bufferAttr then
  1467. local oldValue = obj.bufferAttr[RoleDefine.HUDUN_COMBAT] or 0
  1468. local newValue = oldValue + value
  1469. if newValue <= 0 then
  1470. obj.bufferAttr[RoleDefine.HUDUN_COMBAT] = 0
  1471. delBufferByCmd(obj,"hudun", 0)
  1472. else
  1473. obj.bufferAttr[RoleDefine.HUDUN_COMBAT] = newValue
  1474. end
  1475. -- 护盾值没有全部去除 则 在对应英雄上吧 BUF 上的arg 数值 减除 防止 BufChange 重置 属性
  1476. if value < 0 and newValue > 0 then
  1477. if obj and obj.buffer then
  1478. for j = 1 , obj.buffer[0] do -- 从最早的护盾BUF中删除arg
  1479. local buffer = obj.buffer[j]
  1480. local conf = BufferExcel.buffer[buffer.id]
  1481. local bufferCmd = conf.cmd
  1482. if bufferCmd == "hudun" then
  1483. local have = buffer.arg
  1484. if have > -value then
  1485. buffer.arg = have + value
  1486. else
  1487. buffer.arg = 0
  1488. local bufferCnt = delBuffer(obj, j)
  1489. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1490. break
  1491. end
  1492. end
  1493. end
  1494. end
  1495. end
  1496. end
  1497. end
  1498. BUFFER_COMBAT_TYPE = nil
  1499. function initCombatBufferType()
  1500. if BUFFER_COMBAT_TYPE then return end
  1501. BUFFER_COMBAT_TYPE = {}
  1502. for k,conf in pairs(BufferExcel.qusan) do
  1503. if conf then
  1504. BUFFER_COMBAT_TYPE[conf.buffcmd] = conf.type
  1505. end
  1506. end
  1507. end
  1508. --
  1509. function getCombatBufferCnt(target, qusanType)
  1510. initCombatBufferType()
  1511. local buffCnt = 0
  1512. for i = target.buffer[0], 1, -1 do
  1513. local buffer = target.buffer[i]
  1514. local conf = BufferExcel.buffer[buffer.id]
  1515. local cmd = conf.cmd
  1516. if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == qusanType then
  1517. buffCnt = buffCnt + 1
  1518. end
  1519. end
  1520. return buffCnt
  1521. end
  1522. --抵抗
  1523. QUSAN_CMD2KEY = {
  1524. ["zuzhou"] = RoleDefine.STATUS_DIKANG_RATE9,
  1525. }
  1526. function qusan(target, qusanType,cnt)
  1527. if target.isPet or not qusanType then
  1528. return 0
  1529. end
  1530. initCombatBufferType()
  1531. local state = false
  1532. local delIndex = {}
  1533. for i = target.buffer[0], 1, -1 do
  1534. local buffer = target.buffer[i]
  1535. local conf = BufferExcel.buffer[buffer.id]
  1536. local cmd = conf.cmd
  1537. if conf.noQusan ~= 1 then
  1538. if BUFFER_COMBAT_TYPE[cmd] and BUFFER_COMBAT_TYPE[cmd] == qusanType then
  1539. local isDiKang = nil
  1540. local key = QUSAN_CMD2KEY[cmd]
  1541. local r = math.random(1,10000)
  1542. if key and target.attr[key] >= r then
  1543. isDiKang = true
  1544. end
  1545. if not isDiKang then
  1546. delIndex[#delIndex + 1] = i
  1547. end
  1548. elseif cmd == "attr" or cmd == "attrdne" then
  1549. if conf.args and conf.args[1][2] < 0 and qusanType == 1 then
  1550. delIndex[#delIndex + 1] = i
  1551. elseif conf.args and conf.args[1][2] > 0 and qusanType == 2 then
  1552. delIndex[#delIndex + 1] = i
  1553. end
  1554. end
  1555. end
  1556. end
  1557. cnt = cnt or 0
  1558. if cnt > 0 and cnt < #delIndex then
  1559. for i = cnt + 1,#delIndex do
  1560. delIndex[i] = nil
  1561. end
  1562. end
  1563. for k,v in ipairs(delIndex) do
  1564. local buffer = target.buffer[v]
  1565. if not buffer then break end
  1566. local bufferCnt = delBuffer(target, v)
  1567. CombatImpl.addFrameBuffer(target,buffer,CombatDefine.BUFFER_OP_DEL)
  1568. end
  1569. return #delIndex
  1570. end
  1571. function qusanAddBuff(attacker, targets, bufferID)
  1572. for _,target in ipairs(targets) do
  1573. if canAdd(target,bufferID) then
  1574. addBuffer(attacker.pos, target, bufferID)
  1575. end
  1576. end
  1577. end
  1578. function beforeUpdateHp(obj,sum)
  1579. local isStatus,cmd,ind = isStatus(obj,{"miansi","waitMiansi"})
  1580. if not isStatus then
  1581. return
  1582. end
  1583. --免死逻辑
  1584. if cmd == "miansi" then
  1585. return true
  1586. end
  1587. if sum == 0 and cmd == "waitMiansi" then
  1588. local buffer = obj.buffer[ind]
  1589. local bufferCnt = delBuffer(obj, ind)
  1590. CombatImpl.addFrameBuffer(obj,buffer,CombatDefine.BUFFER_OP_DEL)
  1591. local conf = BufferExcel.buffer[buffer.id]
  1592. local bufferID = conf.args[1]
  1593. if canAdd(obj,bufferID) then
  1594. addBuffer(obj.pos,obj, bufferID)
  1595. end
  1596. return true
  1597. end
  1598. end
  1599. function checkBaohu(obj,value)
  1600. local isStatus,cmd,ind = isStatus(obj,{"baohu"})
  1601. if not isStatus then
  1602. return value
  1603. end
  1604. local buffer = obj.buffer[ind]
  1605. local attackPos = buffer.attackPos
  1606. local attacker = CombatImpl.objList[attackPos]
  1607. if attacker.hp <= 0 then
  1608. return value
  1609. end
  1610. value = BeSkill.onCheckBuffer(attacker,obj,value)
  1611. return value
  1612. end
  1613. function onExtraCombatRecord(pos,value,param)
  1614. local obj = CombatObj.getObjByPos(pos)
  1615. if not obj then return end
  1616. obj.extraCombatRecord = obj.extraCombatRecord or {}
  1617. if param == "zhongdu" then
  1618. obj.extraCombatRecord.zhongdu = (obj.extraCombatRecord.zhongdu or 0) + value
  1619. elseif param == "liuxue" then
  1620. obj.extraCombatRecord.liuxue = (obj.extraCombatRecord.liuxue or 0) + value
  1621. elseif param == "ranshao" then
  1622. obj.extraCombatRecord.ranshao = (obj.extraCombatRecord.ranshao or 0) + value
  1623. elseif param == "xuanyun" then
  1624. obj.extraCombatRecord.xuanyun = (obj.extraCombatRecord.xuanyun or 0) + value
  1625. elseif param == "revive" then
  1626. obj.extraCombatRecord.revive = (obj.extraCombatRecord.revive or 0) + value
  1627. elseif param == "reviveBeUse" then
  1628. obj.extraCombatRecord.reviveBeUse = (obj.extraCombatRecord.reviveBeUse or 0) + value
  1629. elseif param == "kill" then
  1630. obj.extraCombatRecord.kill = (obj.extraCombatRecord.kill or 0) + value
  1631. end
  1632. end