BeSkill.lua 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288
  1. local Util = require("common.Util")
  2. local CombatBuff = require("combat.CombatBuff")
  3. local CombatDefine = require("combat.CombatDefine")
  4. local CombatImpl = require("combat.CombatImpl")
  5. local Skill = require("combat.Skill")
  6. local CombatObj = require("combat.CombatObj")
  7. local RoleAttr = require("role.RoleAttr")
  8. local RoleDefine = require("role.RoleDefine")
  9. local HeroExcel = require("excel.hero").hero
  10. local SkillExcel = require("excel.skill").skill
  11. -- local BufferExcel = require("excel.buffer").buffer
  12. local FuwenExcel = require("excel.fuwen")
  13. local SkinSkillExcel = require("excel.skin").skill
  14. local BingshuLogic = require("fuwen.BingshuLogic")
  15. local ProjectLogic = require("platform.ProjectLogic")
  16. local HeroDefine = require("hero.HeroDefine")
  17. local WinnerRelicLogic = require("winnerRelic.WinnerRelicLogic")
  18. local TargetMode = require("combat.TargetMode")
  19. local HeroExclusiveWeapon = require("hero.HeroExclusiveWeapon")
  20. local tbFuwenSkillGroupID = {}
  21. local posSortBySpeed = posSortBySpeed or {}
  22. function initBeSkill(obj)
  23. obj.beSkillList = {}
  24. obj.beSkillListTemp = {}
  25. end
  26. function setBeSkillID(obj, skillID, isFuWenSkill, isRelicSkill)
  27. local skillConfig = Skill.GetFinalSkillConfig(obj, skillID)
  28. skillID = skillConfig.id
  29. if obj.beSkillListTemp[skillID] then return end
  30. --local skillConfig = SkillExcel[skillID]
  31. if skillConfig.need > obj.quality then return end
  32. if skillConfig.beSkillType == 0 then return end
  33. if skillConfig.beSkillType == BESKILL_TYPE24 then
  34. obj.beSkillListTemp[BESKILL_TYPE24] = obj.beSkillListTemp[BESKILL_TYPE24] or {}
  35. obj.beSkillListTemp[BESKILL_TYPE24][#obj.beSkillListTemp[BESKILL_TYPE24] + 1] = {
  36. skillID,
  37. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  38. skillConfig.cd[2] or 0,
  39. isFuWenSkill or 0, isRelicSkill or 0}
  40. for _,skillID in ipairs(skillConfig.args) do
  41. --local skillConfig = SkillExcel[skillID]
  42. local skillConfig = Skill.GetFinalSkillConfig(obj, skillID)
  43. if not obj.beSkillListTemp[skillID] and skillConfig.need <= obj.quality then
  44. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  45. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  46. skillID,
  47. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  48. skillConfig.cd[2] or 0,
  49. isFuWenSkill or 0, isRelicSkill or 0}
  50. obj.beSkillListTemp[skillID] = 1
  51. end
  52. end
  53. else
  54. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  55. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  56. skillID,
  57. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  58. skillConfig.cd[2] or 0,
  59. isFuWenSkill or 0, isRelicSkill or 0}
  60. obj.beSkillListTemp[skillID] = 1
  61. end
  62. end
  63. function setBeSkill(obj, config, skinConf, monsterOutConfig)
  64. local temp = {}
  65. local confBeskillID = skinConf and skinConf.beSkillList or config.beSkillList
  66. for _,skillID in ipairs(confBeskillID) do
  67. setBeSkillID(obj,skillID)
  68. end
  69. -- 加载 赋能技能 这个策划说放到最后
  70. if config.bePvPSkillList and CombatImpl.isPVP == 1 then
  71. for _,skillID in ipairs(config.bePvPSkillList) do
  72. setBeSkillID(obj, skillID)
  73. end
  74. end
  75. -- 怪物组附加的被动技能
  76. if monsterOutConfig then
  77. for _, skillID in ipairs(monsterOutConfig) do
  78. setBeSkillID(obj,skillID)
  79. end
  80. end
  81. -- 符文被动技能
  82. -- 符文技能效果这里 如果有多个同类型的技能 效果不叠加 只取最高等级的那个技能的效果
  83. if obj.fuwen or obj.bingshu then
  84. local hasFuwenBeSkill = nil
  85. Util.initTable(tbFuwenSkillGroupID)
  86. if obj.fuwen then
  87. for i = 1, 2 do
  88. local fuwenGrid = obj.fuwen[i]
  89. if fuwenGrid and fuwenGrid.skill then
  90. for j = 1, #fuwenGrid.skill do
  91. local fuwenSkillID = fuwenGrid.skill[j]
  92. local fuwenSkillConfig = FuwenExcel.skill[fuwenSkillID]
  93. local fuwenGroupID = fuwenSkillConfig.groupID
  94. if fuwenSkillConfig.fuwenBeSkill ~= 0 then
  95. hasFuwenBeSkill = true
  96. if tbFuwenSkillGroupID[fuwenGroupID] then
  97. if tbFuwenSkillGroupID[fuwenGroupID] < fuwenSkillID then
  98. tbFuwenSkillGroupID[fuwenGroupID] = fuwenSkillID
  99. end
  100. else
  101. tbFuwenSkillGroupID[fuwenGroupID] = fuwenSkillID
  102. end
  103. end
  104. end
  105. end
  106. end
  107. end
  108. if obj.bingshu then
  109. for i = 1, BingshuLogic.BINGSHU_MAXCNT do
  110. local bingshuGrid = obj.bingshu[i]
  111. if bingshuGrid then
  112. local skillID = bingshuGrid.skillID
  113. local skillConfig = FuwenExcel.skill[skillID]
  114. local groupID = skillConfig.groupID
  115. hasFuwenBeSkill = true
  116. if (tbFuwenSkillGroupID[groupID] or 0) < skillID then
  117. tbFuwenSkillGroupID[groupID] = skillID
  118. end
  119. end
  120. end
  121. end
  122. if hasFuwenBeSkill == true then
  123. for groupID, skillIDTemp in pairs(tbFuwenSkillGroupID) do
  124. local fuwenSkillConfig = FuwenExcel.skill[skillIDTemp]
  125. local fuwenBeSkillID = fuwenSkillConfig.fuwenBeSkill
  126. setBeSkillID(obj,fuwenBeSkillID, 1)
  127. end
  128. end
  129. end
  130. --遗物被动技能
  131. if obj.relic and nil ~= _G.next(obj.relic) then
  132. local nRelicID = obj.relic.relicID
  133. local star = obj.relic.star
  134. -- print("当前获取到的星级",star)
  135. local nSkillID = WinnerRelicLogic.WinnerRelic_GetSkillID(nRelicID, star)
  136. print("[setBeSkill] nSkillID = "..nSkillID)
  137. if 0 < nSkillID then
  138. setBeSkillID(obj, nSkillID, 0, 1)
  139. local tSkilConfig = SkillExcel and SkillExcel[nSkillID]
  140. -- print("当前获取到的skillid2222222222",tSkilConfig.id)
  141. if tSkilConfig and tSkilConfig.otherArgs and tSkilConfig.otherArgs.skillList then
  142. for k,v in ipairs(tSkilConfig.otherArgs.skillList) do
  143. local config = SkillExcel[v]
  144. if config and config.id then
  145. -- print("當前设置的skillid",config.id)
  146. setBeSkillID(obj, config.id, 0, 1)
  147. end
  148. end
  149. end
  150. end
  151. end
  152. end
  153. function setPetBeSkill(obj)
  154. --if obj
  155. --local skillConfig = SkillExcel[1999]
  156. local skillConfig = Skill.GetSkillConfig(1999)
  157. if skillConfig then
  158. obj.beSkillList = obj.beSkillList or {}
  159. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  160. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {1999,skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,skillConfig.cd[2] or 0}
  161. end
  162. end
  163. --被动技能类型
  164. BESKILL_TYPE1 = 1 --普攻附带
  165. BESKILL_TYPE2 = 2 --被击触发
  166. BESKILL_TYPE3 = 3 --自身生命低于参数
  167. BESKILL_TYPE4 = 4 --自己暴击触发
  168. BESKILL_TYPE5 = 5 --受到技能伤害
  169. BESKILL_TYPE6 = 6 --自己攻击被格挡
  170. BESKILL_TYPE7 = 7 --受到暴击触发
  171. BESKILL_TYPE8 = 8 --自己格挡触发(其他单位对自己发动攻击,自己触发格挡)
  172. BESKILL_TYPE9 = 9 --敌方英雄触发格挡
  173. BESKILL_TYPE10 = 10 --自己受持续状态伤害
  174. BESKILL_TYPE11 = 11 --自己受控制类状态
  175. BESKILL_TYPE12 = 12 --场上有英雄被添加燃烧状态
  176. BESKILL_TYPE13 = 13 -- 我方英雄施放主动技能
  177. BESKILL_TYPE14 = 14 -- 我方英雄暴击
  178. BESKILL_TYPE15 = 15 -- 自己死亡
  179. BESKILL_TYPE16 = 16 --我方英雄死亡
  180. BESKILL_TYPE17 = 17 --敌方英雄死亡
  181. BESKILL_TYPE18 = 18 --有英雄死亡
  182. BESKILL_TYPE19 = 19 --回合开始
  183. BESKILL_TYPE20 = 20 --回合结束
  184. BESKILL_TYPE23 = 23 --激活就生效(计入面板属性)
  185. BESKILL_TYPE24 = 24 --技能包
  186. BESKILL_TYPE25 = 25 --替换初始普攻
  187. BESKILL_TYPE26 = 26 --激活就生效(进入战斗前算。不计入面板属性)
  188. BESKILL_TYPE27 = 27 --魔兽回能量被动
  189. BESKILL_TYPE28 = 28 --自身触发格挡次数
  190. BESKILL_TYPE29 = 29 --有人受到缠绕时
  191. BESKILL_TYPE30 = 30 --使生命低于x时
  192. BESKILL_TYPE31 = 31 --任意英雄释放主动技能
  193. BESKILL_TYPE32 = 32 --战斗开始时触发
  194. BESKILL_TYPE33 = 33 --复活时触发
  195. BESKILL_TYPE34 = 34 --使用主动技能时
  196. BESKILL_TYPE35 = 35 --自身击杀敌人时
  197. BESKILL_TYPE36 = 36 --攻击回合结束时触发
  198. BESKILL_TYPE37 = 37 --物攻后触发
  199. BESKILL_TYPE38 = 38 --法攻后触发
  200. BESKILL_TYPE39 = 39 --攻击附带 (普攻 主动 都算)
  201. BESKILL_TYPE40 = 40 --攻击前根据条件判断是否触发(小战斗回合,针对每个对象单独判断)
  202. BESKILL_TYPE41 = 41 --实际扣血前触发
  203. BESKILL_TYPE42 = 42 --由其他英雄的buff触发
  204. BESKILL_TYPE43 = 43 --被某个技能打死
  205. BESKILL_TYPE44 = 44 --自己暴击+反击触发
  206. BESKILL_TYPE45 = 45 --计算伤害时触发
  207. BESKILL_TYPE46 = 46 --攻击附带 (普攻 主动 连击 反击都算)
  208. BESKILL_TYPE47 = 47 --每回合叠加属性
  209. BESKILL_TYPE48 = 48 --死亡英雄伤害率
  210. BESKILL_TYPE49 = 49 --加血变成减血
  211. BESKILL_TYPE50 = 50 --每回合触发 降低对方首次攻击目标伤害率
  212. BESKILL_TYPE51 = 51 --场上有英雄被添加诅咒状态
  213. BESKILL_TYPE52 = 52 --场上有英雄被攻击
  214. BESKILL_TYPE53 = 53 --场上有英雄有特定被动技能 友军普攻触发
  215. BESKILL_TYPE54 = 54 --场上有英雄特定buff 伤害加成
  216. BESKILL_TYPE55 = 55 --场上有英雄指定buff层数 额外伤害加成
  217. BESKILL_TYPE56 = 56 --场上有英雄特定bufer且概率产生
  218. BESKILL_TYPE57 = 57 --特定buff被引爆消除时 触发的效果
  219. BESKILL_TYPE58 = 58 --指定技能暴击
  220. BESKILL_TYPE59 = 59 --没有暴击触发一个效果
  221. BESKILL_TYPE60 = 60 --暴击加成
  222. BESKILL_TYPE61 = 61 --技能未击杀目标时触发
  223. BESKILL_TYPE62 = 62 --回合开始生命值触发
  224. BESKILL_TYPE63 = 63 --回合开始生命值触发
  225. BESKILL_TYPE64 = 64 --冰冻buffer被击碎
  226. BESKILL_TYPE65 = 65 --场上有英雄有特定被动技能 友军普攻暴击触发
  227. BESKILL_TYPE66 = 66 --敌方死亡特定buff触发
  228. BESKILL_TYPE67 = 67 --血量低于多少跟受控制触发
  229. BESKILL_TYPE68 = 68 --血族英雄特殊处理
  230. BESKILL_TYPE69 = 69 --血族英雄特殊处理
  231. BESKILL_TYPE70 = 70 --增加的属性激活就生效(计入面板属性)并且概率连击
  232. BESKILL_TYPE71 = 71 --回合开始 在其他buff添加结束
  233. BESKILL_TYPE72 = 72 -- 不施放技能,只用来做其他效果的判断条件
  234. NO_CHECK_FANJI_LIST = {
  235. [BESKILL_TYPE3] = 1,
  236. [BESKILL_TYPE15] = 1,
  237. [BESKILL_TYPE16] = 1,
  238. [BESKILL_TYPE17] = 1,
  239. [BESKILL_TYPE18] = 1,
  240. [BESKILL_TYPE35] = 1,
  241. [BESKILL_TYPE36] = 1,
  242. [BESKILL_TYPE37] = 1,
  243. [BESKILL_TYPE38] = 1,
  244. [BESKILL_TYPE44] = 1,
  245. [BESKILL_TYPE46] = 1,
  246. }
  247. NO_CHECK_COMBO_LIST = {
  248. [BESKILL_TYPE1] = 1,
  249. [BESKILL_TYPE3] = 1,
  250. [BESKILL_TYPE14] = 1,
  251. [BESKILL_TYPE16] = 1,
  252. [BESKILL_TYPE17] = 1,
  253. [BESKILL_TYPE18] = 1,
  254. [BESKILL_TYPE35] = 1,
  255. [BESKILL_TYPE34] = 1,
  256. [BESKILL_TYPE25] = 1,
  257. [BESKILL_TYPE46] = 1,
  258. [BESKILL_TYPE37] = 1,
  259. [BESKILL_TYPE38] = 1,
  260. [BESKILL_TYPE43] = 1,
  261. }
  262. local function checkLimit(data)
  263. if data[2] and data[2] <= 0 then
  264. return
  265. end
  266. if data[4] > 0 and data[3] > CombatImpl.round then
  267. return
  268. end
  269. return true
  270. end
  271. local function canUse(obj,data)
  272. if obj.isPet then
  273. return true
  274. end
  275. --被动技能次数限制判断
  276. if not checkLimit(data) then
  277. return
  278. end
  279. --local skillConfig = SkillExcel[data[1]]
  280. local skillConfig = Skill.GetSkillConfig(data[1])
  281. if not NO_CHECK_FANJI_LIST[skillConfig.beSkillType] and CombatImpl.isFanji then
  282. return
  283. end
  284. if not NO_CHECK_COMBO_LIST[skillConfig.beSkillType] and CombatImpl.comboType > 0 then
  285. return
  286. end
  287. local bNotFeng = nil
  288. -- boss 被动不能被封印
  289. -- 世界boss模式下 boss不受feng状态影响
  290. if CombatImpl.fightMode[1] == CombatDefine.FIGHT_MODE3 then
  291. if obj.type == CombatDefine.COMBAT_OBJ_TYPE3 then
  292. bNotFeng = true
  293. end
  294. end
  295. if not bNotFeng and CombatBuff.isStatus(obj,{"banBeSkill","feng"}) then
  296. return
  297. end
  298. data[3] = data[3] + data[4]
  299. local beSkillArgs = skillConfig.beSkillArgs
  300. local ret = true
  301. --被动技能触发条件判断
  302. if beSkillArgs[1] then
  303. if beSkillArgs[1] == "hp" then
  304. local hp = obj.hp
  305. local hpMax = CombatObj.getHpMax(obj)
  306. if hp > hpMax * beSkillArgs[2]/10000 then
  307. ret = false
  308. end
  309. elseif beSkillArgs[1] == "hpOrControl" then
  310. ret = false
  311. local hp = obj.hp
  312. local hpMax = CombatObj.getHpMax(obj)
  313. if hp <= hpMax * beSkillArgs[2]/10000 then
  314. ret = true
  315. end
  316. if CombatBuff.isAtControl(obj) then
  317. ret = true
  318. end
  319. elseif beSkillArgs[1] == "fanji" then
  320. local r = math.random(0,10000)
  321. if r > beSkillArgs[2] then
  322. return
  323. end
  324. elseif beSkillArgs[1] == "pos" then
  325. local pos = obj.pos
  326. ret = false
  327. if beSkillArgs[2] then
  328. for i = 1,#beSkillArgs[2] do
  329. if pos == beSkillArgs[2][i] then
  330. ret = true
  331. break
  332. end
  333. end
  334. end
  335. elseif beSkillArgs[1] == "noBuffCmd" then
  336. return not CombatBuff.isStatus(obj,beSkillArgs[2])
  337. elseif beSkillArgs[1] == "attackerBuffCmd" then
  338. local isStatus,cmd = CombatBuff.isStatus(obj,beSkillArgs[2])
  339. return isStatus
  340. elseif beSkillArgs[1] == "myjob" then
  341. ret = false
  342. for k,v in ipairs(beSkillArgs[2]) do
  343. if v == obj.job then
  344. ret = true
  345. break
  346. end
  347. end
  348. elseif beSkillArgs[1] == "sideLimit" then
  349. for k,v in ipairs(beSkillArgs[2]) do
  350. local useCnt = CombatImpl.getBeSkillSideUse(obj.pos,v[1])
  351. if useCnt >= v[2] then
  352. return
  353. end
  354. end
  355. elseif beSkillArgs[1] == "firstAttackOrder" then
  356. local side = obj.side
  357. if side then
  358. local isFirstAttack = CombatImpl.firstAttack[side]
  359. if beSkillArgs[2] == 1 then
  360. return isFirstAttack
  361. else
  362. return not isFirstAttack
  363. end
  364. end
  365. end
  366. end
  367. if ret and data[2] then
  368. data[2] = data[2] - 1
  369. end
  370. if skillConfig.cmd == "hp" then
  371. local hp = obj.hp
  372. local targetMode = skillConfig.args[3]
  373. --英雄血量为0时不能加血
  374. if (hp <= 0 or CombatBuff.isStatus(obj,{"revive"})) and targetMode and targetMode[1] == 10 then
  375. ret = false
  376. end
  377. end
  378. return ret
  379. end
  380. --被攻击触发,需要判断攻击者状态的被动技能
  381. local function canUseOnHit(obj,data)
  382. if not obj then
  383. return true
  384. end
  385. --local skillConfig = SkillExcel[data[1]]
  386. local skillConfig = Skill.GetSkillConfig(data[1])
  387. local beSkillArgs = skillConfig.beSkillArgs
  388. local condCmd = beSkillArgs[1]
  389. if condCmd == "job" then
  390. for _,job in ipairs(beSkillArgs[2]) do
  391. if obj.job == job then
  392. return true
  393. end
  394. end
  395. return false
  396. elseif condCmd == "buffCmd" then
  397. return CombatBuff.isStatus(obj,beSkillArgs[2])
  398. elseif condCmd == "targetHp" then
  399. local hp = obj.hp
  400. local checkHp = CombatObj.getHpMax(obj) * beSkillArgs[3] / 10000
  401. if beSkillArgs[2] == 1 and hp > checkHp then
  402. return true
  403. elseif beSkillArgs[2] == 2 and hp < checkHp then
  404. return true
  405. end
  406. else
  407. return true
  408. end
  409. end
  410. local function isCanRevive(obj, attacker , data)
  411. -- local skillConfig = SkillExcel[data[1]]
  412. local skillConfig = Skill.GetSkillConfig(data[1])
  413. if skillConfig.cmd == "shengling" or
  414. skillConfig.cmd == "revive" then
  415. if skillConfig.cmd == "shengling" and CombatImpl.checkSideResult(obj.pos) == true then -- 如果是队伍最后一个死亡的不释放 圣灵复活
  416. return false
  417. end
  418. if CombatBuff.canRevive(obj) ~= true then
  419. return false
  420. end
  421. if skillConfig.cmd == "shengling" then
  422. if CombatBuff.isStatus(obj,{"revive"}) then
  423. return false
  424. end
  425. end
  426. if attacker and attacker.beSkillList then
  427. for k,skillList in pairs(attacker.beSkillList) do
  428. for j,v in pairs(skillList) do
  429. --local config = SkillExcel[v[1]]
  430. local config = Skill.GetSkillConfig(data[1])
  431. if config and skillConfig.cmd == "shengling" and config.cmd == "noShengling" then --击杀方有 不准圣灵复活被动
  432. return false
  433. elseif config and config.cmd == "noRevive" then -- 击杀方 有不准复活的
  434. if #config.args > 0 then
  435. local canNum = config.args[1]
  436. local random = math.random(1, 10000)
  437. if random > canNum then -- noRevive 概率不生效
  438. return true
  439. else
  440. return false
  441. end
  442. end
  443. return true
  444. end
  445. end
  446. end
  447. end
  448. end
  449. return true
  450. end
  451. function onSkillID(obj,skillID)
  452. --local skillConfig = SkillExcel[skillID]
  453. local skillConfig = Skill.GetSkillConfig(skillID)
  454. if skillConfig.type == CombatDefine.SKILL_TYPE1 and obj.beSkillList[BESKILL_TYPE25] then
  455. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE25]) do
  456. if canUse(obj,v) then
  457. --local conf = SkillExcel[v[1]]
  458. local conf = Skill.GetSkillConfig(v[1])
  459. return conf.args[1]
  460. end
  461. end
  462. end
  463. return skillID
  464. end
  465. local function use(attacker,targets,data,newFrame, packBuff, hitObj)
  466. if canUse(attacker,data) and canUseOnHit(targets and targets[1],data) then
  467. --print("beskill realuse:",attacker.pos,data[1])
  468. --local skillConfig = SkillExcel[data[1]]
  469. local skillConfig = Skill.GetSkillConfig(data[1])
  470. local ret
  471. -- 二次元连击触发帧不新加帧
  472. if ProjectLogic.isSsecy() and skillConfig.cmd == "combo" then
  473. newFrame = false
  474. end
  475. if packBuff then
  476. CombatImpl.afterBuff()
  477. end
  478. if Skill.CMD[skillConfig.cmd] then
  479. if newFrame or CombatImpl.isSkillFrameEmpty() then
  480. --进入战斗时,未加入任何战斗帧触发被动技能时,先添加被动技能的战斗帧,可以在这个战斗帧上挂被动技能引发的额外作用
  481. CombatImpl.addFrame()
  482. CombatImpl.setSkillID(attacker, data[1])
  483. end
  484. ret = Skill.CMD[skillConfig.cmd](attacker,skillConfig,targets, hitObj)
  485. end
  486. --判断是否加喊话
  487. local isAddSkillFrame = CombatBuff.onUseBeSkill(attacker,skillConfig,targets,ret)
  488. if skillConfig.contentType > 0 then
  489. if isAddSkillFrame then
  490. CombatImpl.addSaySkill(attacker,skillConfig)
  491. elseif ret or skillConfig.beSkillType == BESKILL_TYPE26 or
  492. skillConfig.beSkillType == BESKILL_TYPE23 or
  493. skillConfig.beSkillType == BESKILL_TYPE4 or
  494. skillConfig.beSkillType == BESKILL_TYPE44 then
  495. if CombatImpl.isSkillFrameEmpty() then
  496. CombatImpl.addFrame()
  497. CombatImpl.setSkillID(attacker, data[1])
  498. end
  499. CombatImpl.setSaySkill(attacker.pos,skillConfig.id,skillConfig.contentType)
  500. end
  501. end
  502. CombatImpl.addBeSkillPosUse(attacker.pos,data[1])
  503. else
  504. -- print("[beskill - use] 直接返回了1 id = "..data[1])
  505. end
  506. end
  507. function onHit(attacker,targets,skillID)
  508. if attacker.isPet then
  509. return
  510. end
  511. --local useSkillConfig = SkillExcel[skillID]
  512. local useSkillConfig = Skill.GetSkillConfig(skillID)
  513. if useSkillConfig.type == CombatDefine.SKILL_TYPE2 then
  514. --[[for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  515. local obj = CombatImpl.objList[pos]
  516. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE13] then
  517. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE13]) do
  518. use(obj,targets,v)
  519. end
  520. end
  521. end]]
  522. if attacker.beSkillList[BESKILL_TYPE34] then
  523. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE34]) do
  524. --local skillConfig = SkillExcel[v[1]]
  525. local skillConfig = Skill.GetSkillConfig(v[1])
  526. local beSkillArgs = skillConfig.beSkillArgs
  527. if beSkillArgs[1] == "attackerBuffCmd" and beSkillArgs[2][1] == "shayi" then
  528. local shayiCnt = CombatBuff.getBuffCnt(attacker,"shayi")
  529. if shayiCnt > 0 then
  530. for i = 1,shayiCnt do
  531. use(attacker,targets,v,true)
  532. CombatImpl.instantFrameBuffer(attacker,v[1])
  533. end
  534. end
  535. CombatBuff.delShayi(attacker)
  536. elseif beSkillArgs[1] == "qusanNeedCmd" then
  537. local canUse = false
  538. for h,need in ipairs(beSkillArgs[2]) do
  539. if need == useSkillConfig.cmd then
  540. canUse = true
  541. break
  542. end
  543. end
  544. if canUse == true then
  545. use(attacker,targets,v,true)
  546. end
  547. elseif beSkillArgs[1] == "jiekongNeedCmd" then
  548. local canUse = false
  549. for h,need in ipairs(beSkillArgs[2]) do
  550. if need == useSkillConfig.cmd then
  551. canUse = true
  552. break
  553. end
  554. end
  555. if canUse == true then
  556. use(attacker,targets,v,true)
  557. end
  558. elseif beSkillArgs[1] == "skillID" then
  559. local canUse = false
  560. for _, targetSkill in ipairs(beSkillArgs[2]) do
  561. if skillID == targetSkill then
  562. canUse = true
  563. break
  564. end
  565. end
  566. if canUse == true then
  567. use(attacker,targets,v,true)
  568. end
  569. else
  570. use(attacker,targets,v)
  571. end
  572. end
  573. end
  574. end
  575. --非攻击性主动技能不处理被击被动技能
  576. if CombatObj.getValue(attacker,RoleDefine.HURT_COMBAT_NOW) <= 0 then
  577. if (useSkillConfig.type == CombatDefine.SKILL_TYPE1 or useSkillConfig.type == CombatDefine.SKILL_TYPE2) then
  578. if attacker.beSkillList[BESKILL_TYPE39] then
  579. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE39]) do
  580. use(attacker,targets,v)
  581. end
  582. end
  583. if attacker.beSkillList[BESKILL_TYPE70] then
  584. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE70]) do
  585. use(attacker,targets,v)
  586. end
  587. end
  588. end
  589. return
  590. end
  591. if useSkillConfig.type == CombatDefine.SKILL_TYPE1 and attacker.beSkillList[BESKILL_TYPE1] then
  592. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE1]) do
  593. use(attacker,targets,v)
  594. end
  595. end
  596. if useSkillConfig.type == CombatDefine.SKILL_TYPE2 and attacker.beSkillList[BESKILL_TYPE61] then
  597. local canUseSkill = true
  598. for index = 1, #targets do
  599. local target = targets[index]
  600. if target.hp <=0 then
  601. canUseSkill = false
  602. end
  603. end
  604. if canUseSkill then
  605. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE61]) do
  606. --local skillConfig = SkillExcel[v[1]]
  607. local skillConfig = Skill.GetSkillConfig(v[1])
  608. local beSkillArgs = skillConfig.beSkillArgs
  609. if beSkillArgs[1] == "skillID" then
  610. local canUse = false
  611. for _,v in ipairs(beSkillArgs[2]) do
  612. if skillID == v then
  613. canUse = true
  614. break
  615. end
  616. end
  617. if canUse then
  618. use(attacker,{},v)
  619. end
  620. end
  621. end
  622. end
  623. end
  624. if (useSkillConfig.type == CombatDefine.SKILL_TYPE1 or useSkillConfig.type == CombatDefine.SKILL_TYPE2 or useSkillConfig.type == CombatDefine.SKILL_TYPE3) then
  625. if attacker.beSkillList[BESKILL_TYPE39] then
  626. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE39]) do
  627. use(attacker,targets,v)
  628. end
  629. end
  630. if attacker.beSkillList[BESKILL_TYPE46] then
  631. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE46]) do
  632. use(attacker,targets,v)
  633. end
  634. end
  635. if attacker.beSkillList[BESKILL_TYPE70] then
  636. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE70]) do
  637. use(attacker,targets,v)
  638. end
  639. end
  640. end
  641. local isDefendSideGedang = false
  642. local baojiDefender = {}
  643. for _,target in ipairs(targets) do
  644. if target.beSkillList[BESKILL_TYPE2] then
  645. for _,v in ipairs(target.beSkillList[BESKILL_TYPE2]) do
  646. use(target,{attacker},v)
  647. -- print("當前受到攻擊,觸發被動技能11111111111111ssssssssss1111111111111111",skillID)
  648. --table.print_lua_table(v)
  649. end
  650. end
  651. -- 友军受击
  652. for _,pos in ipairs(CombatDefine.SIDE2POS[target.side]) do
  653. local obj = CombatImpl.objList[pos]
  654. if obj and obj.pos ~= target.pos and obj.beSkillList[BESKILL_TYPE52] then
  655. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE52]) do
  656. use(target,{attacker},v)
  657. end
  658. end
  659. end
  660. if useSkillConfig.type == CombatDefine.SKILL_TYPE2 and target.beSkillList[BESKILL_TYPE5] then
  661. for _,v in ipairs(target.beSkillList[BESKILL_TYPE5]) do
  662. use(target,{attacker},v)
  663. end
  664. end
  665. if target.isGedang then
  666. isDefendSideGedang = true
  667. if target.beSkillList[BESKILL_TYPE8] then
  668. for _,v in ipairs(target.beSkillList[BESKILL_TYPE8]) do
  669. use(target,{attacker},v)
  670. end
  671. end
  672. if attacker.beSkillList[BESKILL_TYPE6] then
  673. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE6]) do
  674. use(attacker,{target},v)
  675. end
  676. end
  677. --目标触发格挡次数
  678. if target.beSkillList[BESKILL_TYPE28] then
  679. for _, v in ipairs(target.beSkillList[BESKILL_TYPE28]) do
  680. --local skillConfig = SkillExcel[v[1]]
  681. local skillConfig = Skill.GetSkillConfig(v[1])
  682. local beSkillArgs = skillConfig.beSkillArgs
  683. if beSkillArgs[1] == "gedang" then
  684. target.isGedangCnt = target.isGedangCnt or 0
  685. local geDangLimit = beSkillArgs[2]
  686. if target.isGedangCnt >= geDangLimit then
  687. target.isGedangCnt = 0
  688. use(target,{attacker},v)
  689. end
  690. end
  691. end
  692. end
  693. end
  694. local chanRao = CombatBuff.isChanRao(target)
  695. if chanRao then
  696. if target.beSkillList[BESKILL_TYPE29] then
  697. for _,v in ipairs(target.beSkillList[BESKILL_TYPE29]) do
  698. use(target,{attacker},v)
  699. end
  700. end
  701. end
  702. if target.isBaoji then
  703. if target.beSkillList[BESKILL_TYPE7] then
  704. for _,v in ipairs(target.beSkillList[BESKILL_TYPE7]) do
  705. use(target,{attacker},v)
  706. end
  707. end
  708. baojiDefender[#baojiDefender+1] = target
  709. end
  710. -- if target.buffCmd["winner_nuhuo"] then
  711. -- local nIndex = target.buffCmd["winner_nuhuo"][1]
  712. -- local tBuffData = target.buffer[nIndex]
  713. -- if tBuffData.cnt < 10 then
  714. -- tBuffData.cnt = tBuffData.cnt + 1
  715. -- end
  716. -- end
  717. end
  718. local side = attacker.side
  719. local defendSide = side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
  720. --普通技能触发
  721. if useSkillConfig.type == CombatDefine.SKILL_TYPE1 then
  722. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  723. local obj = CombatImpl.objList[pos]
  724. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE53] then
  725. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE53]) do
  726. use(attacker,targets,v)
  727. end
  728. end
  729. end
  730. end
  731. --主动技能触发
  732. if useSkillConfig.type == CombatDefine.SKILL_TYPE2 then
  733. for _,pos in ipairs(CombatDefine.SIDE2POS[0]) do
  734. local obj = CombatImpl.objList[pos]
  735. local objSide = pos <= 6 and CombatDefine.ATTACK_SIDE or CombatDefine.DEFEND_SIDE
  736. --触发自己这方的
  737. if side == objSide then
  738. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE13] then
  739. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE13]) do
  740. use(obj,targets,v)
  741. end
  742. end
  743. end
  744. --触发任意一方
  745. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE31] then
  746. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE31]) do
  747. use(obj,targets,v)
  748. end
  749. end
  750. end
  751. end
  752. if not attacker.isBaoji then
  753. --指定技能没有暴击
  754. if attacker.beSkillList[BESKILL_TYPE59] then
  755. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE59]) do
  756. --local skillConfig = SkillExcel[v[1]]
  757. local skillConfig = Skill.GetSkillConfig(v[1])
  758. local beSkillArgs = skillConfig.beSkillArgs
  759. if beSkillArgs[1] == "skillID" then
  760. local canUse = false
  761. for _,v in ipairs(beSkillArgs[2]) do
  762. if skillID == v then
  763. canUse = true
  764. break
  765. end
  766. end
  767. if canUse then
  768. use(attacker,{},v)
  769. end
  770. end
  771. end
  772. end
  773. end
  774. if attacker.isBaoji then
  775. --普通暴击技能触发
  776. if useSkillConfig.type == CombatDefine.SKILL_TYPE1 then
  777. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  778. local obj = CombatImpl.objList[pos]
  779. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE65] then
  780. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE65]) do
  781. use(attacker,targets,v)
  782. end
  783. end
  784. end
  785. end
  786. if attacker.beSkillList[BESKILL_TYPE4] then
  787. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE4]) do
  788. use(attacker,baojiDefender,v)
  789. end
  790. end
  791. if attacker.beSkillList[BESKILL_TYPE44] and CombatImpl.isFanji then
  792. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE44]) do
  793. use(attacker,baojiDefender,v)
  794. end
  795. end
  796. --指定技能暴击
  797. if attacker.beSkillList[BESKILL_TYPE58] then
  798. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE58]) do
  799. --local skillConfig = SkillExcel[v[1]]
  800. local skillConfig = Skill.GetSkillConfig(v[1])
  801. local beSkillArgs = skillConfig.beSkillArgs
  802. if beSkillArgs[1] == "skillID" then
  803. local canUse = false
  804. for _,v in ipairs(beSkillArgs[2]) do
  805. if skillID == v then
  806. canUse = true
  807. break
  808. end
  809. end
  810. if canUse then
  811. use(attacker,baojiDefender,v)
  812. end
  813. end
  814. end
  815. end
  816. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  817. local obj = CombatImpl.objList[pos]
  818. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE14] then
  819. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE14]) do
  820. use(obj,targets,v)
  821. end
  822. end
  823. end
  824. end
  825. if isDefendSideGedang then
  826. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  827. local obj = CombatImpl.objList[pos]
  828. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE9] then
  829. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE9]) do
  830. use(obj,targets,v)
  831. end
  832. end
  833. end
  834. end
  835. end
  836. function onHp(obj, hurt, attackPos)
  837. if obj.beSkillList[BESKILL_TYPE3] then
  838. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE3]) do
  839. use(obj,{},v)
  840. end
  841. end
  842. if obj.beSkillList[BESKILL_TYPE67] then
  843. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE67]) do
  844. use(obj,{},v)
  845. end
  846. end
  847. local attacker = CombatImpl.objList[attackPos]
  848. if attacker and attacker.beSkillList[BESKILL_TYPE30] and obj.pos ~= attackPos then
  849. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE30]) do
  850. --local skillConfig = SkillExcel[v[1]]
  851. local skillConfig = Skill.GetSkillConfig(v[1])
  852. local beSkillArgs = skillConfig.beSkillArgs
  853. obj.paramData.isbeSkillByHp = obj.paramData.isbeSkillByHp or 0
  854. if beSkillArgs[1] then
  855. if beSkillArgs[1] == "tohp" then
  856. local hp = obj.hp
  857. local hpMax = CombatObj.getHpMax(obj)
  858. if hp > hpMax * beSkillArgs[2]/10000 then
  859. obj.paramData.isbeSkillByHp = 0 --恢复到上限
  860. else
  861. if obj.isbeSkillByHp == 0 then
  862. obj.paramData.isbeSkillByHp = 1 --达到下限
  863. end
  864. end
  865. elseif beSkillArgs[1] == "hurthpper" then
  866. local hpMax = CombatObj.getHpMax(obj)
  867. local percent = -hurt/hpMax
  868. if percent > beSkillArgs[2]/10000 then -- 伤害超过目标生命值上限X%时
  869. use(attacker,{obj},v)
  870. end
  871. elseif beSkillArgs[1] == "speed" then
  872. local atkSpeed = CombatImpl.getValue(attacker,RoleDefine.SPEED)
  873. local defSpeed = CombatImpl.getValue(obj,RoleDefine.SPEED)
  874. if atkSpeed > defSpeed then
  875. use(attacker,{obj},v)
  876. end
  877. end
  878. end
  879. --使用技能
  880. if obj.paramData.isbeSkillByHp == 1 then
  881. use(attacker,{obj},v)
  882. obj.paramData.isbeSkillByHp = 2
  883. end
  884. end
  885. end
  886. end
  887. -- 选择合适的复活技能
  888. function selectReviceSkill(obj, attacker)
  889. local reviveSkillList = {}
  890. local len = 0
  891. for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
  892. local skillID = v[1]
  893. local isFuwenSkill = v[5]
  894. --local skillConfig = SkillExcel[skillID]
  895. local skillConfig = Skill.GetSkillConfig(skillID)
  896. if skillConfig.cmd == "revive" then
  897. --有可使用的主动复活技能
  898. local state = isCanRevive(obj, attacker, v)
  899. if state and isFuwenSkill == 0 then
  900. if checkLimit(v) then
  901. len = len + 1
  902. reviveSkillList[k] = 1
  903. break
  904. end
  905. end
  906. end
  907. end
  908. -- 没有再取符文技能的复活
  909. if len == 0 then
  910. for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
  911. local skillID = v[1]
  912. local isFuwenSkill = v[5]
  913. --local skillConfig = SkillExcel[skillID]
  914. local skillConfig = Skill.GetSkillConfig(skillID)
  915. if skillConfig.cmd == "revive" then
  916. local state = isCanRevive(obj, attacker, v)
  917. if state and isFuwenSkill == 1 then
  918. --被动技能次数限制判断
  919. if checkLimit(v) then
  920. reviveSkillList[k] = 1
  921. break
  922. end
  923. end
  924. end
  925. end
  926. end
  927. return reviveSkillList
  928. end
  929. function onDie(obj, hurt, attackPos)
  930. if obj.hp > 0 then
  931. return
  932. end
  933. local side = obj.side
  934. local attacker = CombatImpl.objList[attackPos]
  935. if obj.dieSkill then
  936. if attacker and attacker.beSkillList[BESKILL_TYPE43] then
  937. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE43]) do
  938. --local skillConfig = SkillExcel[v[1]]
  939. local skillConfig = Skill.GetSkillConfig(v[1])
  940. for _,v1 in ipairs(skillConfig.beSkillArgs) do
  941. if v1 == obj.dieSkill then
  942. use(attacker,{obj},v)
  943. break
  944. end
  945. end
  946. end
  947. end
  948. end
  949. local defendSide = side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
  950. for _,posData in ipairs(posSortBySpeed[side]) do
  951. local pos = posData[1]
  952. local target = CombatImpl.objList[pos]
  953. if target and target.hp > 0 then
  954. if target.beSkillList[BESKILL_TYPE16] then
  955. for _,v in ipairs(target.beSkillList[BESKILL_TYPE16]) do
  956. use(target,{obj},v)
  957. end
  958. end
  959. if target.beSkillList[BESKILL_TYPE18] then
  960. for _,v in ipairs(target.beSkillList[BESKILL_TYPE18]) do
  961. use(target,{obj},v)
  962. end
  963. end
  964. end
  965. end
  966. for _,posData in ipairs(posSortBySpeed[defendSide]) do
  967. local pos = posData[1]
  968. local target = CombatImpl.objList[pos]
  969. if target and target.hp > 0 then
  970. if target.beSkillList[BESKILL_TYPE17] then
  971. for _,v in ipairs(target.beSkillList[BESKILL_TYPE17]) do
  972. use(target,{obj},v)
  973. end
  974. end
  975. if target.beSkillList[BESKILL_TYPE18] then
  976. for _,v in ipairs(target.beSkillList[BESKILL_TYPE18]) do
  977. use(target,{obj},v)
  978. end
  979. end
  980. end
  981. end
  982. if attacker and attacker.beSkillList and attacker.beSkillList[BESKILL_TYPE30] and obj.pos ~= attackPos then
  983. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE30]) do
  984. if obj.isbeSkillByHp == nil or
  985. obj.isbeSkillByHp == 0 then
  986. use(attacker,{},v)
  987. end
  988. end
  989. end
  990. if attacker and attacker.beSkillList and attacker.beSkillList[BESKILL_TYPE35] then
  991. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE35]) do
  992. use(attacker,{obj},v)
  993. end
  994. end
  995. if obj.beSkillList[BESKILL_TYPE15] then
  996. -- 选择其中一个使用
  997. local reviceSkillList = selectReviceSkill(obj, attacker)
  998. for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
  999. local skillID = v[1]
  1000. --local skillConfig = SkillExcel[skillID]
  1001. local skillConfig = Skill.GetSkillConfig(skillID)
  1002. if skillConfig.cmd == "revive" then
  1003. if reviceSkillList[k] then
  1004. use(obj,{},v)
  1005. break
  1006. end
  1007. else
  1008. use(obj,{},v)
  1009. end
  1010. end
  1011. end
  1012. for _,pos in ipairs(CombatDefine.SIDE2POS[defendSide]) do
  1013. local defendobj = CombatImpl.objList[pos]
  1014. if defendobj and defendobj.hp > 0 and defendobj.beSkillList[BESKILL_TYPE66] then
  1015. for _,v in ipairs(defendobj.beSkillList[BESKILL_TYPE66]) do
  1016. --local skillConfig = SkillExcel[v[1]]
  1017. local skillConfig = Skill.GetSkillConfig(v[1])
  1018. if skillConfig and skillConfig.otherArgs.tdBuffCmd then
  1019. if obj.bufferCmd[skillConfig.otherArgs.tdBuffCmd] then
  1020. use(defendobj,{},v)
  1021. end
  1022. end
  1023. end
  1024. end
  1025. end
  1026. end
  1027. function onAddBuffer(obj,buffer)
  1028. --local conf = BufferExcel[buffer.id]
  1029. local conf = CombatBuff.GetBuffConfig(buffer.id)
  1030. local attacker = CombatImpl.objList[buffer.attackPos]
  1031. local cmd = conf.cmd
  1032. if cmd == "hurt" or cmd == "liuxue"or cmd == "liuxue2" or cmd == "zhongdu" or cmd == "ranshao" then
  1033. if obj.beSkillList[BESKILL_TYPE10] then
  1034. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE10]) do
  1035. use(obj,{attacker},v)
  1036. end
  1037. end
  1038. end
  1039. if cmd == "bingdong" or cmd == "jiansu" then
  1040. for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
  1041. local target = CombatImpl.objList[pos]
  1042. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE63] then
  1043. for _,v in ipairs(target.beSkillList[BESKILL_TYPE63]) do
  1044. use(target,{obj},v)
  1045. end
  1046. end
  1047. end
  1048. end
  1049. if CombatBuff.isControlCmd(cmd) then
  1050. if obj.beSkillList[BESKILL_TYPE11] then
  1051. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE11]) do
  1052. use(obj,{attacker},v)
  1053. end
  1054. end
  1055. if obj.beSkillList[BESKILL_TYPE67] then
  1056. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE67]) do
  1057. use(obj,{attacker},v, true, true)
  1058. end
  1059. end
  1060. end
  1061. if cmd == "ranshao" then
  1062. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1063. local target = CombatImpl.objList[pos]
  1064. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE12] then
  1065. for _,v in ipairs(target.beSkillList[BESKILL_TYPE12]) do
  1066. local beSkillUseCnt = CombatImpl.getBeSkillUse(target,obj.pos,v[1])--特殊条件特殊处理:同一英雄在同一时间被施加多次燃烧状态时只触发一次
  1067. if beSkillUseCnt == 0 then
  1068. use(target,{obj},v)
  1069. CombatImpl.addBeSkillUse(target,obj.pos,v[1])
  1070. end
  1071. end
  1072. end
  1073. end
  1074. end
  1075. if cmd == "zuzhou" then
  1076. for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
  1077. local target = CombatImpl.objList[pos]
  1078. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE51] then
  1079. for _,v in ipairs(target.beSkillList[BESKILL_TYPE51]) do
  1080. use(target,{obj},v)
  1081. end
  1082. end
  1083. end
  1084. end
  1085. if cmd == "revive" then
  1086. if obj.beSkillList[BESKILL_TYPE33] then
  1087. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE33]) do
  1088. use(obj,{attacker},v)
  1089. end
  1090. end
  1091. end
  1092. end
  1093. function onDelBingDongBuffer(obj, buffer)
  1094. --local conf = BufferExcel[buffer.id]
  1095. local conf = CombatBuff.GetBuffConfig(buffer.id)
  1096. local attacker = CombatImpl.objList[buffer.attackPos]
  1097. if conf.cmd == "bingdong" then
  1098. for _, pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
  1099. local target = CombatImpl.objList[pos]
  1100. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE64] then
  1101. for _,v in ipairs(target.beSkillList[BESKILL_TYPE64]) do
  1102. use(target,{obj},v)
  1103. end
  1104. end
  1105. end
  1106. end
  1107. end
  1108. --援军上阵触发
  1109. function onBackupBegin(obj)
  1110. if not obj then return end
  1111. if CombatDefine.isBackup(obj) ~= CombatDefine.BACKUP_TYPE2 then return end
  1112. -- 备份的被动技能上阵
  1113. if obj.backUpSkillList then
  1114. obj.beSkillList = obj.backUpSkillList
  1115. obj.backUpSkillList = nil
  1116. end
  1117. -- 出站计算属性
  1118. if obj.beSkillList[BESKILL_TYPE26] then
  1119. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE26]) do
  1120. if canUse(obj,v) then
  1121. --local skillConfig = SkillExcel[v[1]]
  1122. local skillConfig = Skill.GetSkillConfig(v[1])
  1123. if skillConfig.cmd == "attr" then
  1124. for _,v1 in ipairs(skillConfig.args) do
  1125. obj.sysAttr[v1[1]] = obj.sysAttr[v1[1]] +v1[2]
  1126. end
  1127. obj.isSysAttrChange = true
  1128. elseif skillConfig.cmd == "normalTarget" then
  1129. use(obj,{},v)
  1130. end
  1131. end
  1132. end
  1133. end
  1134. table.sort(posSortBySpeed[CombatDefine.ATTACK_SIDE],posSpeedCmp)
  1135. table.sort(posSortBySpeed[CombatDefine.DEFEND_SIDE],posSpeedCmp)
  1136. --援军出战触发
  1137. if obj and obj.beSkillList[BESKILL_TYPE32] then
  1138. for k,v in ipairs(obj.beSkillList[BESKILL_TYPE32]) do
  1139. use(obj,{},v)
  1140. end
  1141. end
  1142. --上场技能
  1143. CombatDefine.BACKUP_BUFF_SKILL[2] = 1
  1144. use(obj,{}, CombatDefine.BACKUP_BUFF_SKILL)
  1145. end
  1146. function onRoundBegin(round)
  1147. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1148. local target = CombatImpl.objList[pos]
  1149. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE19] then
  1150. for _,v in ipairs(target.beSkillList[BESKILL_TYPE19]) do
  1151. --table.print_lua_table(v)
  1152. -- print("beskill = onRoundBegin 开始使用技能 ID = "..v[1])
  1153. use(target,{},v)
  1154. end
  1155. end
  1156. -- 生命值触发
  1157. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE62] then
  1158. for _,v in ipairs(target.beSkillList[BESKILL_TYPE62]) do
  1159. --local skillConfig = SkillExcel[v[1]]
  1160. local skillConfig = Skill.GetSkillConfig(v[1])
  1161. local beSkillArgs = skillConfig.beSkillArgs
  1162. if beSkillArgs[1] == 1 then
  1163. local hpMax = CombatObj.getHpMax(target)
  1164. local percent = target.hp/hpMax
  1165. if percent > beSkillArgs[2]/10000 then
  1166. use(target,{},v)
  1167. end
  1168. end
  1169. if beSkillArgs[1] == 2 then
  1170. local hpMax = CombatObj.getHpMax(target)
  1171. local percent = target.hp/hpMax
  1172. if percent < beSkillArgs[2]/10000 then
  1173. use(target,{},v)
  1174. end
  1175. end
  1176. end
  1177. end
  1178. end
  1179. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1180. local target = CombatImpl.objList[pos]
  1181. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE47] then
  1182. for _,v in ipairs(target.beSkillList[BESKILL_TYPE47]) do
  1183. --local skillConfig = SkillExcel[v[1]]
  1184. local skillConfig = Skill.GetSkillConfig(v[1])
  1185. if skillConfig.cmd == "attr" then
  1186. for _,v1 in ipairs(skillConfig.args) do
  1187. target.sysAttr[v1[1]] = target.sysAttr[v1[1]] +v1[2]
  1188. end
  1189. CombatObj.calcAttr(target)
  1190. CombatImpl.addFrame()
  1191. CombatImpl.setSkillID(target, v[1])
  1192. CombatImpl.setSaySkill(target.pos,skillConfig.id,skillConfig.contentType)
  1193. end
  1194. end
  1195. end
  1196. end
  1197. if round and round == 1 then
  1198. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1199. local obj = CombatImpl.objList[pos]
  1200. if obj and obj.beSkillList[BESKILL_TYPE32] then
  1201. for k,v in ipairs(obj.beSkillList[BESKILL_TYPE32]) do
  1202. use(obj,{},v)
  1203. end
  1204. end
  1205. end
  1206. end
  1207. -- 在最后加
  1208. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1209. local target = CombatImpl.objList[pos]
  1210. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE71] then
  1211. for _,v in ipairs(target.beSkillList[BESKILL_TYPE71]) do
  1212. -- print("[onRoundBegin] 开始加类型71的被动技能 pos = "..pos)
  1213. local skillConfig = Skill.GetSkillConfig(v[1])
  1214. if skillConfig and skillConfig.args then
  1215. local nLen = skillConfig.args[1]
  1216. for i = 1, nLen, 1 do
  1217. use(target,{},v)
  1218. end
  1219. end
  1220. end
  1221. end
  1222. end
  1223. end
  1224. function beforeFanji(obj, hitObj, isEnd)
  1225. if not obj or obj.isPet then
  1226. return
  1227. end
  1228. if obj and obj.hurtType == CombatDefine.PHY_HURT_TYPE then
  1229. if obj and obj.beSkillList and obj.beSkillList[BESKILL_TYPE37] then
  1230. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE37]) do
  1231. -- use(obj,{},v)
  1232. use(obj, {}, v, nil, nil, hitObj)
  1233. end
  1234. end
  1235. else
  1236. if obj and obj.beSkillList and obj.beSkillList[BESKILL_TYPE38] then
  1237. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE38]) do
  1238. use(obj,{},v)
  1239. end
  1240. end
  1241. end
  1242. end
  1243. function onRoundEnd(isRoundEnd)
  1244. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1245. local obj = CombatImpl.objList[pos]
  1246. if obj and obj.beSkillList[BESKILL_TYPE36] then
  1247. if pos == 1 then
  1248. end
  1249. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE36]) do
  1250. use(obj,{},v)
  1251. end
  1252. end
  1253. end
  1254. if isRoundEnd then
  1255. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1256. local target = CombatImpl.objList[pos]
  1257. if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE20] then
  1258. for _,v in ipairs(target.beSkillList[BESKILL_TYPE20]) do
  1259. use(target,{},v)
  1260. end
  1261. end
  1262. end
  1263. end
  1264. end
  1265. function posSpeedCmp(a,b)
  1266. if a[2] > b[2] then
  1267. return true
  1268. elseif a[2] < b[2] then
  1269. return false
  1270. else
  1271. return a[1] < b[1]
  1272. end
  1273. end
  1274. -- 计算遗物特殊属性部分
  1275. local function BeSkill_RelicAttribute(ReleaserObj, tSkillInfo)
  1276. local nSkillID = tSkillInfo[1]
  1277. local tSkilConfig = Skill.GetSkillConfig(nSkillID)
  1278. if not tSkilConfig then
  1279. -- print("[BeSkill_RelicAttribute] 不存在技能配置 nSkillID = "..nSkillID)
  1280. return
  1281. end
  1282. local winnerID = ReleaserObj and ReleaserObj.relic and ReleaserObj.relic.relicID or 0
  1283. local winnerStar = ReleaserObj and ReleaserObj.relic and ReleaserObj.relic.star or 0
  1284. if 0 >= winnerID or 0 >= winnerStar then
  1285. return
  1286. end
  1287. -- 特殊处理防御为0, 加标识
  1288. if tSkilConfig.otherArgs.selefDefense then
  1289. ReleaserObj.relicAttr.bSpecialDef = true
  1290. end
  1291. -- 是否增加args属性
  1292. local bAddArgs = true
  1293. if tSkilConfig.otherArgs.winnerfiveraces then
  1294. bAddArgs = false
  1295. end
  1296. local targets = TargetMode.getTargets(ReleaserObj, tSkilConfig.targetMode)
  1297. if #targets > 0 and true == bAddArgs then
  1298. for _, obj in ipairs(targets) do
  1299. -- 加固定值属性
  1300. for _, v in ipairs(tSkilConfig.args) do
  1301. if not obj.relicAttr.FixedAttr[v[1]] then
  1302. obj.relicAttr.FixedAttr[v[1]] = 0
  1303. end
  1304. obj.relicAttr.FixedAttr[v[1]] = obj.relicAttr.FixedAttr[v[1]] + v[2]
  1305. end
  1306. end
  1307. else
  1308. -- print("[BeSkill_RelicAttribute] 获取不到对应的技能目标对象")
  1309. end
  1310. local nSide = ReleaserObj.side
  1311. local tCamp = {}
  1312. -- 检查
  1313. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1314. local obj = CombatImpl.objList[pos]
  1315. if obj and obj.side and nSide == obj.side then
  1316. local nCamp = obj.camp
  1317. if nCamp then
  1318. tCamp[nCamp] = 1
  1319. end
  1320. end
  1321. end
  1322. local bAllCamp = true
  1323. for i = CombatDefine.CAMP_TYPE1, CombatDefine.CAMP_TYPE5, 1 do
  1324. if not tCamp[i] then
  1325. bAllCamp = false
  1326. break
  1327. end
  1328. end
  1329. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1330. local obj = CombatImpl.objList[pos]
  1331. if obj and obj.side and nSide == obj.side then
  1332. -- 处理百分比值
  1333. -- 治疗
  1334. if tSkilConfig.otherArgs.jobZhiliao then
  1335. --table.print_lua_table(tSkilConfig.otherArgs.jobZhiliao)
  1336. if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE4}) then
  1337. -- local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
  1338. if not obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
  1339. obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] = 0
  1340. end
  1341. local nValue = tSkilConfig.otherArgs.jobZhiliao[2]
  1342. -- print("BeSkill_RelicAttribute 治療 nValue = ".. nValue)
  1343. obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] = obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] + nValue
  1344. if obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
  1345. -- print("[BeSkill_RelicAttribute] 治療加成 為 nNewValue = "..obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] )
  1346. else
  1347. -- print("[BeSkill_RelicAttribute] 不存在 nNewValue" )
  1348. end
  1349. end
  1350. end
  1351. -- 免伤 百分比
  1352. if tSkilConfig.otherArgs.jobMianshang then
  1353. if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE1}) then
  1354. --local extraRate = WinnerRelicLogic.WinnerRelic_GetRateDef(winnerID, winnerStar)
  1355. if not obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] then
  1356. obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] = 0
  1357. end
  1358. local nValue = tSkilConfig.otherArgs.jobMianshang[2]
  1359. -- print("BeSkill_RelicAttribute 免伤 nValue = ".. nValue)
  1360. obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] = obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] + nValue
  1361. -- print("[BeSkill_RelicAttribute] 免傷加成 為 nValue = "..nValue.." nNewValue = "..obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE])
  1362. end
  1363. end
  1364. -- 防御增加固定值
  1365. if tSkilConfig.otherArgs.jobDefense then
  1366. if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE4, CombatDefine.JOB_TYPE1}) then
  1367. if winnerID > 0 and winnerStar > 0 then
  1368. local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
  1369. if not obj.relicAttr.FixedAttr[RoleDefine.DEF] then
  1370. obj.relicAttr.FixedAttr[RoleDefine.DEF] = 0
  1371. end
  1372. obj.relicAttr.FixedAttr[RoleDefine.DEF] = obj.relicAttr.FixedAttr[RoleDefine.DEF] + extraRate
  1373. end
  1374. end
  1375. end
  1376. -- 攻击 百分比
  1377. if tSkilConfig.otherArgs.racialAtk then
  1378. if CombatBuff.isCamp(obj, {CombatDefine.COMBAT_TYPE27}) then
  1379. local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
  1380. if not obj.relicAttr.ProAttr[RoleDefine.ATK] then
  1381. obj.relicAttr.ProAttr[RoleDefine.ATK] = 0
  1382. end
  1383. obj.relicAttr.ProAttr[RoleDefine.ATK] = obj.relicAttr.ProAttr[RoleDefine.ATK] + extraRate
  1384. end
  1385. end
  1386. -- 上阵阵容为全职业,加固定值
  1387. if tSkilConfig.otherArgs.winnerfiveraces and bAllCamp == true then
  1388. for _, v in ipairs(tSkilConfig.args) do
  1389. if not obj.relicAttr.FixedAttr[v[1]] then
  1390. obj.relicAttr.FixedAttr[v[1]] = 0
  1391. end
  1392. obj.relicAttr.FixedAttr[v[1]] = obj.relicAttr.FixedAttr[v[1]] + v[2]
  1393. end
  1394. end
  1395. end
  1396. end
  1397. end
  1398. function onFightBegin()
  1399. posSortBySpeed[CombatDefine.ATTACK_SIDE] = {}
  1400. posSortBySpeed[CombatDefine.DEFEND_SIDE] = {}
  1401. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1402. local obj = CombatImpl.objList[pos]
  1403. if obj then
  1404. obj.hp = obj.hp and obj.hp or 1
  1405. end
  1406. end
  1407. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1408. local obj = CombatImpl.objList[pos]
  1409. if obj then
  1410. if obj.beSkillList[BESKILL_TYPE26] then
  1411. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE26]) do
  1412. if canUse(obj,v) then
  1413. --local skillConfig = SkillExcel[v[1]]
  1414. local skillConfig = Skill.GetSkillConfig(v[1])
  1415. if skillConfig.cmd == "attr" then
  1416. for _,v1 in ipairs(skillConfig.args) do
  1417. obj.sysAttr[v1[1]] = obj.sysAttr[v1[1]] +v1[2]
  1418. end
  1419. obj.isSysAttrChange = true
  1420. elseif skillConfig.cmd == "normalTarget" then
  1421. use(obj,{},v)
  1422. elseif skillConfig.cmd == "winnerRelicSkill" then
  1423. use(obj,{},v)
  1424. BeSkill_RelicAttribute(obj, v)
  1425. end
  1426. end
  1427. end
  1428. end
  1429. if pos <= CombatDefine.COMBAT_HERO_CNT then
  1430. posSortBySpeed[CombatDefine.ATTACK_SIDE][#posSortBySpeed[CombatDefine.ATTACK_SIDE]+1] = {pos,obj.attr and obj.attr[RoleDefine.SPEED] or 0}
  1431. elseif pos <= CombatDefine.COMBAT_HERO_CNT * 2 then
  1432. posSortBySpeed[CombatDefine.DEFEND_SIDE][#posSortBySpeed[CombatDefine.DEFEND_SIDE]+1] = {pos,obj.attr and obj.attr[RoleDefine.SPEED] or 0}
  1433. end
  1434. end
  1435. end
  1436. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  1437. local obj = CombatImpl.objList[pos]
  1438. if obj then
  1439. obj.hp = nil
  1440. end
  1441. end
  1442. table.sort(posSortBySpeed[CombatDefine.ATTACK_SIDE],posSpeedCmp)
  1443. table.sort(posSortBySpeed[CombatDefine.DEFEND_SIDE],posSpeedCmp)
  1444. end
  1445. function onCombatPetBe(round)
  1446. if round <= 1 then
  1447. return
  1448. end
  1449. for side = 1,CombatDefine.DEFEND_SIDE do
  1450. local pet = CombatImpl.petList[side]
  1451. if pet and pet.petID and pet.beSkillList[BESKILL_TYPE27] then
  1452. for _,v in ipairs(pet.beSkillList[BESKILL_TYPE27]) do
  1453. --local skillConfig = SkillExcel[v[1]]
  1454. local skillConfig = Skill.GetSkillConfig(v[1])
  1455. if skillConfig.cmd == "mp" then
  1456. use(pet,{},v)
  1457. end
  1458. end
  1459. end
  1460. end
  1461. end
  1462. -- 计算被动技能属性
  1463. local beSkillIDList = {}
  1464. function doCalcHero(obj, attrs, skinSkillID, heroConf)
  1465. for i = 1, #beSkillIDList do
  1466. beSkillIDList[i] = nil
  1467. end
  1468. heroConf = heroConf or HeroDefine.getAttrConfig(obj.id, obj.star)
  1469. local beSkillIDs = heroConf.beSkillList
  1470. local skinSkillConf = skinSkillID and SkinSkillExcel[skinSkillID]
  1471. if skinSkillConf then
  1472. beSkillIDs = skinSkillConf.beSkillList
  1473. end
  1474. local weapSkillList = HeroExclusiveWeapon.GetweaponEffectIdList(obj)
  1475. for _, skillID in ipairs(beSkillIDs) do
  1476. --local skillConfig = SkillExcel[skillID]
  1477. skillID = weapSkillList and weapSkillList[skillID] or skillID
  1478. local skillConfig = Skill.GetSkillConfig(skillID)
  1479. if skillConfig.beSkillType == BESKILL_TYPE24 and
  1480. ((not obj) or (obj.quality >= skillConfig.need)) then
  1481. for _,v in ipairs(skillConfig.args) do
  1482. beSkillIDList[#beSkillIDList + 1] = v
  1483. end
  1484. else
  1485. beSkillIDList[#beSkillIDList + 1] = skillID
  1486. end
  1487. end
  1488. for _, skillID in ipairs(beSkillIDList) do
  1489. --local skillConfig = SkillExcel[skillID]
  1490. local skillConfig = Skill.GetSkillConfig(skillID)
  1491. if skillConfig and skillConfig.cmd == "attr" and
  1492. skillConfig.beSkillType == BESKILL_TYPE23 and
  1493. ((not obj) or (obj.quality >= skillConfig.need)) then
  1494. for _, v in ipairs(skillConfig.args) do
  1495. RoleAttr.updateValue(v[1], v[2], attrs)
  1496. end
  1497. elseif skillConfig and skillConfig.cmd == "attrcomboAgain" and
  1498. skillConfig.beSkillType == BESKILL_TYPE70 and
  1499. ((not obj) or (obj.quality >= skillConfig.need)) then
  1500. for i, v in ipairs(skillConfig.args) do
  1501. if v[1] == 1 then
  1502. RoleAttr.updateValue(v[2], v[3], attrs)
  1503. end
  1504. end
  1505. end
  1506. end
  1507. end
  1508. function beforeHit(attacker,defender)
  1509. attacker.beforeHitCheck = false
  1510. if attacker.beSkillList[BESKILL_TYPE40] then
  1511. local hpMax = CombatObj.getHpMax(defender)
  1512. local hp = defender.hp
  1513. local defendHpRate = hp*10000/hpMax
  1514. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
  1515. --local skillConfig = SkillExcel[v[1]]
  1516. local skillConfig = Skill.GetSkillConfig(v[1])
  1517. if skillConfig.cmd == "lowerLimit" then
  1518. local args = skillConfig.args
  1519. if defendHpRate < args[1] then
  1520. attacker.beforeHitCheck = true
  1521. attacker.beskill40 = attacker.beskill40 or {}
  1522. attacker.beskill40[defender.pos] = 1
  1523. end
  1524. end
  1525. end
  1526. end
  1527. end
  1528. function afterHit(attacker,target, isEnd)
  1529. if attacker.beforeHitCheck then
  1530. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
  1531. use(attacker,{target},v)
  1532. end
  1533. end
  1534. -- beforeFanji(attacker, isEnd)
  1535. beforeFanji(attacker, target, isEnd)
  1536. end
  1537. function getOutAtkRate(attacker, defender)
  1538. local outAtkRate = 0
  1539. -- 首次攻击
  1540. local isFirstAttack = CombatImpl.firstAttack[attacker.side]
  1541. if isFirstAttack then
  1542. for _,pos in ipairs(CombatDefine.SIDE2POS[defender.side]) do
  1543. local objM = CombatImpl.objList[pos]
  1544. if objM and objM.beSkillList[BESKILL_TYPE50] then
  1545. for _,v in ipairs(objM.beSkillList[BESKILL_TYPE50]) do
  1546. --local skillConfig = SkillExcel[v[1]]
  1547. local skillConfig = Skill.GetSkillConfig(v[1])
  1548. if skillConfig and skillConfig.otherArgs.outAtkRate then
  1549. if skillConfig.otherArgs.outAtkRate >= outAtkRate then
  1550. outAtkRate = skillConfig.otherArgs.outAtkRate
  1551. end
  1552. end
  1553. end
  1554. end
  1555. end
  1556. end
  1557. return outAtkRate
  1558. end
  1559. function getOutAtkRate2(attacker, skillConfig)
  1560. local outAtkRate = 0
  1561. for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE72] or {}) do
  1562. local config = Skill.GetSkillConfig(v[1])
  1563. if config.cmd == "addHurtRateByRand" then
  1564. local addHurtRate = 0
  1565. for _, skillInfo in ipairs(config.beSkillArgs[2]) do
  1566. if table.find(skillInfo[1], skillConfig.id) then
  1567. addHurtRate = skillInfo[2]
  1568. break
  1569. end
  1570. end
  1571. local randVal = math.random(0, 10000)
  1572. if randVal <= config.beSkillArgs[1] then
  1573. outAtkRate = outAtkRate + addHurtRate
  1574. end
  1575. end
  1576. end
  1577. return outAtkRate
  1578. end
  1579. function getExtraHurtRate(attacker,defender,skillConfig)
  1580. if not attacker or attacker.isPet then
  1581. return 0
  1582. end
  1583. local zhanyiRet = 0
  1584. local bodongHurtRet = 0
  1585. local zhenduiHurtRate = 0
  1586. local zhenduiLen = 0
  1587. local zhenduiList = {}
  1588. local bezhenduiList = {}
  1589. local hpHurtRate = 0
  1590. local extraSpeedHurt = 0
  1591. local firstHurt = 0
  1592. local sexHurt = 0
  1593. local campHurt = 0
  1594. local reJobHurt = 0
  1595. local buffAndHPSubHurt = 0
  1596. for k,skillList in pairs(attacker.beSkillList) do
  1597. for j,v in pairs(skillList) do
  1598. --local config = SkillExcel[v[1]]
  1599. local config = Skill.GetSkillConfig(v[1])
  1600. if config.cmd == "zhanyi" then --战意 伤害加成
  1601. local nowHp = attacker.hp
  1602. local hpMax = CombatObj.getHpMax(attacker)
  1603. local percent = math.floor( (hpMax - nowHp )/hpMax * 100)
  1604. if percent >= 1 then
  1605. zhanyiRet = zhanyiRet + (percent * config.args[2])
  1606. end
  1607. elseif config.cmd == "fuwenAKH" then
  1608. for i = 1,#config.otherArgs do
  1609. zhenduiLen = zhenduiLen + 1
  1610. zhenduiList[config.otherArgs[i][1]] = zhenduiList[config.otherArgs[i][1]] or 0
  1611. zhenduiList[config.otherArgs[i][1]] = zhenduiList[config.otherArgs[i][1]] + config.otherArgs[i][2]
  1612. end
  1613. elseif config.cmd == "hurtBodong" then
  1614. if canUse(attacker, v) then
  1615. local minRet = config.args[1]
  1616. local maxRet = config.args[2]
  1617. local randomRet = math.random(minRet, maxRet)
  1618. bodongHurtRet = bodongHurtRet + randomRet - 10000
  1619. end
  1620. elseif config.cmd == "hpExtraHurt" then
  1621. local hp = defender.hp
  1622. local beSkillArgs = config.beSkillArgs
  1623. local checkHp = CombatObj.getHpMax(defender) * beSkillArgs[3] / 10000
  1624. if beSkillArgs[2] == 1 and hp > checkHp then
  1625. hpHurtRate = beSkillArgs[4]
  1626. elseif beSkillArgs[2] == 2 and hp < checkHp then
  1627. hpHurtRate = beSkillArgs[4]
  1628. end
  1629. elseif config.cmd == "extraSpeedHurt" then
  1630. extraSpeedHurt = config.args[1]
  1631. elseif config.cmd == "firstAttackHurt" then
  1632. if canUse(attacker, v) then
  1633. firstHurt = config.args[1]
  1634. end
  1635. elseif config.cmd == "buffAndHPSub" then
  1636. local nowHp = defender.hp
  1637. local hpMax = CombatObj.getHpMax(defender)
  1638. local percent = math.floor((hpMax - nowHp )/hpMax * 100) --已损失血量百分比
  1639. local condCfg = config.args
  1640. local condRate = condCfg[1]
  1641. if percent >= condRate then
  1642. local condStatusList = condCfg[2] or {}
  1643. local objNowSatus = CombatBuff.getStatus(defender)
  1644. for buffCmd in pairs(condStatusList) do
  1645. if objNowSatus[buffCmd] then
  1646. buffAndHPSubHurt = condCfg[3] or 0
  1647. break
  1648. end
  1649. end
  1650. end
  1651. end
  1652. end
  1653. end
  1654. for k,skillList in pairs(defender.beSkillList) do
  1655. for j,v in pairs(skillList) do
  1656. --local conf = SkillExcel[v[1]]
  1657. local conf = Skill.GetSkillConfig(v[1])
  1658. if conf then
  1659. if conf.cmd == "befuwenAKH" then
  1660. for i = 1,#conf.otherArgs do
  1661. zhenduiLen = zhenduiLen + 1
  1662. bezhenduiList[conf.otherArgs[i][1]] = bezhenduiList[conf.otherArgs[i][1]] or 0
  1663. bezhenduiList[conf.otherArgs[i][1]] = bezhenduiList[conf.otherArgs[i][1]] + conf.otherArgs[i][2]
  1664. end
  1665. -- 受性别增伤
  1666. elseif conf.cmd == "sexHurt" then
  1667. if attacker.sex == conf.args[1] then
  1668. sexHurt = sexHurt + conf.args[2]
  1669. end
  1670. -- 受阵营增伤
  1671. elseif conf.cmd == "campHurt" then
  1672. if attacker.camp == conf.args[1] then
  1673. campHurt = campHurt + conf.args[2]
  1674. end
  1675. -- 受职业增伤
  1676. elseif conf.cmd == "reJobHurt" then
  1677. if attacker.job == conf.args[1] then
  1678. reJobHurt = reJobHurt + conf.args[2]
  1679. end
  1680. end
  1681. end
  1682. end
  1683. end
  1684. if zhenduiLen > 0 then
  1685. local bAdd = 0
  1686. for k,skillList in pairs(defender.beSkillList) do
  1687. for j,v in pairs(skillList) do
  1688. --local conf = SkillExcel[v[1]]
  1689. local conf = Skill.GetSkillConfig(v[1])
  1690. local isFuWenSkill = v[5]
  1691. if conf.cmd and conf.cmd ~= "" and zhenduiList[conf.cmd] then
  1692. -- 符文技能只生效一个
  1693. if isFuWenSkill == 1 then
  1694. if bAdd == 0 then
  1695. zhenduiHurtRate = zhenduiHurtRate + zhenduiList[conf.cmd]
  1696. bAdd = 1
  1697. end
  1698. else
  1699. zhenduiHurtRate = zhenduiHurtRate + zhenduiList[conf.cmd]
  1700. end
  1701. end
  1702. end
  1703. end
  1704. bAdd = 0
  1705. for k,skillList in pairs(attacker.beSkillList) do
  1706. for j,v in pairs(skillList) do
  1707. --local conf = SkillExcel[v[1]]
  1708. local conf = Skill.GetSkillConfig(v[1])
  1709. local isFuWenSkill = v[5]
  1710. if conf.cmd and conf.cmd ~= "" and bezhenduiList[conf.cmd] then
  1711. if isFuWenSkill == 1 then
  1712. if bAdd == 0 then
  1713. zhenduiHurtRate = zhenduiHurtRate + bezhenduiList[conf.cmd]
  1714. bAdd = 1
  1715. end
  1716. else
  1717. zhenduiHurtRate = zhenduiHurtRate + bezhenduiList[conf.cmd]
  1718. end
  1719. end
  1720. end
  1721. end
  1722. end
  1723. --特殊buff 对血族的加成
  1724. local campHurtRate = 0
  1725. local campRate = nil
  1726. local buffCmd = nil
  1727. local camp = nil
  1728. for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
  1729. obj = CombatImpl.objList[pos]
  1730. if obj and obj.hp > 0 then
  1731. if obj.beSkillList[BESKILL_TYPE68] then
  1732. local beSkillList = obj.beSkillList[BESKILL_TYPE68][1]
  1733. --local skillConfig = SkillExcel[beSkillList[1]]
  1734. local skillConfig = Skill.GetSkillConfig(beSkillList[1])
  1735. if skillConfig then
  1736. camp = skillConfig.otherArgs.calcCamp[1]
  1737. buffCmd = skillConfig.otherArgs.calcCamp[2]
  1738. campRate = skillConfig.otherArgs.calcCamp[3]
  1739. break
  1740. end
  1741. end
  1742. end
  1743. end
  1744. if buffCmd and campRate and attacker.camp == camp then
  1745. local campHurtCnt = 0
  1746. for _,pos in ipairs(CombatDefine.SIDE2POS[defender.side]) do
  1747. obj = CombatImpl.objList[pos]
  1748. if obj and obj.hp > 0 then
  1749. local isStatus1, cmd1, ind1 = CombatBuff.isStatus(obj, buffCmd)
  1750. if isStatus1 then
  1751. campHurtCnt = campHurtCnt + 1
  1752. end
  1753. end
  1754. end
  1755. if campHurtCnt > 0 then
  1756. campHurtRate = campHurtCnt * campRate
  1757. end
  1758. end
  1759. local extraHurtRate = zhanyiRet + zhenduiHurtRate + bodongHurtRet + hpHurtRate + extraSpeedHurt + firstHurt + sexHurt + campHurt + reJobHurt + campHurtRate + buffAndHPSubHurt
  1760. if attacker.beSkillList[BESKILL_TYPE40] and attacker.beforeHitCheck then
  1761. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
  1762. --local skillConfig = SkillExcel[v[1]]
  1763. local skillConfig = Skill.GetSkillConfig(v[1])
  1764. if skillConfig.cmd == "extraHurt" then
  1765. local args = skillConfig.args
  1766. extraHurtRate = extraHurtRate + args[1]
  1767. end
  1768. end
  1769. end
  1770. return extraHurtRate
  1771. end
  1772. --
  1773. function getExtraHurt(attacker, target, tUseskillConfig)
  1774. local extraHurt = 0
  1775. if attacker.beSkillList[BESKILL_TYPE55] then
  1776. local beSkillList = attacker.beSkillList[BESKILL_TYPE55][1]
  1777. --local skillConfig = SkillExcel[beSkillList[1]]
  1778. local skillConfig = Skill.GetSkillConfig(beSkillList[1])
  1779. local buffCmd = target.bufferCmd[skillConfig.otherArgs.buffCmdHurtRate[1]]
  1780. local rate = skillConfig.otherArgs.buffCmdHurtRate[2] / 10000
  1781. if buffCmd then
  1782. local buffCnt = #buffCmd
  1783. local buffIndex = buffCmd[buffCnt]
  1784. local buffer = target.buffer[buffIndex]
  1785. --local conf = BufferExcel[buffer.id]
  1786. local conf = CombatBuff.GetBuffConfig(buffer.id)
  1787. local hurt = buffer.arg[1]
  1788. extraHurt = extraHurt + hurt * rate * buffCnt
  1789. end
  1790. end
  1791. return extraHurt
  1792. end
  1793. --
  1794. function getRandomBuffCmd(attacker, target, cmd)
  1795. local side = attacker.side
  1796. local mathRandom = math.random
  1797. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  1798. local obj = CombatImpl.objList[pos]
  1799. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE56] then
  1800. local beSkillList = obj.beSkillList[BESKILL_TYPE56][1]
  1801. --local skillConfig = SkillExcel[beSkillList[1]]
  1802. local skillConfig = Skill.GetSkillConfig(beSkillList[1])
  1803. local buffCmdRand = skillConfig.otherArgs.buffCmdRand
  1804. if buffCmdRand and cmd == buffCmdRand[1] then
  1805. local random = mathRandom(1, 10000)
  1806. if random <= buffCmdRand[2] then
  1807. return true
  1808. end
  1809. end
  1810. end
  1811. end
  1812. end
  1813. function getHurtPercentRate(attacker, defender, hurt, tUseskillConfig)
  1814. local rate = 0
  1815. for k,skillList in pairs(defender.beSkillList) do
  1816. for j,v in pairs(skillList) do
  1817. --local conf = SkillExcel[v[1]]
  1818. local conf = Skill.GetSkillConfig(v[1])
  1819. if conf and conf.cmd == "behurtRet" then
  1820. local canUse = true
  1821. if conf.beSkillArgs and #conf.beSkillArgs > 0 then
  1822. if conf.beSkillArgs[1] == "hurthpper" then
  1823. local hpMax = CombatObj.getHpMax(defender)
  1824. local percent = hurt/hpMax
  1825. if percent < conf.beSkillArgs[2]/10000 then -- 伤害超过目标生命值上限X%时
  1826. canUse = false
  1827. end
  1828. end
  1829. end
  1830. if canUse == true then
  1831. local random = math.random(1, 10000)
  1832. if random <= conf.args[2] then
  1833. rate = rate + conf.args[1]
  1834. end
  1835. end
  1836. end
  1837. end
  1838. end
  1839. if tUseskillConfig.type == CombatDefine.SKILL_TYPE1 then
  1840. if attacker.beSkillList[BESKILL_TYPE1] then
  1841. for _, v in pairs(attacker.beSkillList[BESKILL_TYPE1]) do
  1842. local nSkillID = v[1]
  1843. --local skillConfig = SkillExcel[nSkillID]
  1844. local skillConfig = Skill.GetSkillConfig(nSkillID)
  1845. if skillConfig and skillConfig.hurtRate and skillConfig.hurtRate[1] then
  1846. local fRate = skillConfig.hurtRate[1]
  1847. rate = rate + fRate
  1848. --print("[getExtraHurt] 获取到的普工伤害加成概率 fRate = "..fRate.." 总加成 rate = "..rate)
  1849. end
  1850. end
  1851. end
  1852. end
  1853. return rate
  1854. end
  1855. function getBufferExtraHurt(attacker,bufferID,cmd)
  1856. local rate = 0
  1857. for _,skillList in pairs(attacker.beSkillList) do
  1858. for k,v in pairs(skillList) do
  1859. --local conf = SkillExcel[v[1]]
  1860. local conf = Skill.GetSkillConfig(v[1])
  1861. local otherArgs = conf.otherArgs
  1862. if bufferID and otherArgs.bufferExtraHurt then
  1863. for k1,v1 in ipairs(otherArgs.bufferExtraHurt[1]) do
  1864. if bufferID == v1 then
  1865. rate = rate + otherArgs.bufferExtraHurt[2]
  1866. end
  1867. end
  1868. end
  1869. if cmd and otherArgs.bufferCmdExtraHurt then
  1870. for k1,v1 in ipairs(otherArgs.bufferCmdExtraHurt[1]) do
  1871. if cmd == v1 then
  1872. rate = rate + otherArgs.bufferCmdExtraHurt[2]
  1873. end
  1874. end
  1875. end
  1876. end
  1877. end
  1878. return rate
  1879. end
  1880. function getExtraHurtRateEx(attacker, defender)
  1881. local rate = 0
  1882. -- 死亡数伤害率
  1883. if attacker.beSkillList[BESKILL_TYPE48] then
  1884. for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE48]) do
  1885. --local skillConfig = SkillExcel[v[1]]
  1886. local skillConfig = Skill.GetSkillConfig(v[1])
  1887. if skillConfig and skillConfig.otherArgs.deathHurt then
  1888. local side = defender.side
  1889. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  1890. local obj = CombatImpl.objList[pos]
  1891. if obj and obj.hp <=0 then
  1892. if rate == 0 then
  1893. rate = skillConfig.otherArgs.deathHurt
  1894. else
  1895. rate = rate + 10000
  1896. end
  1897. end
  1898. end
  1899. end
  1900. end
  1901. end
  1902. return rate
  1903. end
  1904. --
  1905. function getBuffChixuHurt(attacker, cmd)
  1906. if not attacker then return 0 end
  1907. local hurt = 0
  1908. local side = attacker.side
  1909. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  1910. local objM = CombatImpl.objList[pos]
  1911. if objM and objM.hp > 0 and objM.beSkillList[BESKILL_TYPE54] then
  1912. for _,v in ipairs(objM.beSkillList[BESKILL_TYPE54]) do
  1913. --local skillConfig = SkillExcel[v[1]]
  1914. local skillConfig = Skill.GetSkillConfig(v[1])
  1915. if skillConfig and skillConfig.otherArgs[cmd] then
  1916. hurt = hurt + skillConfig.otherArgs[cmd]
  1917. end
  1918. end
  1919. end
  1920. end
  1921. return hurt / 10000
  1922. end
  1923. --
  1924. function handlerBuff(attacker, target, arg, cmd)
  1925. if not attacker then return end
  1926. for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
  1927. local obj = CombatImpl.objList[pos]
  1928. if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE57] then
  1929. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE57]) do
  1930. attacker.args = arg
  1931. use(attacker, {target}, v, false)
  1932. end
  1933. end
  1934. end
  1935. end
  1936. function beforeMinusHp(obj, value)
  1937. if value <= 0 then return end
  1938. --敌对阵营 有对象有 49号被动技能 加血变成减血
  1939. local side = obj.side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
  1940. for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
  1941. local objM = CombatImpl.objList[pos]
  1942. if objM and objM.hp > 0 and objM.beSkillList[BESKILL_TYPE49] then
  1943. value = value * (-1)
  1944. break
  1945. end
  1946. end
  1947. return value
  1948. end
  1949. function beforeUpdateHp(obj,sum)
  1950. if sum <= 0 and obj.beSkillList[BESKILL_TYPE41] then
  1951. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE41]) do
  1952. --local skillConfig = SkillExcel[v[1]]
  1953. local skillConfig = Skill.GetSkillConfig(v[1])
  1954. if skillConfig.cmd == "miansi" and canUse(obj,v) then
  1955. use(obj,{},v)
  1956. return true
  1957. end
  1958. end
  1959. end
  1960. end
  1961. function onCheckBuffer(obj,attacker,value)
  1962. local ret = value
  1963. if obj.beSkillList[BESKILL_TYPE42] then
  1964. for _,v in ipairs(obj.beSkillList[BESKILL_TYPE42]) do
  1965. --local skillConfig = SkillExcel[v[1]]
  1966. local skillConfig = Skill.GetSkillConfig(v[1])
  1967. if canUse(obj,v) then
  1968. local newFrame = true
  1969. if skillConfig.cmd == "baohu" then
  1970. obj.baohuHurt = value * skillConfig.args[1] / 10000
  1971. if obj.hp < -obj.baohuHurt then
  1972. obj.baohuHurt = -obj.hp
  1973. end
  1974. ret = value - obj.baohuHurt
  1975. newFrame = false
  1976. end
  1977. use(obj,{attacker},v, newFrame)
  1978. break
  1979. end
  1980. end
  1981. end
  1982. return ret
  1983. end
  1984. function getStatusBaoji(attacker, defender)
  1985. local baoji = 0
  1986. local firstBaoji = 0
  1987. for k, skillList in pairs(attacker.beSkillList) do
  1988. for j, v in pairs(skillList) do
  1989. --local config = SkillExcel[v[1]]
  1990. local config = Skill.GetSkillConfig(v[1])
  1991. if config.cmd == "firstAttackHurt" then
  1992. if canUse(attacker, v) then
  1993. firstBaoji = config.args[2] or 0
  1994. end
  1995. end
  1996. end
  1997. end
  1998. if attacker.beSkillList[BESKILL_TYPE60] then
  1999. for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE60]) do
  2000. --local skillConfig = SkillExcel[v[1]]
  2001. local skillConfig = Skill.GetSkillConfig(v[1])
  2002. if skillConfig and skillConfig.otherArgs.addStatusBaoji then
  2003. local status = CombatBuff.getStatus(defender)
  2004. local isStatus = false
  2005. for k, v in ipairs(skillConfig.otherArgs.addStatusBaoji[1]) do
  2006. if status[v] then
  2007. isStatus = true
  2008. break
  2009. end
  2010. end
  2011. if isStatus then
  2012. baoji = baoji + skillConfig.otherArgs.addStatusBaoji[2]
  2013. end
  2014. end
  2015. end
  2016. end
  2017. if attacker.beSkillList[BESKILL_TYPE69] and attacker.notBaoJi then
  2018. for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE69]) do
  2019. --local skillConfig = SkillExcel[v[1]]
  2020. local skillConfig = Skill.GetSkillConfig(v[1])
  2021. if skillConfig and skillConfig.otherArgs.addNotBaoji then
  2022. baoji = baoji + skillConfig.otherArgs.addNotBaoji
  2023. end
  2024. end
  2025. end
  2026. return baoji + firstBaoji
  2027. end
  2028. function getStatusPojia(attacker, defender)
  2029. local poJia = 0
  2030. -- 对指定状态破甲加成 走的技能状态属性
  2031. if attacker.beSkillList[BESKILL_TYPE60] then
  2032. for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE60]) do
  2033. --local skillConfig = SkillExcel[v[1]]
  2034. local skillConfig = Skill.GetSkillConfig(v[1])
  2035. if skillConfig.otherArgs.addStatusPoJia then
  2036. local status = CombatBuff.getStatus(defender)
  2037. local isStatus = false
  2038. for k, v in ipairs(skillConfig.otherArgs.addStatusPoJia[1]) do
  2039. if status[v] then
  2040. isStatus = true
  2041. break
  2042. end
  2043. end
  2044. if isStatus then
  2045. poJia = poJia + skillConfig.otherArgs.addStatusPoJia[2]
  2046. end
  2047. end
  2048. end
  2049. end
  2050. return poJia
  2051. end
  2052. -- 是否不会被反击
  2053. function isNoFanji(obj)
  2054. if obj.beSkillList[BESKILL_TYPE72] then
  2055. for _, v in ipairs(obj.beSkillList[BESKILL_TYPE72]) do
  2056. local skillConfig = Skill.GetSkillConfig(v[1])
  2057. if skillConfig.cmd == "noFanji" then
  2058. return true
  2059. end
  2060. end
  2061. end
  2062. return false
  2063. end