BeSkill.lua 73 KB

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