BeSkill.lua 71 KB

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