BeSkill.lua 72 KB

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