BeSkill.lua 71 KB

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