BeSkill.lua 74 KB

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