BeSkill.lua 72 KB

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