BeSkill.lua 73 KB

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