| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339 |
- local Util = require("common.Util")
- local CombatBuff = require("combat.CombatBuff")
- local CombatDefine = require("combat.CombatDefine")
- local CombatImpl = require("combat.CombatImpl")
- local Skill = require("combat.Skill")
- local CombatObj = require("combat.CombatObj")
- local RoleAttr = require("role.RoleAttr")
- local RoleDefine = require("role.RoleDefine")
- local HeroExcel = require("excel.hero").hero
- local SkillExcel = require("excel.skill").skill
- -- local BufferExcel = require("excel.buffer").buffer
- local FuwenExcel = require("excel.fuwen")
- local SkinSkillExcel = require("excel.skin").skill
- local BingshuLogic = require("fuwen.BingshuLogic")
- local ProjectLogic = require("platform.ProjectLogic")
- local HeroDefine = require("hero.HeroDefine")
- local WinnerRelicLogic = require("winnerRelic.WinnerRelicLogic")
- local TargetMode = require("combat.TargetMode")
- local HeroExclusiveWeapon = require("hero.HeroExclusiveWeapon")
- local tbFuwenSkillGroupID = {}
- local posSortBySpeed = posSortBySpeed or {}
- function initBeSkill(obj)
- obj.beSkillList = {}
- obj.beSkillListTemp = {}
- end
- function setBeSkillID(obj, skillID, isFuWenSkill, isRelicSkill)
- local skillConfig = Skill.GetFinalSkillConfig(obj, skillID)
- skillID = skillConfig.id
- if obj.beSkillListTemp[skillID] then return end
- --local skillConfig = SkillExcel[skillID]
- if skillConfig.need > obj.quality then return end
- if skillConfig.beSkillType == 0 then return end
- if skillConfig.beSkillType == BESKILL_TYPE24 then
- obj.beSkillListTemp[BESKILL_TYPE24] = obj.beSkillListTemp[BESKILL_TYPE24] or {}
- obj.beSkillListTemp[BESKILL_TYPE24][#obj.beSkillListTemp[BESKILL_TYPE24] + 1] = {
- skillID,
- skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
- skillConfig.cd[2] or 0,
- isFuWenSkill or 0, isRelicSkill or 0}
- for _,skillID in ipairs(skillConfig.args) do
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetFinalSkillConfig(obj, skillID)
- if not obj.beSkillListTemp[skillID] and skillConfig.need <= obj.quality then
- obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
- obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
- skillID,
- skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
- skillConfig.cd[2] or 0,
- isFuWenSkill or 0, isRelicSkill or 0}
- obj.beSkillListTemp[skillID] = 1
- end
- end
- else
- obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
- obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
- skillID,
- skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
- skillConfig.cd[2] or 0,
- isFuWenSkill or 0, isRelicSkill or 0}
- obj.beSkillListTemp[skillID] = 1
- end
- end
- function setBeSkill(obj, config, skinConf, monsterOutConfig)
- local temp = {}
- local confBeskillID = skinConf and skinConf.beSkillList or config.beSkillList
-
- for _,skillID in ipairs(confBeskillID) do
- setBeSkillID(obj,skillID)
- end
- -- 加载 赋能技能 这个策划说放到最后
- if config.bePvPSkillList and CombatImpl.isPVP == 1 then
- for _,skillID in ipairs(config.bePvPSkillList) do
- setBeSkillID(obj, skillID)
- end
- end
- -- 怪物组附加的被动技能
- if monsterOutConfig then
- for _, skillID in ipairs(monsterOutConfig) do
- setBeSkillID(obj,skillID)
- end
- end
-
- -- 符文被动技能
- -- 符文技能效果这里 如果有多个同类型的技能 效果不叠加 只取最高等级的那个技能的效果
- if obj.fuwen or obj.bingshu then
- local hasFuwenBeSkill = nil
- Util.initTable(tbFuwenSkillGroupID)
- if obj.fuwen then
- for i = 1, 2 do
- local fuwenGrid = obj.fuwen[i]
- if fuwenGrid and fuwenGrid.skill then
- for j = 1, #fuwenGrid.skill do
- local fuwenSkillID = fuwenGrid.skill[j]
- local fuwenSkillConfig = FuwenExcel.skill[fuwenSkillID]
- local fuwenGroupID = fuwenSkillConfig.groupID
- if fuwenSkillConfig.fuwenBeSkill ~= 0 then
- hasFuwenBeSkill = true
- if tbFuwenSkillGroupID[fuwenGroupID] then
- if tbFuwenSkillGroupID[fuwenGroupID] < fuwenSkillID then
- tbFuwenSkillGroupID[fuwenGroupID] = fuwenSkillID
- end
- else
- tbFuwenSkillGroupID[fuwenGroupID] = fuwenSkillID
- end
- end
- end
- end
- end
- end
- if obj.bingshu then
- for i = 1, BingshuLogic.BINGSHU_MAXCNT do
- local bingshuGrid = obj.bingshu[i]
- if bingshuGrid then
- local skillID = bingshuGrid.skillID
- local skillConfig = FuwenExcel.skill[skillID]
- local groupID = skillConfig.groupID
- hasFuwenBeSkill = true
- if (tbFuwenSkillGroupID[groupID] or 0) < skillID then
- tbFuwenSkillGroupID[groupID] = skillID
- end
- end
- end
- end
- if hasFuwenBeSkill == true then
- for groupID, skillIDTemp in pairs(tbFuwenSkillGroupID) do
- local fuwenSkillConfig = FuwenExcel.skill[skillIDTemp]
- local fuwenBeSkillID = fuwenSkillConfig.fuwenBeSkill
- setBeSkillID(obj,fuwenBeSkillID, 1)
- end
- end
- end
- --遗物被动技能
- if obj.relic and nil ~= _G.next(obj.relic) then
- local nRelicID = obj.relic.relicID
- local star = obj.relic.star
- local nSkillID = WinnerRelicLogic.WinnerRelic_GetSkillID(nRelicID, star)
- if 0 < nSkillID then
- setBeSkillID(obj, nSkillID, 0, 1)
-
- local tSkilConfig = SkillExcel and SkillExcel[nSkillID]
- if tSkilConfig and tSkilConfig.otherArgs and tSkilConfig.otherArgs.skillList then
- for k,v in ipairs(tSkilConfig.otherArgs.skillList) do
- local config = SkillExcel[v]
- if config and config.id then
- setBeSkillID(obj, config.id, 0, 1)
- end
- end
- end
- end
- end
- end
- function setPetBeSkill(obj)
- --if obj
- --local skillConfig = SkillExcel[1999]
- local skillConfig = Skill.GetSkillConfig(1999)
- if skillConfig then
- obj.beSkillList = obj.beSkillList or {}
- obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
- 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}
- end
- end
- --被动技能类型
- BESKILL_TYPE1 = 1 --普攻附带
- BESKILL_TYPE2 = 2 --被击触发
- BESKILL_TYPE3 = 3 --自身生命低于参数
- BESKILL_TYPE4 = 4 --自己暴击触发
- BESKILL_TYPE5 = 5 --受到技能伤害
- BESKILL_TYPE6 = 6 --自己攻击被格挡
- BESKILL_TYPE7 = 7 --受到暴击触发
- BESKILL_TYPE8 = 8 --自己格挡触发(其他单位对自己发动攻击,自己触发格挡)
- BESKILL_TYPE9 = 9 --敌方英雄触发格挡
- BESKILL_TYPE10 = 10 --自己受持续状态伤害
- BESKILL_TYPE11 = 11 --自己受控制类状态
- BESKILL_TYPE12 = 12 --场上有英雄被添加燃烧状态
- BESKILL_TYPE13 = 13 -- 我方英雄施放主动技能
- BESKILL_TYPE14 = 14 -- 我方英雄暴击
- BESKILL_TYPE15 = 15 -- 自己死亡
- BESKILL_TYPE16 = 16 --我方英雄死亡
- BESKILL_TYPE17 = 17 --敌方英雄死亡
- BESKILL_TYPE18 = 18 --有英雄死亡
- BESKILL_TYPE19 = 19 --回合开始
- BESKILL_TYPE20 = 20 --回合结束
- BESKILL_TYPE23 = 23 --激活就生效(计入面板属性)
- BESKILL_TYPE24 = 24 --技能包
- BESKILL_TYPE25 = 25 --替换初始普攻
- BESKILL_TYPE26 = 26 --激活就生效(进入战斗前算。不计入面板属性)
- BESKILL_TYPE27 = 27 --魔兽回能量被动
- BESKILL_TYPE28 = 28 --自身触发格挡次数
- BESKILL_TYPE29 = 29 --有人受到缠绕时
- BESKILL_TYPE30 = 30 --使生命低于x时
- BESKILL_TYPE31 = 31 --任意英雄释放主动技能
- BESKILL_TYPE32 = 32 --战斗开始时触发
- BESKILL_TYPE33 = 33 --复活时触发
- BESKILL_TYPE34 = 34 --使用主动技能时
- BESKILL_TYPE35 = 35 --自身击杀敌人时
- BESKILL_TYPE36 = 36 --攻击回合结束时触发
- BESKILL_TYPE37 = 37 --物攻后触发
- BESKILL_TYPE38 = 38 --法攻后触发
- BESKILL_TYPE39 = 39 --攻击附带 (普攻 主动 都算)
- BESKILL_TYPE40 = 40 --攻击前根据条件判断是否触发(小战斗回合,针对每个对象单独判断)
- BESKILL_TYPE41 = 41 --实际扣血前触发
- BESKILL_TYPE42 = 42 --由其他英雄的buff触发
- BESKILL_TYPE43 = 43 --被某个技能打死
- BESKILL_TYPE44 = 44 --自己暴击+反击触发
- BESKILL_TYPE45 = 45 --计算伤害时触发
- BESKILL_TYPE46 = 46 --攻击附带 (普攻 主动 连击 反击都算)
- BESKILL_TYPE47 = 47 --每回合叠加属性
- BESKILL_TYPE48 = 48 --死亡英雄伤害率
- BESKILL_TYPE49 = 49 --加血变成减血
- BESKILL_TYPE50 = 50 --每回合触发 降低对方首次攻击目标伤害率
- BESKILL_TYPE51 = 51 --场上有英雄被添加诅咒状态
- BESKILL_TYPE52 = 52 --场上有英雄被攻击
- BESKILL_TYPE53 = 53 --场上有英雄有特定被动技能 友军普攻触发
- BESKILL_TYPE54 = 54 --场上有英雄特定buff 伤害加成
- BESKILL_TYPE55 = 55 --场上有英雄指定buff层数 额外伤害加成
- BESKILL_TYPE56 = 56 --场上有英雄特定bufer且概率产生
- BESKILL_TYPE57 = 57 --特定buff被引爆消除时 触发的效果
- BESKILL_TYPE58 = 58 --指定技能暴击
- BESKILL_TYPE59 = 59 --没有暴击触发一个效果
- BESKILL_TYPE60 = 60 --暴击加成
- BESKILL_TYPE61 = 61 --技能未击杀目标时触发
- BESKILL_TYPE62 = 62 --回合开始生命值触发
- BESKILL_TYPE63 = 63 --回合开始生命值触发
- BESKILL_TYPE64 = 64 --冰冻buffer被击碎
- BESKILL_TYPE65 = 65 --场上有英雄有特定被动技能 友军普攻暴击触发
- BESKILL_TYPE66 = 66 --敌方死亡特定buff触发
- BESKILL_TYPE67 = 67 --血量低于多少跟受控制触发
- BESKILL_TYPE68 = 68 --血族英雄特殊处理
- BESKILL_TYPE69 = 69 --血族英雄特殊处理
- BESKILL_TYPE70 = 70 --增加的属性激活就生效(计入面板属性)并且概率连击
- BESKILL_TYPE71 = 71 --回合开始 在其他buff添加结束
- BESKILL_TYPE72 = 72 -- 不施放技能,只用来做其他效果的判断条件
- NO_CHECK_FANJI_LIST = {
- [BESKILL_TYPE3] = 1,
- [BESKILL_TYPE15] = 1,
- [BESKILL_TYPE16] = 1,
- [BESKILL_TYPE17] = 1,
- [BESKILL_TYPE18] = 1,
- [BESKILL_TYPE35] = 1,
- [BESKILL_TYPE36] = 1,
- [BESKILL_TYPE37] = 1,
- [BESKILL_TYPE38] = 1,
- [BESKILL_TYPE44] = 1,
- [BESKILL_TYPE46] = 1,
- }
- NO_CHECK_COMBO_LIST = {
- [BESKILL_TYPE1] = 1,
- [BESKILL_TYPE3] = 1,
- [BESKILL_TYPE14] = 1,
- [BESKILL_TYPE16] = 1,
- [BESKILL_TYPE17] = 1,
- [BESKILL_TYPE18] = 1,
- [BESKILL_TYPE35] = 1,
- [BESKILL_TYPE34] = 1,
- [BESKILL_TYPE25] = 1,
- [BESKILL_TYPE46] = 1,
- [BESKILL_TYPE37] = 1,
- [BESKILL_TYPE38] = 1,
- [BESKILL_TYPE43] = 1,
- }
- local function checkLimit(data)
- if data[2] and data[2] <= 0 then
- return
- end
-
- if data[4] > 0 and data[3] > CombatImpl.round then
- return
- end
- return true
- end
- local function canUse(obj,data)
- if obj.isPet then
- return true
- end
- --被动技能次数限制判断
- if not checkLimit(data) then
- return
- end
-
- --local skillConfig = SkillExcel[data[1]]
- local skillConfig = Skill.GetSkillConfig(data[1])
- if not NO_CHECK_FANJI_LIST[skillConfig.beSkillType] and CombatImpl.isFanji then
- return
- end
-
- if not NO_CHECK_COMBO_LIST[skillConfig.beSkillType] and CombatImpl.comboType > 0 then
- return
- end
- local bNotFeng = nil
- -- boss 被动不能被封印
- -- 世界boss模式下 boss不受feng状态影响
- if CombatImpl.fightMode[1] == CombatDefine.FIGHT_MODE3 then
- if obj.type == CombatDefine.COMBAT_OBJ_TYPE3 then
- bNotFeng = true
- end
- end
- if not bNotFeng and CombatBuff.isStatus(obj,{"banBeSkill","feng"}) then
- return
- end
- data[3] = data[3] + data[4]
- local beSkillArgs = skillConfig.beSkillArgs
- local ret = true
- --被动技能触发条件判断
- if beSkillArgs[1] then
- if beSkillArgs[1] == "hp" then
- local hp = obj.hp
- local hpMax = CombatObj.getHpMax(obj)
- if hp > hpMax * beSkillArgs[2]/10000 then
- ret = false
- end
- elseif beSkillArgs[1] == "hpOrControl" then
- ret = false
- local hp = obj.hp
- local hpMax = CombatObj.getHpMax(obj)
- if hp <= hpMax * beSkillArgs[2]/10000 then
- ret = true
- end
- if CombatBuff.isAtControl(obj) then
- ret = true
- end
- elseif beSkillArgs[1] == "fanji" then
- local r = math.random(0,10000)
- if r > beSkillArgs[2] then
- return
- end
- elseif beSkillArgs[1] == "pos" then
- local pos = obj.pos
- ret = false
- if beSkillArgs[2] then
- for i = 1,#beSkillArgs[2] do
- if pos == beSkillArgs[2][i] then
- ret = true
- break
- end
- end
- end
- elseif beSkillArgs[1] == "noBuffCmd" then
- return not CombatBuff.isStatus(obj,beSkillArgs[2])
- elseif beSkillArgs[1] == "attackerBuffCmd" then
- local isStatus,cmd = CombatBuff.isStatus(obj,beSkillArgs[2])
- return isStatus
- elseif beSkillArgs[1] == "myjob" then
- ret = false
- for k,v in ipairs(beSkillArgs[2]) do
- if v == obj.job then
- ret = true
- break
- end
- end
- elseif beSkillArgs[1] == "sideLimit" then
- for k,v in ipairs(beSkillArgs[2]) do
- local useCnt = CombatImpl.getBeSkillSideUse(obj.pos,v[1])
- if useCnt >= v[2] then
- return
- end
- end
- elseif beSkillArgs[1] == "firstAttackOrder" then
- local side = obj.side
- if side then
- local isFirstAttack = CombatImpl.firstAttack[side]
- if beSkillArgs[2] == 1 then
- return isFirstAttack
- else
- return not isFirstAttack
- end
- end
- end
- end
- if ret and data[2] then
- data[2] = data[2] - 1
- end
-
- if skillConfig.cmd == "hp" then
- local hp = obj.hp
- local targetMode = skillConfig.args[3]
- --英雄血量为0时不能加血
- if (hp <= 0 or CombatBuff.isStatus(obj,{"revive"})) and targetMode and targetMode[1] == 10 then
- ret = false
- end
- end
- return ret
- end
- --被攻击触发,需要判断攻击者状态的被动技能
- local function canUseOnHit(obj,data)
- if not obj then
- return true
- end
- --local skillConfig = SkillExcel[data[1]]
- local skillConfig = Skill.GetSkillConfig(data[1])
- local beSkillArgs = skillConfig.beSkillArgs
- local condCmd = beSkillArgs[1]
- if condCmd == "job" then
- for _,job in ipairs(beSkillArgs[2]) do
- if obj.job == job then
- return true
- end
- end
- return false
- elseif condCmd == "buffCmd" then
- return CombatBuff.isStatus(obj,beSkillArgs[2])
- elseif condCmd == "targetHp" then
- local hp = obj.hp
- local checkHp = CombatObj.getHpMax(obj) * beSkillArgs[3] / 10000
- if beSkillArgs[2] == 1 and hp > checkHp then
- return true
- elseif beSkillArgs[2] == 2 and hp < checkHp then
- return true
- end
- else
- return true
- end
- end
- local function isCanRevive(obj, attacker , data)
- -- local skillConfig = SkillExcel[data[1]]
- local skillConfig = Skill.GetSkillConfig(data[1])
- if skillConfig.cmd == "shengling" or
- skillConfig.cmd == "revive" then
- if skillConfig.cmd == "shengling" and CombatImpl.checkSideResult(obj.pos) == true then -- 如果是队伍最后一个死亡的不释放 圣灵复活
- return false
- end
- if CombatBuff.canRevive(obj) ~= true then
- return false
- end
- if skillConfig.cmd == "shengling" then
- if CombatBuff.isStatus(obj,{"revive"}) then
- return false
- end
- end
- if attacker and attacker.beSkillList then
- for k,skillList in pairs(attacker.beSkillList) do
- for j,v in pairs(skillList) do
- --local config = SkillExcel[v[1]]
- local config = Skill.GetSkillConfig(data[1])
- if config and skillConfig.cmd == "shengling" and config.cmd == "noShengling" then --击杀方有 不准圣灵复活被动
- return false
- elseif config and config.cmd == "noRevive" then -- 击杀方 有不准复活的
- if #config.args > 0 then
- local canNum = config.args[1]
- local random = math.random(1, 10000)
- if random > canNum then -- noRevive 概率不生效
- return true
- else
- return false
- end
- end
- return true
- end
- end
- end
-
- end
- end
- return true
- end
- function onSkillID(obj,skillID)
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig.type == CombatDefine.SKILL_TYPE1 and obj.beSkillList[BESKILL_TYPE25] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE25]) do
- if canUse(obj,v) then
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- return conf.args[1]
- end
- end
- end
- return skillID
- end
- local function use(attacker,targets,data,newFrame, packBuff, hitObj)
- if canUse(attacker,data) and canUseOnHit(targets and targets[1],data) then
- --print("beskill realuse:",attacker.pos,data[1])
- --local skillConfig = SkillExcel[data[1]]
- local skillConfig = Skill.GetSkillConfig(data[1])
- local ret, arg2
- -- 二次元连击触发帧不新加帧
- if ProjectLogic.isSsecy() and skillConfig.cmd == "combo" then
- newFrame = false
- end
- if packBuff then
- CombatImpl.afterBuff()
- end
- if Skill.CMD[skillConfig.cmd] then
- if newFrame or CombatImpl.isSkillFrameEmpty() then
- --进入战斗时,未加入任何战斗帧触发被动技能时,先添加被动技能的战斗帧,可以在这个战斗帧上挂被动技能引发的额外作用
- CombatImpl.addFrame()
- CombatImpl.setSkillID(attacker, data[1])
- end
- ret, arg2 = Skill.CMD[skillConfig.cmd](attacker,skillConfig,targets, hitObj)
- end
- --判断是否加喊话
- local isAddSkillFrame = CombatBuff.onUseBeSkill(attacker, skillConfig, targets, ret, nil, arg2)
- if skillConfig.contentType > 0 then
- if isAddSkillFrame then
- CombatImpl.addSaySkill(attacker,skillConfig)
- elseif ret or skillConfig.beSkillType == BESKILL_TYPE26 or
- skillConfig.beSkillType == BESKILL_TYPE23 or
- skillConfig.beSkillType == BESKILL_TYPE4 or
- skillConfig.beSkillType == BESKILL_TYPE44 then
- if CombatImpl.isSkillFrameEmpty() then
- CombatImpl.addFrame()
- CombatImpl.setSkillID(attacker, data[1])
- end
- CombatImpl.setSaySkill(attacker.pos,skillConfig.id,skillConfig.contentType)
- end
- end
- CombatImpl.addBeSkillPosUse(attacker.pos,data[1])
- else
- -- print("[beskill - use] 直接返回了1 id = "..data[1])
- end
- end
- function onHit(attacker,targets,skillID)
- if attacker.isPet or attacker.isElf then
- return
- end
- --local useSkillConfig = SkillExcel[skillID]
- local useSkillConfig = Skill.GetSkillConfig(skillID)
- if useSkillConfig.type == CombatDefine.SKILL_TYPE2 then
- --[[for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE13] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE13]) do
- use(obj,targets,v)
- end
- end
- end]]
- if attacker.beSkillList[BESKILL_TYPE34] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE34]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == "attackerBuffCmd" and beSkillArgs[2][1] == "shayi" then
- local shayiCnt = CombatBuff.getBuffCnt(attacker,"shayi")
- if shayiCnt > 0 then
- for i = 1,shayiCnt do
- use(attacker,targets,v,true)
- CombatImpl.instantFrameBuffer(attacker,v[1])
- end
- end
- CombatBuff.delShayi(attacker)
- elseif beSkillArgs[1] == "qusanNeedCmd" then
- local canUse = false
- for h,need in ipairs(beSkillArgs[2]) do
- if need == useSkillConfig.cmd then
- canUse = true
- break
- end
- end
- if canUse == true then
- use(attacker,targets,v,true)
- end
- elseif beSkillArgs[1] == "jiekongNeedCmd" then
- local canUse = false
- for h,need in ipairs(beSkillArgs[2]) do
- if need == useSkillConfig.cmd then
- canUse = true
- break
- end
- end
- if canUse == true then
- use(attacker,targets,v,true)
- end
- elseif beSkillArgs[1] == "skillID" then
- local canUse = false
- for _, targetSkill in ipairs(beSkillArgs[2]) do
- if skillID == targetSkill then
- canUse = true
- break
- end
- end
- if canUse == true then
- use(attacker,targets,v,true)
- end
- else
- use(attacker,targets,v)
- end
- end
- end
- end
- --非攻击性主动技能不处理被击被动技能
- if CombatObj.getValue(attacker,RoleDefine.HURT_COMBAT_NOW) <= 0 then
- if (useSkillConfig.type == CombatDefine.SKILL_TYPE1 or useSkillConfig.type == CombatDefine.SKILL_TYPE2) then
- if attacker.beSkillList[BESKILL_TYPE39] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE39]) do
- use(attacker,targets,v)
- end
- end
- if attacker.beSkillList[BESKILL_TYPE70] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE70]) do
- use(attacker,targets,v)
- end
- end
- end
- return
- end
- if useSkillConfig.type == CombatDefine.SKILL_TYPE1 and attacker.beSkillList[BESKILL_TYPE1] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE1]) do
- use(attacker,targets,v)
- end
- end
- if useSkillConfig.type == CombatDefine.SKILL_TYPE2 and attacker.beSkillList[BESKILL_TYPE61] then
- local canUseSkill = true
- for index = 1, #targets do
- local target = targets[index]
- if target.hp <=0 then
- canUseSkill = false
- end
- end
- if canUseSkill then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE61]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == "skillID" then
- local canUse = false
- for _,v in ipairs(beSkillArgs[2]) do
- if skillID == v then
- canUse = true
- break
- end
- end
- if canUse then
- use(attacker,{},v)
- end
- end
- end
- end
- end
-
- if (useSkillConfig.type == CombatDefine.SKILL_TYPE1 or useSkillConfig.type == CombatDefine.SKILL_TYPE2 or useSkillConfig.type == CombatDefine.SKILL_TYPE3) then
- if attacker.beSkillList[BESKILL_TYPE39] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE39]) do
- use(attacker,targets,v)
- end
- end
- if attacker.beSkillList[BESKILL_TYPE46] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE46]) do
- use(attacker,targets,v)
- end
- end
- if attacker.beSkillList[BESKILL_TYPE70] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE70]) do
- use(attacker,targets,v)
- end
- end
- end
- local isDefendSideGedang = false
- local baojiDefender = {}
-
- for _,target in ipairs(targets) do
- if target.beSkillList[BESKILL_TYPE2] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE2]) do
- use(target,{attacker},v)
- -- print("當前受到攻擊,觸發被動技能11111111111111ssssssssss1111111111111111",skillID)
- --table.print_lua_table(v)
- end
- end
- -- 友军受击
- for _,pos in ipairs(CombatDefine.SIDE2POS[target.side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.pos ~= target.pos and obj.beSkillList[BESKILL_TYPE52] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE52]) do
- use(target,{attacker},v)
- end
- end
- end
-
- if useSkillConfig.type == CombatDefine.SKILL_TYPE2 and target.beSkillList[BESKILL_TYPE5] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE5]) do
- use(target,{attacker},v)
- end
- end
-
- if target.isGedang then
- isDefendSideGedang = true
- if target.beSkillList[BESKILL_TYPE8] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE8]) do
- use(target,{attacker},v)
- end
- end
-
- if attacker.beSkillList[BESKILL_TYPE6] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE6]) do
- use(attacker,{target},v)
- end
- end
-
- --目标触发格挡次数
- if target.beSkillList[BESKILL_TYPE28] then
- for _, v in ipairs(target.beSkillList[BESKILL_TYPE28]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == "gedang" then
- target.isGedangCnt = target.isGedangCnt or 0
- local geDangLimit = beSkillArgs[2]
- if target.isGedangCnt >= geDangLimit then
- target.isGedangCnt = 0
- use(target,{attacker},v)
- end
- end
- end
- end
- end
-
- local chanRao = CombatBuff.isChanRao(target)
- if chanRao then
- if target.beSkillList[BESKILL_TYPE29] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE29]) do
- use(target,{attacker},v)
- end
- end
- end
-
- if target.isBaoji then
- if target.beSkillList[BESKILL_TYPE7] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE7]) do
- use(target,{attacker},v)
- end
- end
- baojiDefender[#baojiDefender+1] = target
- end
-
- -- if target.buffCmd["winner_nuhuo"] then
- -- local nIndex = target.buffCmd["winner_nuhuo"][1]
- -- local tBuffData = target.buffer[nIndex]
- -- if tBuffData.cnt < 10 then
- -- tBuffData.cnt = tBuffData.cnt + 1
- -- end
- -- end
- end
- local side = attacker.side
- local defendSide = side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
-
- --普通技能触发
- if useSkillConfig.type == CombatDefine.SKILL_TYPE1 then
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE53] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE53]) do
- use(attacker,targets,v)
- end
- end
- end
- end
- --主动技能触发
- if useSkillConfig.type == CombatDefine.SKILL_TYPE2 then
- for _,pos in ipairs(CombatDefine.SIDE2POS[0]) do
- local obj = CombatImpl.objList[pos]
- local objSide = pos <= 6 and CombatDefine.ATTACK_SIDE or CombatDefine.DEFEND_SIDE
- --触发自己这方的
- if side == objSide then
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE13] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE13]) do
- use(obj,targets,v)
- end
- end
- end
-
- --触发任意一方
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE31] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE31]) do
- use(obj,targets,v)
- end
- end
- end
- end
- if not attacker.isBaoji then
- --指定技能没有暴击
- if attacker.beSkillList[BESKILL_TYPE59] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE59]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == "skillID" then
- local canUse = false
- for _,v in ipairs(beSkillArgs[2]) do
- if skillID == v then
- canUse = true
- break
- end
- end
- if canUse then
- use(attacker,{},v)
- end
- end
- end
- end
- end
- if attacker.isBaoji then
- --普通暴击技能触发
- if useSkillConfig.type == CombatDefine.SKILL_TYPE1 then
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE65] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE65]) do
- use(attacker,targets,v)
- end
- end
- end
- end
- if attacker.beSkillList[BESKILL_TYPE4] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE4]) do
- use(attacker,baojiDefender,v)
- end
- end
- if attacker.beSkillList[BESKILL_TYPE44] and CombatImpl.isFanji then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE44]) do
- use(attacker,baojiDefender,v)
- end
- end
- --指定技能暴击
- if attacker.beSkillList[BESKILL_TYPE58] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE58]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == "skillID" then
- local canUse = false
- for _,v in ipairs(beSkillArgs[2]) do
- if skillID == v then
- canUse = true
- break
- end
- end
- if canUse then
- use(attacker,baojiDefender,v)
- end
- end
- end
- end
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE14] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE14]) do
- use(obj,targets,v)
- end
- end
- end
- end
- if isDefendSideGedang then
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE9] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE9]) do
- use(obj,targets,v)
- end
- end
- end
- end
- end
- function onHp(obj, hurt, attackPos)
- if obj.beSkillList[BESKILL_TYPE3] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE3]) do
- use(obj,{},v)
- end
- end
- if obj.beSkillList[BESKILL_TYPE67] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE67]) do
- use(obj,{},v)
- end
- end
- local attacker = CombatImpl.objList[attackPos]
- if attacker and attacker.beSkillList[BESKILL_TYPE30] and obj.pos ~= attackPos then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE30]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- obj.paramData.isbeSkillByHp = obj.paramData.isbeSkillByHp or 0
- if beSkillArgs[1] then
- if beSkillArgs[1] == "tohp" then
- local hp = obj.hp
- local hpMax = CombatObj.getHpMax(obj)
- if hp > hpMax * beSkillArgs[2]/10000 then
- obj.paramData.isbeSkillByHp = 0 --恢复到上限
- else
- if obj.isbeSkillByHp == 0 then
- obj.paramData.isbeSkillByHp = 1 --达到下限
- end
- end
- elseif beSkillArgs[1] == "hurthpper" then
- local hpMax = CombatObj.getHpMax(obj)
- local percent = -hurt/hpMax
- if percent > beSkillArgs[2]/10000 then -- 伤害超过目标生命值上限X%时
- use(attacker,{obj},v)
- end
- elseif beSkillArgs[1] == "speed" then
- local atkSpeed = CombatImpl.getValue(attacker,RoleDefine.SPEED)
- local defSpeed = CombatImpl.getValue(obj,RoleDefine.SPEED)
- if atkSpeed > defSpeed then
- use(attacker,{obj},v)
- end
- end
- end
-
- --使用技能
- if obj.paramData.isbeSkillByHp == 1 then
- use(attacker,{obj},v)
- obj.paramData.isbeSkillByHp = 2
- end
- end
- end
- end
- -- 选择合适的复活技能
- function selectReviceSkill(obj, attacker)
- local reviveSkillList = {}
- local len = 0
- for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
- local skillID = v[1]
- local isFuwenSkill = v[5]
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig.cmd == "revive" then
- --有可使用的主动复活技能
- local state = isCanRevive(obj, attacker, v)
- if state and isFuwenSkill == 0 then
- if checkLimit(v) then
- len = len + 1
- reviveSkillList[k] = 1
- break
- end
- end
- end
- end
- -- 没有再取符文技能的复活
- if len == 0 then
- for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
- local skillID = v[1]
- local isFuwenSkill = v[5]
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig.cmd == "revive" then
- local state = isCanRevive(obj, attacker, v)
- if state and isFuwenSkill == 1 then
- --被动技能次数限制判断
- if checkLimit(v) then
- reviveSkillList[k] = 1
- break
- end
- end
- end
- end
- end
- return reviveSkillList
- end
- function onDie(obj, hurt, attackPos)
- if obj.hp > 0 then
- return
- end
- local side = obj.side
- local attacker = CombatImpl.objList[attackPos]
- if obj.dieSkill then
- if attacker and attacker.beSkillList[BESKILL_TYPE43] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE43]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- for _,v1 in ipairs(skillConfig.beSkillArgs) do
- if v1 == obj.dieSkill then
- use(attacker,{obj},v)
- break
- end
- end
- end
- end
- end
-
- local defendSide = side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
- for _,posData in ipairs(posSortBySpeed[side]) do
- local pos = posData[1]
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 then
- if target.beSkillList[BESKILL_TYPE16] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE16]) do
- use(target,{obj},v)
- end
- end
- if target.beSkillList[BESKILL_TYPE18] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE18]) do
- use(target,{obj},v)
- end
- end
- end
- end
- for _,posData in ipairs(posSortBySpeed[defendSide]) do
- local pos = posData[1]
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 then
- if target.beSkillList[BESKILL_TYPE17] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE17]) do
- use(target,{obj},v)
- end
- end
- if target.beSkillList[BESKILL_TYPE18] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE18]) do
- use(target,{obj},v)
- end
- end
- end
- end
-
- if attacker and attacker.beSkillList and attacker.beSkillList[BESKILL_TYPE30] and obj.pos ~= attackPos then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE30]) do
- if obj.isbeSkillByHp == nil or
- obj.isbeSkillByHp == 0 then
- use(attacker,{},v)
- end
- end
- end
- if attacker and attacker.beSkillList and attacker.beSkillList[BESKILL_TYPE35] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE35]) do
- use(attacker,{obj},v)
- end
- end
- if obj.beSkillList[BESKILL_TYPE15] then
- -- 选择其中一个使用
- local reviceSkillList = selectReviceSkill(obj, attacker)
- for k, v in ipairs(obj.beSkillList[BESKILL_TYPE15]) do
- local skillID = v[1]
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig.cmd == "revive" then
- if reviceSkillList[k] then
- use(obj,{},v)
- break
- end
- else
- use(obj,{},v)
- end
- end
- end
-
-
- for _,pos in ipairs(CombatDefine.SIDE2POS[defendSide]) do
- local defendobj = CombatImpl.objList[pos]
- if defendobj and defendobj.hp > 0 and defendobj.beSkillList[BESKILL_TYPE66] then
- for _,v in ipairs(defendobj.beSkillList[BESKILL_TYPE66]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs.tdBuffCmd then
- if obj.bufferCmd[skillConfig.otherArgs.tdBuffCmd] then
- use(defendobj,{},v)
- end
- end
- end
- end
- end
- end
- function onAddBuffer(obj,buffer)
- --local conf = BufferExcel[buffer.id]
- local conf = CombatBuff.GetBuffConfig(buffer.id)
- local attacker = CombatImpl.objList[buffer.attackPos]
- local cmd = conf.cmd
- if cmd == "hurt" or cmd == "liuxue"or cmd == "liuxue2" or cmd == "zhongdu" or cmd == "ranshao" then
- if obj.beSkillList[BESKILL_TYPE10] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE10]) do
- use(obj,{attacker},v)
- end
- end
- end
- if cmd == "bingdong" or cmd == "jiansu" then
- for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE63] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE63]) do
- use(target,{obj},v)
- end
- end
- end
- end
-
- if CombatBuff.isControlCmd(cmd) then
- if obj.beSkillList[BESKILL_TYPE11] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE11]) do
- use(obj,{attacker},v)
- end
- end
-
- if obj.beSkillList[BESKILL_TYPE67] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE67]) do
- use(obj,{attacker},v, true, true)
- end
- end
- end
-
- if cmd == "ranshao" then
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE12] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE12]) do
- local beSkillUseCnt = CombatImpl.getBeSkillUse(target,obj.pos,v[1])--特殊条件特殊处理:同一英雄在同一时间被施加多次燃烧状态时只触发一次
- if beSkillUseCnt == 0 then
- use(target,{obj},v)
- CombatImpl.addBeSkillUse(target,obj.pos,v[1])
- end
- end
- end
- end
- end
- if cmd == "zuzhou" then
- for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE51] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE51]) do
- use(target,{obj},v)
- end
- end
- end
- end
- if cmd == "revive" then
- if obj.beSkillList[BESKILL_TYPE33] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE33]) do
- use(obj,{attacker},v)
- end
- end
- end
- end
- function onDelBingDongBuffer(obj, buffer)
- --local conf = BufferExcel[buffer.id]
- local conf = CombatBuff.GetBuffConfig(buffer.id)
- local attacker = CombatImpl.objList[buffer.attackPos]
- if conf.cmd == "bingdong" then
- for _, pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE64] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE64]) do
- use(target,{obj},v)
- end
- end
- end
- end
- end
- --援军上阵触发
- function onBackupBegin(obj)
- if not obj then return end
- if CombatDefine.isBackup(obj) ~= CombatDefine.BACKUP_TYPE2 then return end
- -- 备份的被动技能上阵
- if obj.backUpSkillList then
- obj.beSkillList = obj.backUpSkillList
- obj.backUpSkillList = nil
- end
- -- 出站计算属性
- if obj.beSkillList[BESKILL_TYPE26] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE26]) do
- if canUse(obj,v) then
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "attr" then
- for _,v1 in ipairs(skillConfig.args) do
- obj.sysAttr[v1[1]] = obj.sysAttr[v1[1]] +v1[2]
- end
- obj.isSysAttrChange = true
- elseif skillConfig.cmd == "normalTarget" then
- use(obj,{},v)
- end
- end
- end
- end
- table.sort(posSortBySpeed[CombatDefine.ATTACK_SIDE],posSpeedCmp)
- table.sort(posSortBySpeed[CombatDefine.DEFEND_SIDE],posSpeedCmp)
- --援军出战触发
- if obj and obj.beSkillList[BESKILL_TYPE32] then
- for k,v in ipairs(obj.beSkillList[BESKILL_TYPE32]) do
- use(obj,{},v)
- end
- end
- --上场技能
- CombatDefine.BACKUP_BUFF_SKILL[2] = 1
- use(obj,{}, CombatDefine.BACKUP_BUFF_SKILL)
- end
- function onRoundBegin(round)
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE19] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE19]) do
- --table.print_lua_table(v)
- -- print("beskill = onRoundBegin 开始使用技能 ID = "..v[1])
- use(target,{},v)
- end
- end
-
- -- 生命值触发
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE62] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE62]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- local beSkillArgs = skillConfig.beSkillArgs
- if beSkillArgs[1] == 1 then
- local hpMax = CombatObj.getHpMax(target)
- local percent = target.hp/hpMax
- if percent > beSkillArgs[2]/10000 then
- use(target,{},v)
- end
- end
- if beSkillArgs[1] == 2 then
- local hpMax = CombatObj.getHpMax(target)
- local percent = target.hp/hpMax
- if percent < beSkillArgs[2]/10000 then
- use(target,{},v)
- end
- end
- end
- end
- end
-
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE47] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE47]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "attr" then
- for _,v1 in ipairs(skillConfig.args) do
- target.sysAttr[v1[1]] = target.sysAttr[v1[1]] +v1[2]
- end
- CombatObj.calcAttr(target)
- CombatImpl.addFrame()
- CombatImpl.setSkillID(target, v[1])
- CombatImpl.setSaySkill(target.pos,skillConfig.id,skillConfig.contentType)
- end
- end
- end
- end
-
- if round and round == 1 then
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj and obj.beSkillList[BESKILL_TYPE32] then
- for k,v in ipairs(obj.beSkillList[BESKILL_TYPE32]) do
- use(obj,{},v)
- end
- end
- end
- end
- -- 在最后加
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE71] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE71]) do
- -- print("[onRoundBegin] 开始加类型71的被动技能 pos = "..pos)
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.args then
- local nLen = skillConfig.args[1]
- for i = 1, nLen, 1 do
- use(target,{},v)
- end
- end
- end
- end
- end
- end
- function beforeFanji(obj, hitObj, isEnd)
- if not obj or obj.isPet or obj.isElf then
- return
- end
- if obj and obj.hurtType == CombatDefine.PHY_HURT_TYPE then
- if obj and obj.beSkillList and obj.beSkillList[BESKILL_TYPE37] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE37]) do
- -- use(obj,{},v)
- use(obj, {}, v, nil, nil, hitObj)
- end
- end
- else
- if obj and obj.beSkillList and obj.beSkillList[BESKILL_TYPE38] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE38]) do
- use(obj,{},v)
- end
- end
- end
- end
- function onRoundEnd(isRoundEnd)
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj and obj.beSkillList[BESKILL_TYPE36] then
- if pos == 1 then
- end
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE36]) do
- use(obj,{},v)
- end
- end
- end
- if isRoundEnd then
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local target = CombatImpl.objList[pos]
- if target and target.hp > 0 and target.beSkillList[BESKILL_TYPE20] then
- for _,v in ipairs(target.beSkillList[BESKILL_TYPE20]) do
- use(target,{},v)
- end
- end
- end
- end
- end
- function posSpeedCmp(a,b)
- if a[2] > b[2] then
- return true
- elseif a[2] < b[2] then
- return false
- else
- return a[1] < b[1]
- end
- end
- -- 计算遗物特殊属性部分
- local function BeSkill_RelicAttribute(ReleaserObj, tSkillInfo)
- local nSkillID = tSkillInfo[1]
- local tSkilConfig = Skill.GetSkillConfig(nSkillID)
- if not tSkilConfig then
- -- print("[BeSkill_RelicAttribute] 不存在技能配置 nSkillID = "..nSkillID)
- return
- end
- local winnerID = ReleaserObj and ReleaserObj.relic and ReleaserObj.relic.relicID or 0
- local winnerStar = ReleaserObj and ReleaserObj.relic and ReleaserObj.relic.star or 0
- if 0 >= winnerID or 0 >= winnerStar then
- return
- end
- -- 特殊处理防御为0, 加标识
- if tSkilConfig.otherArgs.selefDefense then
- ReleaserObj.relicAttr.bSpecialDef = true
- end
- -- 是否增加args属性
- local bAddArgs = true
- if tSkilConfig.otherArgs.winnerfiveraces then
- bAddArgs = false
- end
- local targets = TargetMode.getTargets(ReleaserObj, tSkilConfig.targetMode)
- if #targets > 0 and true == bAddArgs then
- for _, obj in ipairs(targets) do
- -- 加固定值属性
- for _, v in ipairs(tSkilConfig.args) do
- if not obj.relicAttr.FixedAttr[v[1]] then
- obj.relicAttr.FixedAttr[v[1]] = 0
- end
- obj.relicAttr.FixedAttr[v[1]] = obj.relicAttr.FixedAttr[v[1]] + v[2]
- end
- end
- else
- -- print("[BeSkill_RelicAttribute] 获取不到对应的技能目标对象")
- end
- local nSide = ReleaserObj.side
- local tCamp = {}
- -- 检查
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj and obj.side and nSide == obj.side then
- local nCamp = obj.camp
- if nCamp then
- tCamp[nCamp] = 1
- end
- end
- end
- local bAllCamp = true
- for i = CombatDefine.CAMP_TYPE1, CombatDefine.CAMP_TYPE5, 1 do
- if not tCamp[i] then
- bAllCamp = false
- break
- end
- end
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj and obj.side and nSide == obj.side then
- -- 处理百分比值
- -- 治疗
- if tSkilConfig.otherArgs.jobZhiliao then
- --table.print_lua_table(tSkilConfig.otherArgs.jobZhiliao)
- if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE4}) then
- -- local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
- if not obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
- obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] = 0
- end
- local nValue = tSkilConfig.otherArgs.jobZhiliao[2]
- -- print("BeSkill_RelicAttribute 治療 nValue = ".. nValue)
- obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] = obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] + nValue
- if obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] then
- -- print("[BeSkill_RelicAttribute] 治療加成 為 nNewValue = "..obj.relicAttr.ProAttr[RoleDefine.ZAOCHENG_HP_ADD_RATE] )
- else
- -- print("[BeSkill_RelicAttribute] 不存在 nNewValue" )
- end
- end
- end
- -- 免伤 百分比
- if tSkilConfig.otherArgs.jobMianshang then
- if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE1}) then
- --local extraRate = WinnerRelicLogic.WinnerRelic_GetRateDef(winnerID, winnerStar)
- if not obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] then
- obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] = 0
- end
- local nValue = tSkilConfig.otherArgs.jobMianshang[2]
- -- print("BeSkill_RelicAttribute 免伤 nValue = ".. nValue)
- obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] = obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE] + nValue
- -- print("[BeSkill_RelicAttribute] 免傷加成 為 nValue = "..nValue.." nNewValue = "..obj.relicAttr.ProAttr[RoleDefine.JIANSHANG_RATE])
- end
- end
- -- 防御增加固定值
- if tSkilConfig.otherArgs.jobDefense then
- if CombatBuff.isJob(obj, {CombatDefine.JOB_TYPE4, CombatDefine.JOB_TYPE1}) then
- if winnerID > 0 and winnerStar > 0 then
- local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
- if not obj.relicAttr.FixedAttr[RoleDefine.DEF] then
- obj.relicAttr.FixedAttr[RoleDefine.DEF] = 0
- end
- obj.relicAttr.FixedAttr[RoleDefine.DEF] = obj.relicAttr.FixedAttr[RoleDefine.DEF] + extraRate
- end
- end
- end
- -- 攻击 百分比
- if tSkilConfig.otherArgs.racialAtk then
- if CombatBuff.isCamp(obj, {CombatDefine.COMBAT_TYPE27}) then
- local extraRate = WinnerRelicLogic.WinnerRelic_GetRateAttack(winnerID, winnerStar)
- if not obj.relicAttr.ProAttr[RoleDefine.ATK] then
- obj.relicAttr.ProAttr[RoleDefine.ATK] = 0
- end
- obj.relicAttr.ProAttr[RoleDefine.ATK] = obj.relicAttr.ProAttr[RoleDefine.ATK] + extraRate
- end
- end
- -- 上阵阵容为全职业,加固定值
- if tSkilConfig.otherArgs.winnerfiveraces and bAllCamp == true then
- for _, v in ipairs(tSkilConfig.args) do
- if not obj.relicAttr.FixedAttr[v[1]] then
- obj.relicAttr.FixedAttr[v[1]] = 0
- end
-
- obj.relicAttr.FixedAttr[v[1]] = obj.relicAttr.FixedAttr[v[1]] + v[2]
- end
- end
- end
- end
- end
- function onFightBegin()
- posSortBySpeed[CombatDefine.ATTACK_SIDE] = {}
- posSortBySpeed[CombatDefine.DEFEND_SIDE] = {}
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj then
- obj.hp = obj.hp and obj.hp or 1
- end
- end
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj then
- if obj.beSkillList[BESKILL_TYPE26] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE26]) do
- if canUse(obj,v) then
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "attr" then
- for _,v1 in ipairs(skillConfig.args) do
- obj.sysAttr[v1[1]] = obj.sysAttr[v1[1]] +v1[2]
- end
- obj.isSysAttrChange = true
- elseif skillConfig.cmd == "normalTarget" then
- use(obj,{},v)
- elseif skillConfig.cmd == "winnerRelicSkill" then
- use(obj,{},v)
- BeSkill_RelicAttribute(obj, v)
- end
- end
- end
- end
- if pos <= CombatDefine.COMBAT_HERO_CNT then
- posSortBySpeed[CombatDefine.ATTACK_SIDE][#posSortBySpeed[CombatDefine.ATTACK_SIDE]+1] = {pos,obj.attr and obj.attr[RoleDefine.SPEED] or 0}
- elseif pos <= CombatDefine.COMBAT_HERO_CNT * 2 then
- posSortBySpeed[CombatDefine.DEFEND_SIDE][#posSortBySpeed[CombatDefine.DEFEND_SIDE]+1] = {pos,obj.attr and obj.attr[RoleDefine.SPEED] or 0}
- end
- end
- end
- for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
- local obj = CombatImpl.objList[pos]
- if obj then
- obj.hp = nil
- end
- end
- table.sort(posSortBySpeed[CombatDefine.ATTACK_SIDE],posSpeedCmp)
- table.sort(posSortBySpeed[CombatDefine.DEFEND_SIDE],posSpeedCmp)
- end
- function onCombatPetBe(round)
- if round <= 1 then
- return
- end
- for side = 1,CombatDefine.DEFEND_SIDE do
- local pet = CombatImpl.petList[side]
- if pet and pet.petID and pet.beSkillList[BESKILL_TYPE27] then
- for _,v in ipairs(pet.beSkillList[BESKILL_TYPE27]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "mp" then
- use(pet,{},v)
- end
- end
- end
- end
- end
- -- 计算被动技能属性
- local beSkillIDList = {}
- function doCalcHero(obj, attrs, skinSkillID, heroConf)
- for i = 1, #beSkillIDList do
- beSkillIDList[i] = nil
- end
- heroConf = heroConf or HeroDefine.getAttrConfig(obj.id, obj.star)
- local beSkillIDs = heroConf.beSkillList
- local skinSkillConf = skinSkillID and SkinSkillExcel[skinSkillID]
- if skinSkillConf then
- beSkillIDs = skinSkillConf.beSkillList
- end
- local weapSkillList = HeroExclusiveWeapon.GetweaponEffectIdList(obj)
- for _, skillID in ipairs(beSkillIDs) do
- --local skillConfig = SkillExcel[skillID]
- skillID = weapSkillList and weapSkillList[skillID] or skillID
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig.beSkillType == BESKILL_TYPE24 and
- ((not obj) or (obj.quality >= skillConfig.need)) then
- for _,v in ipairs(skillConfig.args) do
- beSkillIDList[#beSkillIDList + 1] = v
- end
- else
- beSkillIDList[#beSkillIDList + 1] = skillID
- end
- end
- for _, skillID in ipairs(beSkillIDList) do
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = Skill.GetSkillConfig(skillID)
- if skillConfig and skillConfig.cmd == "attr" and
- skillConfig.beSkillType == BESKILL_TYPE23 and
- ((not obj) or (obj.quality >= skillConfig.need)) then
- for _, v in ipairs(skillConfig.args) do
- RoleAttr.updateValue(v[1], v[2], attrs)
- end
- elseif skillConfig and skillConfig.cmd == "attrcomboAgain" and
- skillConfig.beSkillType == BESKILL_TYPE70 and
- ((not obj) or (obj.quality >= skillConfig.need)) then
- for i, v in ipairs(skillConfig.args) do
- if v[1] == 1 then
- RoleAttr.updateValue(v[2], v[3], attrs)
- end
- end
- end
- end
- end
- function beforeHit(attacker,defender)
- attacker.beforeHitCheck = false
- if attacker.beSkillList[BESKILL_TYPE40] then
- local hpMax = CombatObj.getHpMax(defender)
- local hp = defender.hp
- local defendHpRate = hp*10000/hpMax
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "lowerLimit" then
- local args = skillConfig.args
- if defendHpRate < args[1] then
- attacker.beforeHitCheck = true
- attacker.beskill40 = attacker.beskill40 or {}
- attacker.beskill40[defender.pos] = 1
- end
- end
- end
- end
- end
- function afterHit(attacker,target, isEnd)
- if attacker.beforeHitCheck then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
- use(attacker,{target},v)
- end
- end
- -- beforeFanji(attacker, isEnd)
- beforeFanji(attacker, target, isEnd)
- end
- function getOutAtkRate(attacker, defender)
- local outAtkRate = 0
- -- 首次攻击
- local isFirstAttack = CombatImpl.firstAttack[attacker.side]
- if isFirstAttack then
- for _,pos in ipairs(CombatDefine.SIDE2POS[defender.side]) do
- local objM = CombatImpl.objList[pos]
- if objM and objM.beSkillList[BESKILL_TYPE50] then
- for _,v in ipairs(objM.beSkillList[BESKILL_TYPE50]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs.outAtkRate then
- if skillConfig.otherArgs.outAtkRate >= outAtkRate then
- outAtkRate = skillConfig.otherArgs.outAtkRate
- end
- end
- end
- end
- end
- end
- return outAtkRate
- end
- function getOutAtkRate2(attacker, skillConfig)
- local outAtkRate = 0
- for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE72] or {}) do
- local config = Skill.GetSkillConfig(v[1])
- if config.cmd == "addHurtRateByRand" then
- local addHurtRate = 0
- for _, skillInfo in ipairs(config.beSkillArgs[2]) do
- if table.find(skillInfo[1], skillConfig.id) then
- addHurtRate = skillInfo[2]
- break
- end
- end
- local randVal = math.random(0, 10000)
- if randVal <= config.beSkillArgs[1] then
- outAtkRate = outAtkRate + addHurtRate
- end
- end
- end
- return outAtkRate
- end
- function getExtraHurtRate(attacker,defender,skillConfig)
- if not attacker or attacker.isPet then
- return 0
- end
- local zhanyiRet = 0
- local bodongHurtRet = 0
- local zhenduiHurtRate = 0
- local zhenduiLen = 0
- local zhenduiList = {}
- local bezhenduiList = {}
- local hpHurtRate = 0
- local extraSpeedHurt = 0
- local firstHurt = 0
- local sexHurt = 0
- local campHurt = 0
- local reJobHurt = 0
- local buffAndHPSubHurt = 0
- for k,skillList in pairs(attacker.beSkillList) do
- for j,v in pairs(skillList) do
- --local config = SkillExcel[v[1]]
- local config = Skill.GetSkillConfig(v[1])
- if config.cmd == "zhanyi" then --战意 伤害加成
- local nowHp = attacker.hp
- local hpMax = CombatObj.getHpMax(attacker)
- local percent = math.floor( (hpMax - nowHp )/hpMax * 100)
- if percent >= 1 then
- zhanyiRet = zhanyiRet + (percent * config.args[2])
- end
- elseif config.cmd == "fuwenAKH" then
- for i = 1,#config.otherArgs do
- zhenduiLen = zhenduiLen + 1
- zhenduiList[config.otherArgs[i][1]] = zhenduiList[config.otherArgs[i][1]] or 0
- zhenduiList[config.otherArgs[i][1]] = zhenduiList[config.otherArgs[i][1]] + config.otherArgs[i][2]
- end
- elseif config.cmd == "hurtBodong" then
- if canUse(attacker, v) then
- local minRet = config.args[1]
- local maxRet = config.args[2]
- local randomRet = math.random(minRet, maxRet)
- bodongHurtRet = bodongHurtRet + randomRet - 10000
- end
- elseif config.cmd == "hpExtraHurt" then
- local hp = defender.hp
- local beSkillArgs = config.beSkillArgs
- local checkHp = CombatObj.getHpMax(defender) * beSkillArgs[3] / 10000
- if beSkillArgs[2] == 1 and hp > checkHp then
- hpHurtRate = beSkillArgs[4]
- elseif beSkillArgs[2] == 2 and hp < checkHp then
- hpHurtRate = beSkillArgs[4]
- end
- elseif config.cmd == "extraSpeedHurt" then
- extraSpeedHurt = config.args[1]
- elseif config.cmd == "firstAttackHurt" then
- if canUse(attacker, v) then
- firstHurt = config.args[1]
- end
- elseif config.cmd == "buffAndHPSub" then
- local nowHp = defender.hp
- local hpMax = CombatObj.getHpMax(defender)
- local percent = math.floor((hpMax - nowHp )/hpMax * 100) --已损失血量百分比
- local condCfg = config.args
- local condRate = condCfg[1]
- if percent >= condRate then
- local condStatusList = condCfg[2] or {}
- local objNowSatus = CombatBuff.getStatus(defender)
- for buffCmd in pairs(condStatusList) do
- if objNowSatus[buffCmd] then
- buffAndHPSubHurt = condCfg[3] or 0
- break
- end
- end
- end
- end
- end
- end
- for k,skillList in pairs(defender.beSkillList) do
- for j,v in pairs(skillList) do
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- if conf then
- if conf.cmd == "befuwenAKH" then
- for i = 1,#conf.otherArgs do
- zhenduiLen = zhenduiLen + 1
- bezhenduiList[conf.otherArgs[i][1]] = bezhenduiList[conf.otherArgs[i][1]] or 0
- bezhenduiList[conf.otherArgs[i][1]] = bezhenduiList[conf.otherArgs[i][1]] + conf.otherArgs[i][2]
- end
- -- 受性别增伤
- elseif conf.cmd == "sexHurt" then
- if attacker.sex == conf.args[1] then
- sexHurt = sexHurt + conf.args[2]
- end
- -- 受阵营增伤
- elseif conf.cmd == "campHurt" then
- if attacker.camp == conf.args[1] then
- campHurt = campHurt + conf.args[2]
- end
- -- 受职业增伤
- elseif conf.cmd == "reJobHurt" then
- if attacker.job == conf.args[1] then
- reJobHurt = reJobHurt + conf.args[2]
- end
- end
- end
- end
- end
- if zhenduiLen > 0 then
- local bAdd = 0
- for k,skillList in pairs(defender.beSkillList) do
- for j,v in pairs(skillList) do
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- local isFuWenSkill = v[5]
- if conf.cmd and conf.cmd ~= "" and zhenduiList[conf.cmd] then
- -- 符文技能只生效一个
- if isFuWenSkill == 1 then
- if bAdd == 0 then
- zhenduiHurtRate = zhenduiHurtRate + zhenduiList[conf.cmd]
- bAdd = 1
- end
- else
- zhenduiHurtRate = zhenduiHurtRate + zhenduiList[conf.cmd]
- end
- end
- end
- end
- bAdd = 0
- for k,skillList in pairs(attacker.beSkillList) do
- for j,v in pairs(skillList) do
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- local isFuWenSkill = v[5]
- if conf.cmd and conf.cmd ~= "" and bezhenduiList[conf.cmd] then
- if isFuWenSkill == 1 then
- if bAdd == 0 then
- zhenduiHurtRate = zhenduiHurtRate + bezhenduiList[conf.cmd]
- bAdd = 1
- end
- else
- zhenduiHurtRate = zhenduiHurtRate + bezhenduiList[conf.cmd]
- end
- end
- end
- end
- end
-
- --特殊buff 对血族的加成
- local campHurtRate = 0
- local campRate = nil
- local buffCmd = nil
- local camp = nil
- for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
- obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 then
- if obj.beSkillList[BESKILL_TYPE68] then
- local beSkillList = obj.beSkillList[BESKILL_TYPE68][1]
- --local skillConfig = SkillExcel[beSkillList[1]]
- local skillConfig = Skill.GetSkillConfig(beSkillList[1])
- if skillConfig then
- camp = skillConfig.otherArgs.calcCamp[1]
- buffCmd = skillConfig.otherArgs.calcCamp[2]
- campRate = skillConfig.otherArgs.calcCamp[3]
- break
- end
- end
- end
- end
-
- if buffCmd and campRate and attacker.camp == camp then
- local campHurtCnt = 0
- for _,pos in ipairs(CombatDefine.SIDE2POS[defender.side]) do
- obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 then
- local isStatus1, cmd1, ind1 = CombatBuff.isStatus(obj, buffCmd)
- if isStatus1 then
- campHurtCnt = campHurtCnt + 1
- end
- end
- end
- if campHurtCnt > 0 then
- campHurtRate = campHurtCnt * campRate
- end
- end
- local extraHurtRate = zhanyiRet + zhenduiHurtRate + bodongHurtRet + hpHurtRate + extraSpeedHurt + firstHurt + sexHurt + campHurt + reJobHurt + campHurtRate + buffAndHPSubHurt
- if attacker.beSkillList[BESKILL_TYPE40] and attacker.beforeHitCheck then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE40]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "extraHurt" then
- local args = skillConfig.args
- extraHurtRate = extraHurtRate + args[1]
- end
- end
- end
- return extraHurtRate
- end
- --
- function getExtraHurt(attacker, target, tUseskillConfig)
- local extraHurt = 0
- if attacker.beSkillList[BESKILL_TYPE55] then
- local beSkillList = attacker.beSkillList[BESKILL_TYPE55][1]
- --local skillConfig = SkillExcel[beSkillList[1]]
- local skillConfig = Skill.GetSkillConfig(beSkillList[1])
- local buffCmd = target.bufferCmd[skillConfig.otherArgs.buffCmdHurtRate[1]]
- local rate = skillConfig.otherArgs.buffCmdHurtRate[2] / 10000
- if buffCmd then
- local buffCnt = #buffCmd
- local buffIndex = buffCmd[buffCnt]
- local buffer = target.buffer[buffIndex]
- --local conf = BufferExcel[buffer.id]
- local conf = CombatBuff.GetBuffConfig(buffer.id)
- local hurt = buffer.arg[1]
- extraHurt = extraHurt + hurt * rate * buffCnt
- end
- end
- return extraHurt
- end
- -- 根据杀气buff获得额外属性加成
- function GetExtraAttrByShaQi(attacker, targetAttrId)
- local attrVal = 0
- if not attacker then
- return attrVal
- end
- -- for _, skillList in pairs(attacker.beSkillList) do
- -- for _, v in pairs(skillList) do
- -- local config = Skill.GetSkillConfig(v[1])
- -- if config.cmd == "shaqi" then
- -- local buffNum = CombatBuff.getBuffCnt(attacker, config.cmd)
- -- if buffNum <= 0 then
- -- return attrVal
- -- end
-
- -- for _, attrTb in ipairs(config.args) do
- -- if attrTb[1] == targetAttrId then
- -- attrVal = (attrTb[2] or 0) * buffNum
- -- break
- -- end
- -- end
- -- end
- -- end
- -- end
- local buffNum = CombatBuff.getBuffCnt(attacker, "shaqi")
- if buffNum <= 0 then
- return attrVal
- end
- local attrArr
- for i=1, attacker.buffer[0] do
- local buffer = attacker.buffer[i]
- local conf = CombatBuff.GetBuffConfig(buffer.id)
- if conf.cmd == "shaqi" then
- attrArr = conf.args
- break
- end
- end
- if not attrArr then
- return attrVal
- end
- for _, attrTb in ipairs(attrArr) do
- if attrTb[1] == targetAttrId then
- attrVal = (attrTb[2] or 0) * buffNum
- break
- end
- end
- return attrVal
- end
- --
- function getRandomBuffCmd(attacker, target, cmd)
- local side = attacker.side
- local mathRandom = math.random
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE56] then
- local beSkillList = obj.beSkillList[BESKILL_TYPE56][1]
- --local skillConfig = SkillExcel[beSkillList[1]]
- local skillConfig = Skill.GetSkillConfig(beSkillList[1])
- local buffCmdRand = skillConfig.otherArgs.buffCmdRand
- if buffCmdRand and cmd == buffCmdRand[1] then
- local random = mathRandom(1, 10000)
- if random <= buffCmdRand[2] then
- return true
- end
- end
- end
- end
- end
- function getHurtPercentRate(attacker, defender, hurt, tUseskillConfig)
- local rate = 0
- for k,skillList in pairs(defender.beSkillList) do
- for j,v in pairs(skillList) do
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- if conf and conf.cmd == "behurtRet" then
- local canUse = true
- if conf.beSkillArgs and #conf.beSkillArgs > 0 then
- if conf.beSkillArgs[1] == "hurthpper" then
- local hpMax = CombatObj.getHpMax(defender)
- local percent = hurt/hpMax
- if percent < conf.beSkillArgs[2]/10000 then -- 伤害超过目标生命值上限X%时
- canUse = false
- end
- end
- end
- if canUse == true then
- local random = math.random(1, 10000)
- if random <= conf.args[2] then
- rate = rate + conf.args[1]
- end
- end
- end
- end
- end
- if tUseskillConfig.type == CombatDefine.SKILL_TYPE1 then
- if attacker.beSkillList[BESKILL_TYPE1] then
- for _, v in pairs(attacker.beSkillList[BESKILL_TYPE1]) do
- local nSkillID = v[1]
- --local skillConfig = SkillExcel[nSkillID]
- local skillConfig = Skill.GetSkillConfig(nSkillID)
- if skillConfig and skillConfig.hurtRate and skillConfig.hurtRate[1] then
- local fRate = skillConfig.hurtRate[1]
- rate = rate + fRate
- --print("[getExtraHurt] 获取到的普工伤害加成概率 fRate = "..fRate.." 总加成 rate = "..rate)
- end
- end
- end
- end
-
- return rate
- end
- function getBufferExtraHurt(attacker,bufferID,cmd)
- local rate = 0
- for _,skillList in pairs(attacker.beSkillList) do
- for k,v in pairs(skillList) do
- --local conf = SkillExcel[v[1]]
- local conf = Skill.GetSkillConfig(v[1])
- local otherArgs = conf.otherArgs
- if bufferID and otherArgs.bufferExtraHurt then
- for k1,v1 in ipairs(otherArgs.bufferExtraHurt[1]) do
- if bufferID == v1 then
- rate = rate + otherArgs.bufferExtraHurt[2]
- end
- end
- end
- if cmd and otherArgs.bufferCmdExtraHurt then
- for k1,v1 in ipairs(otherArgs.bufferCmdExtraHurt[1]) do
- if cmd == v1 then
- rate = rate + otherArgs.bufferCmdExtraHurt[2]
- end
- end
- end
- end
- end
- return rate
- end
- function getExtraHurtRateEx(attacker, defender)
- local rate = 0
- -- 死亡数伤害率
- if attacker.beSkillList[BESKILL_TYPE48] then
- for _,v in ipairs(attacker.beSkillList[BESKILL_TYPE48]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs.deathHurt then
- local side = defender.side
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp <=0 then
- if rate == 0 then
- rate = skillConfig.otherArgs.deathHurt
- else
- rate = rate + 10000
- end
- end
- end
- end
- end
- end
- return rate
- end
- --
- function getBuffChixuHurt(attacker, cmd)
- if not attacker then return 0 end
- local hurt = 0
- local side = attacker.side
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local objM = CombatImpl.objList[pos]
- if objM and objM.hp > 0 and objM.beSkillList[BESKILL_TYPE54] then
- for _,v in ipairs(objM.beSkillList[BESKILL_TYPE54]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs[cmd] then
- hurt = hurt + skillConfig.otherArgs[cmd]
- end
- end
- end
- end
- return hurt / 10000
- end
- --
- function handlerBuff(attacker, target, arg, cmd)
- if not attacker then return end
- for _,pos in ipairs(CombatDefine.SIDE2POS[attacker.side]) do
- local obj = CombatImpl.objList[pos]
- if obj and obj.hp > 0 and obj.beSkillList[BESKILL_TYPE57] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE57]) do
- attacker.args = arg
- use(attacker, {target}, v, false)
- end
- end
- end
- end
- function beforeMinusHp(obj, value)
- if value <= 0 then return end
- --敌对阵营 有对象有 49号被动技能 加血变成减血
- local side = obj.side == CombatDefine.ATTACK_SIDE and CombatDefine.DEFEND_SIDE or CombatDefine.ATTACK_SIDE
- for _,pos in ipairs(CombatDefine.SIDE2POS[side]) do
- local objM = CombatImpl.objList[pos]
- if objM and objM.hp > 0 and objM.beSkillList[BESKILL_TYPE49] then
- value = value * (-1)
- break
- end
- end
- return value
- end
- function beforeUpdateHp(obj,sum)
- if sum <= 0 and obj.beSkillList[BESKILL_TYPE41] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE41]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "miansi" and canUse(obj,v) then
- use(obj,{},v)
- return true
- end
- end
- end
- end
- function onCheckBuffer(obj,attacker,value)
- local ret = value
- if obj.beSkillList[BESKILL_TYPE42] then
- for _,v in ipairs(obj.beSkillList[BESKILL_TYPE42]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if canUse(obj,v) then
- local newFrame = true
- if skillConfig.cmd == "baohu" then
- obj.baohuHurt = value * skillConfig.args[1] / 10000
- if obj.hp < -obj.baohuHurt then
- obj.baohuHurt = -obj.hp
- end
- ret = value - obj.baohuHurt
- newFrame = false
- end
- use(obj,{attacker},v, newFrame)
- break
- end
- end
- end
- return ret
- end
- function getStatusBaoji(attacker, defender)
- local baoji = 0
- local firstBaoji = 0
- for k, skillList in pairs(attacker.beSkillList) do
- for j, v in pairs(skillList) do
- --local config = SkillExcel[v[1]]
- local config = Skill.GetSkillConfig(v[1])
- if config.cmd == "firstAttackHurt" then
- if canUse(attacker, v) then
- firstBaoji = config.args[2] or 0
- end
- end
- end
- end
- if attacker.beSkillList[BESKILL_TYPE60] then
- for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE60]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs.addStatusBaoji then
- local status = CombatBuff.getStatus(defender)
- local isStatus = false
- for k, v in ipairs(skillConfig.otherArgs.addStatusBaoji[1]) do
- if status[v] then
- isStatus = true
- break
- end
- end
- if isStatus then
- baoji = baoji + skillConfig.otherArgs.addStatusBaoji[2]
- end
- end
- end
- end
- if attacker.beSkillList[BESKILL_TYPE69] and attacker.notBaoJi then
- for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE69]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig and skillConfig.otherArgs.addNotBaoji then
- baoji = baoji + skillConfig.otherArgs.addNotBaoji
- end
- end
- end
- return baoji + firstBaoji
- end
- function getStatusPojia(attacker, defender)
- local poJia = 0
- -- 对指定状态破甲加成 走的技能状态属性
- if attacker.beSkillList[BESKILL_TYPE60] then
- for _, v in ipairs(attacker.beSkillList[BESKILL_TYPE60]) do
- --local skillConfig = SkillExcel[v[1]]
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.otherArgs.addStatusPoJia then
- local status = CombatBuff.getStatus(defender)
- local isStatus = false
- for k, v in ipairs(skillConfig.otherArgs.addStatusPoJia[1]) do
- if status[v] then
- isStatus = true
- break
- end
- end
- if isStatus then
- poJia = poJia + skillConfig.otherArgs.addStatusPoJia[2]
- end
- end
- end
- end
- return poJia
- end
- -- 是否不会被反击
- function isNoFanji(obj)
- if obj.beSkillList[BESKILL_TYPE72] then
- for _, v in ipairs(obj.beSkillList[BESKILL_TYPE72]) do
- local skillConfig = Skill.GetSkillConfig(v[1])
- if skillConfig.cmd == "noFanji" then
- return true
- end
- end
- end
- return false
- end
|