| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727 |
- local CombatImpl = require("combat.CombatImpl")
- local TargetMode = require("combat.TargetMode")
- local CombatCalc = require("combat.CombatCalc")
- local CombatObj = require("combat.CombatObj")
- local RoleDefine = require("role.RoleDefine")
- local CombatBuff = require("combat.CombatBuff")
- local CombatDefine = require("combat.CombatDefine")
- local BeSkill = require("combat.BeSkill")
- local Util = require("common.Util")
- local SkillExcel = require("excel.skill").skill
- local CmdExcel = require("excel.skill").cmd
- local ProjectLogic = require("platform.ProjectLogic")
- -- local BufferExcel = require("excel.buffer")
- local weaponSkillConfig = require("excel.weapon").skill
- local function calcHp(attacker,target,calcType,rate,limit,isAddHp,param, flag)
- local hp = CombatCalc.calcHp(attacker,target,calcType,rate, isAddHp, flag)
- if param and param.targetCnt then
- hp = hp / param.targetCnt
- end
- if limit then
- if hp > limit then
- hp = limit
- end
- end
- return hp
- end
- function GetSkillConfig(skillId)
- return weaponSkillConfig[skillId] or SkillExcel[skillId]
- end
- --如果该技能属于专属武器加强的技能, 则用专属武器配置表中的配置
- function GetFinalSkillConfig(obj, skillId)
- local targetId = skillId
- if obj and obj.weaponEffectIdList and obj.weaponEffectIdList[skillId] then
- targetId = obj.weaponEffectIdList[skillId]
- end
- return GetSkillConfig(targetId)
- end
- -- 技能释放条件检测表
- COND_CMD = {}
- -- 技能释放代价表
- COST_CMD = {}
- -- 技能释放条件检查
- function COND_CMD.attrCheck(obj, skillId)
- local skillConfig = GetSkillConfig(skillId)
- local skillCond = skillConfig.cond
- local attrType = skillCond[2]
- local attrCondVal = skillCond[3] * 100
- local nowAttrVal = CombatObj.getValue(obj, attrType)
- if nowAttrVal <= attrCondVal then
- return false
- end
- return true
- end
- -- 扣除技能释放的消耗, 暂时写死,胡须再看看怎么优化
- function COST_CMD.attrCheck(obj, skillConfig)
- local skillCond = skillConfig.cond
- local rate = skillCond[3] * 100
- local hurt = calcHp(obj, {}, 2, rate)
- if hurt ~= 0 then
- local d = CombatObj.updateHp(obj,-hurt,nil,true, obj.pos,CombatObj.SKILL_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(obj,-hurt,CMD2ID["hurt"])
- CombatObj.onHpCB(obj, d, obj.pos)
- end
- end
- end
- -- 技能释放条件检测
- function SkillCondCheck(obj, skillId)
- local skillConfig = GetSkillConfig(skillId)
- local skillCond = skillConfig.cond
- if not skillCond or not next(skillCond) then
- return true
- end
- if COND_CMD[skillCond[1]] then
- return COND_CMD[skillCond[1]](obj, skillId)
- end
- return false
- end
- function setSkill(obj,config,skinConfig)
- config = skinConfig or config
- local skillList = {}
- local skillConfig
- local normalAtkID = config.normalAtkID
- local temp = {}
- --普通技能
- if normalAtkID then
- --skillConfig = SkillExcel[normalAtkID]
- skillConfig = GetFinalSkillConfig(obj, normalAtkID)
- normalAtkID = skillConfig.id
- skillList[#skillList + 1] = {normalAtkID,skillConfig.cd[1] or 0,skillConfig.cd[2] or 0}--skillID,开始使用回合,冷切回合
- temp[normalAtkID] = true
- end
- --主动技能
- for _,skillID in ipairs(config.skillList) do
- --skillConfig = SkillExcel[skillID]
- --使用新的ID
- skillConfig = GetFinalSkillConfig(obj, skillID)
- skillID = skillConfig.id
- if not temp[skillID] and skillConfig and skillConfig.need <= obj.quality then
- skillList[#skillList + 1] = {skillID,skillConfig.cd[1] or 0,skillConfig.cd[2] or 0}--skillID,开始使用回合,冷切回合
- temp[skillID] = true
- end
- end
- if #skillList > 1 then
- table.sort(skillList,function(a,b)
- return a[3] > b[3]
- end)
- end
- obj.skillList = skillList
- end
- CMD2ID = {}
- function initAfterHot()
- for k,v in pairs(CMD2ID) do
- CMD2ID[k] = nil
- end
- for k,v in pairs(CmdExcel) do
- CMD2ID[v.cmd] = k
- end
- end
- function getCMD2ID(cmd)
- return CMD2ID[cmd]
- end
- GroupSkillCnt = 0--技能包触发技能次数
- local function realUse(obj, skillID, fanjiTargets,otherArgs)
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = GetSkillConfig(skillID)
- CombatImpl.nowAttacker = obj
- if skillConfig then
-
- --直接伤害
- CombatCalc.initAttacker(obj)
- local targets = TargetMode.getTargets(obj, skillConfig.targetMode, fanjiTargets, nil, true,skillConfig.type == CombatDefine.SKILL_TYPE1,skillID, true)
- -- local fentanBuffObjs = {}
- local len = #targets
- if len < 1 then return end
- for i=1, len do
- local defobj = targets[i]
- -- if defobj.addByfentan then
- -- fentanBuffObjs[defobj.pos] = defobj.id
- -- end
- CombatCalc.initAttacker(defobj)
- end
- GroupSkillCnt = GroupSkillCnt + 1
- -- 复活技能不走这里
- if skillConfig.cmd ~= "revive" then
- CombatImpl.addFrame()
- CombatImpl.setSkillID(obj, skillID)
- CombatImpl.setSaySkill(obj.pos,skillConfig.id,skillConfig.contentType)
- end
- attack(obj, targets, skillConfig)
-
- local newTargets = {}
- -- for _, lObj in ipairs(targets) do
- -- if not lObj.addByfentan and not fentanBuffObjs[lObj.pos] then
- -- newTargets[#newTargets+1] = lObj
- -- end
- -- end
- for _, lObj in ipairs(targets) do
- if not lObj.addByfentan then
- newTargets[#newTargets+1] = lObj
- end
- end
- if not fanjiTargets and skillConfig.otherArgs.addBuffBeforeCmd then
- CombatBuff.onHit(obj,newTargets,skillConfig)
- end
- --额外作用
- local cmdTargets
- if CMD[skillConfig.cmd] then
- cmdTargets = CMD[skillConfig.cmd](obj, skillConfig, newTargets)
- end
- if not fanjiTargets then
- if not skillConfig.otherArgs.addBuffBeforeCmd then
- CombatBuff.onHit(obj,newTargets,skillConfig,cmdTargets,otherArgs)
- end
- end
- BeSkill.onHit(obj,newTargets,skillID)
- CombatImpl.totalAtkCnt = CombatImpl.totalAtkCnt + 1
- end
- CombatImpl.nowAttacker = nil
- end
- function use(obj, skillID, fanjiTargets)
- --local skillConfig = SkillExcel[skillID]
- local skillConfig = GetSkillConfig(skillID)
- GroupSkillCnt = 0
- if skillConfig.type == CombatDefine.SKILL_TYPE5 then
- for k,v in ipairs(skillConfig.otherArgs.skillList) do
- --local config = SkillExcel[v]
- local config = GetSkillConfig(v)
- local targets = TargetMode.getTargets(obj, config.targetMode,fanjiTargets, nil , true)
- if #targets > 0 then
- realUse(obj, v,fanjiTargets)
- return
- end
- end
- elseif skillConfig.type == CombatDefine.SKILL_TYPE6 then
- for k,v in ipairs(skillConfig.otherArgs.skillList) do
- --local config = SkillExcel[v]
- local config = GetSkillConfig(v)
- local targets = TargetMode.getTargets(obj, config.targetMode,fanjiTargets, nil , true)
- if #targets > 0 then
- realUse(obj, v,fanjiTargets,{noFirst = (k ~= 1)})
- end
- end
- -- 扣除技能消耗
- local skillCond = skillConfig.cond
- if COST_CMD[skillCond[1]] then
- COST_CMD[skillCond[1]](obj, skillConfig)
- end
- elseif skillConfig.type == CombatDefine.SKILL_TYPE7 then
- local r = math.random(1,10000)
- for k,v in ipairs(skillConfig.otherArgs.skillList) do
- if r <= v[1] then
- --local config = SkillExcel[v[2]]
- local config = GetSkillConfig(v[2])
- local targets = TargetMode.getTargets(obj, config.targetMode,fanjiTargets, nil , true)
- if #targets > 0 then
- realUse(obj, v[2], fanjiTargets)
- end
- return
- else
- r = r - v[1]
- end
- end
- else
- realUse(obj, skillID,fanjiTargets)
- end
- end
- local hitList = {}
- local flagList = {}
- function attack(obj, targets, skillConfig)
- if not skillConfig.hurtRate[1] then obj.isAllCalcHp = true return end
- local totalHurt = 0
- local limitHurt = 0
- local fenTanHurt = 0
- -- 分摊技能操作
- if skillConfig.otherArgs and skillConfig.otherArgs.hurtFenTan and skillConfig.otherArgs.hurtFenTan[1] == 1 then
- for index = 1, #targets do
- local target = targets[index]
- if target.hp > 0 then
- local hurt, flag = CombatCalc.calcHurt(obj, index, targets, skillConfig)
- fenTanHurt = hurt
- limitHurt = CombatObj.getValue(obj,RoleDefine.ATK) * skillConfig.otherArgs.hurtFenTan[2]
- if fenTanHurt >= limitHurt then
- fenTanHurt = limitHurt
- end
- flagList[index] = flagList[index] or 0
- flagList[index] = flag
- end
- end
- end
- local len = 0
- obj.isAllCalcHp = nil
- if #targets == 0 then
- obj.isAllCalcHp = true
- end
- -- local fentanObjList = {}
- -- for _, obj in ipairs(targets) do
- -- if obj.fentq then
- -- fentanObjList[obj.pos] = obj.fentq
- -- end
- -- end
- for index = 1, #targets do
- local target = targets[index]
- if target.hp > 0 then
- BeSkill.beforeHit(obj,target)
- -- if fentanObjList[target.pos] then
- -- target.fentq = fentanObjList[target.pos]
- -- end
- local hurt,flag = nil
- if fenTanHurt == 0 then
- hurt,flag = CombatCalc.calcHurt(obj, index, targets, skillConfig)
- target.isShanBi = Util.getBit(flag, CombatDefine.FLAG_SHANBI)
- else
- hurt = fenTanHurt
- flag = flagList[index]
- end
- -- 闪避不处理目标被动技能
- obj.isAllCalcHp = index == #targets
- target.attackSkillID = skillConfig.id
- local hpValue,srcValue = 0,0
- if hurt > 0 then
- hpValue,srcValue = CombatObj.updateHp(target, -hurt,nil,true, obj.pos,CombatObj.SKILL_HP_TYPE)
- if hpValue < 0 and CombatBuff.isStatus(target, {"chenshui"}) then
- CombatBuff.DelBuffByCmd(target, "chenshui", 999)
- end
- CombatObj.onHpCB(target,hpValue,obj.pos,skillConfig.id)
- end
- CombatImpl.setSkillHit(target,srcValue,nil,flag,obj,skillConfig.id)
- if target.isShanBi ~= 1 then
- len = len + 1
- hitList[len] = target
- BeSkill.afterHit(obj,target)
- -- if fentanObjList[target.pos] then
- -- target.fentq = fentanObjList[target.pos]
- -- end
- end
- target.attackSkillID = nil
- end
- end
- -- 处理命中列表
- for index = 1, #targets do
- targets[index] = nil
- end
- for index = 1, len do
- targets[index] = hitList[index]
- end
- end
- CMD = {}
- function CMD.hp(obj,skillConfig,skillTargets)
- local ret = {}
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if args[4] and r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3], skillTargets)
- local targetCnt = #targets
- local hp
- local limit
- if args[5] and args[5] > 0 then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- if not obj.isPet and args[6] and args[6] > 0 then
- limit = args[6] * CombatObj.getHpMax(obj) / 10000
- end
- local hpAddRate = CombatObj.getValue(obj,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
- for _,target in ipairs(targets) do
- if not target.bufferCmd["noHp"] then
- hp = calcHp(obj,target,calcType,rate,limit,true)
- hp = hp * (1 + hpAddRate)
- hp = hp < 0 and 1 or hp
- if hp > 0 and obj.isAllCalcHp == true then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- local showHp = hp
- if hp > 0 and d < 0 then
- showHp = hp * (-1)
- end
- CombatImpl.setExtraHit(target, showHp, CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- if hp < 0 then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- if hp > 0 and d < 0 then
- hp = hp * (-1)
- end
- CombatImpl.setExtraHit(target, hp, CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- ret[#ret+1] = target
- end
- end
- return ret
- end
- function CMD.shixueHP(obj,skillConfig,skillTargets, hitObj)
- local ret = {}
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if args[4] and r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3], skillTargets)
- local hp
- local limit
- if args[5] and args[5] > 0 then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- if not obj.isPet and args[6] and args[6] > 0 then
- limit = args[6] * CombatObj.getHpMax(obj) / 10000
- end
- local targetBuffInfo
- local res, _, buffIdx = CombatBuff.isStatus(obj, {"noShixue"})
- local bl = true
- if res and buffIdx then
- local objBuffList = CombatBuff.getBuffer(obj)
- targetBuffInfo = objBuffList[buffIdx]
- if hitObj and targetBuffInfo and targetBuffInfo.attackPos == hitObj.pos then
- bl = false
- end
- end
- local hpAddRate = CombatObj.getValue(obj,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
- for _,target in ipairs(targets) do
- if not target.bufferCmd["noHp"] and bl then
- hp = calcHp(obj,target,calcType,rate,limit,true)
- hp = hp * (1 + hpAddRate)
- hp = hp < 0 and 1 or hp
- if hp > 0 and obj.isAllCalcHp == true then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- local showHp = hp
- if hp > 0 and d < 0 then
- showHp = hp * (-1)
- end
- CombatImpl.setExtraHit(target, showHp, CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- if hp < 0 then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- if hp > 0 and d < 0 then
- hp = hp * (-1)
- end
- CombatImpl.setExtraHit(target, hp, CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- ret[#ret+1] = target
- end
- end
- return ret
- end
- function CMD.speedHp(obj,skillConfig,skillTargets)
- if not (skillTargets and skillTargets[1]) then
- return
- end
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if args[4] and r > args[4] then
- return
- end
-
- local calcType = args[1]
- local rate = args[2]
- local target = skillTargets[1]
- local ret = {}
- local hp
- local limit
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- local hpAddRate = CombatObj.getValue(obj,RoleDefine.ZAOCHENG_HP_ADD_RATE) / 10000
-
- local aSpeed = CombatImpl.getValue(obj,RoleDefine.SPEED)
- local bSpeed = CombatImpl.getValue(target,RoleDefine.SPEED)
- local checkSpeed = aSpeed - bSpeed
- if args[3] == 1 then
- checkSpeed = -checkSpeed
- end
- if checkSpeed > 0 then
- local targets = TargetMode.getTargets(obj, args[3], skillTargets)
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit,true)
- hp = hp * (1 + hpAddRate)
- hp = hp < 0 and 1 or hp
- if hp ~= 0 and not target.bufferCmd["noHp"] then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- if hp > 0 and d < 0 then
- hp = hp * (-1)
- end
- CombatImpl.setExtraHit(target,hp,CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- ret[#ret+1] = target
- end
- end
- return ret
- end
- function CMD.statusHp(obj,skillConfig,skillTargets)
- if not skillTargets then
- return
- end
- local isAdd = false
- local args = obj.isPet and obj.args or skillConfig.args
- for _,v in ipairs(skillTargets) do
- if CombatBuff.isStatus(v,args[4]) then
- isAdd = true
- break
- end
- end
- if not isAdd then return end
-
-
- local calcType = args[1]
- local rate = args[2]
- local ret = {}
- local hp
- local limit
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- local targets = TargetMode.getTargets(obj, args[3], skillTargets)
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit,true)
- hp = hp < 0 and 1 or hp
- if hp ~= 0 and not target.bufferCmd["noHp"] then
- if target.side == CombatDefine.DEFEND_SIDE then
- hp = CombatImpl.commonArgs.hpLimit or hp
- end
- local d = CombatObj.updateHp(target,hp,nil,true,obj.pos,CombatObj.EXTRA_HP_TYPE)
- if hp > 0 and d < 0 then
- hp = hp * (-1)
- end
- CombatImpl.setExtraHit(target,hp,CMD2ID["hp"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- ret[#ret+1] = target
- end
- return ret
- end
- function CMD.hurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.behurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- if calcType ~= 17 then
- hp = calcHp(target,obj,calcType,rate,limit)
- else
- hp = calcHp(obj, target,calcType,rate,limit)
- end
-
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["behurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtwalun(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtwalun"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.posHurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
-
- local posList = args[6]
- if posList == nil then
- return
- end
- for _,target in ipairs(targets) do
- local bfind = false
- for k, v in pairs(posList) do
- if v == target.pos then
- bfind = true
- break
- end
- end
-
- if bfind then
- hp = calcHp(obj,target,calcType,rate,limit, false)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- end
- return ret
- end
- function CMD.hurtxia(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtxia"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtmingli(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtmingli"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtmingli2(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtmingli2"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtguangci(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtguangci"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.jobHurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local calcType = args[1]
- local rate = args[2]
- local r = math.random(0,10000)
- if r > args[3] then
- return
- end
- local job = args[4]
- local hp
- local limit
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- local ret = {}
- for _,target in ipairs(skillTargets) do
- if target.job == job then
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp and hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["jobHurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- end
- return ret
- end
- function CMD.statusHurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local calcType = args[1]
- local rate = args[2]
- local r = math.random(0,10000)
- if r > args[3] then
- return
- end
- local status = args[4]
- local hp
- local limit
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- local ret = {}
- for _,target in ipairs(skillTargets) do
- if CombatBuff.isStatus(target, status) then
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp and hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["jobHurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- end
- return ret
- end
- function CMD.hpHurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local calcType = args[1]
- local rate = args[2]
- local hpRate = args[3]/10000
- local ret = {}
- for _,target in ipairs(skillTargets) do
- local hpLimit = CombatObj.getHpMax(target) * hpRate
- if target.hp >= hpLimit then
- hp = calcHp(obj,target,calcType,rate)
- if hp and hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hpHurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- end
- return ret
- end
- function CMD.fanji(obj,skillConfig,skillTargets)
- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- if CombatBuff.isStatus(obj,{"xuanyun","shihua","bingdong", "xuanyun2", "chenshui", "donghe"}) then return end
- if obj.side == skillTargets[1].side then
- return
- end
- if obj.hp > 0 then
- local r = math.random(0,10000)
- if r < skillConfig.args[2] then
- for i=#skillTargets, 1, -1 do
- if BeSkill.isNoFanji(skillTargets[i]) then
- table.remove(skillTargets, i)
- end
- end
- if #skillTargets == 0 then
- return
- end
- CombatImpl.fanjiList[#CombatImpl.fanjiList + 1] = {obj,skillConfig.args[1],skillTargets}
- end
- end
- end
- function CMD.qingsuan(obj,skillConfig,skillTargets)
- if obj.isPet then return {} end
- local args = skillConfig.args
- local r = math.random(0,10000)
- if r > args[3] then
- return
- end
- local rate = args[1]
- local limit
- if args[4] then
- limit = args[4] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- local targets = TargetMode.getTargets(obj, args[2],skillTargets)
- local ret = {}
- for _,target in ipairs(targets) do
- local baseValue = CombatBuff.qingsuan(target)
- if baseValue > 0 then
- local hurt = baseValue * rate / 10000
- if limit and hurt > limit then
- hurt = limit
- end
- local d = CombatObj.updateHp(target,-hurt,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- CombatImpl.setExtraHit(target,-hurt,CMD2ID["qingsuan"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- return ret
- end
- function CMD.jiekong(obj,skillConfig,skillTargets)
- if obj.isPet then return {} end
- local args = skillConfig.args
- local r = math.random(0,10000)
- if r > args[2] then
- return
- end
- local targets = TargetMode.getTargets(obj, args[1],skillTargets)
- local ret = {}
- for _,target in ipairs(targets) do
- CombatBuff.jiekong(target)
- ret[#ret+1] = target
- end
- return ret
- end
- function CMD.groupcmd(obj,skillConfig,skillTargets)
- if obj.isPet then return {} end
- for k,v in ipairs(skillConfig.args) do
- local cmd = v[1]
- local conf = {args = v[2]}
- if CMD[cmd] then
- CMD[cmd](obj,conf,skillTargets)
- end
- end
- return {}
- end
- function CMD.randcmd(obj,skillConfig,skillTargets)
- if obj.isPet then return {} end
- local total = 0
- for k,v in ipairs(skillConfig.args) do
- total = total + v[3]
- end
- local r = math.random(0,total)
- for k,v in ipairs(skillConfig.args) do
- if r <= v[3] then
- local cmd = v[1]
- local conf = {args = v[2]}
- if CMD[cmd] then
- CMD[cmd](obj,conf,skillTargets)
- end
- break
- else
- r = r - v[1]
- end
- end
- return {}
- end
- function CMD.qusan(obj,skillConfig,skillTargets)
- if obj.isPet then return {} end
- local args = skillConfig.args
- local r = math.random(0,10000)
- if r > args[3] then
- return
- end
- local qusanType = args[1]
- local calcType = args[5] and args[5][1]
- local rate = args[5] and args[5][2]
- local buffers = args[8] and args[8][1]
- local targets = TargetMode.getTargets(obj, args[2],skillTargets)
- local ret = {}
- if args[7] then
- limit = args[7] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- local cnt = CombatBuff.qusan(target, qusanType,args[4])
- if limit then
- limit = limit * cnt
- end
- if buffers and cnt > 0 then
- local targets = TargetMode.getTargets(obj, args[8][2],skillTargets)
- CombatBuff.qusanAddBuff(obj, targets, buffers)
- end
- ret[#ret+1] = target
- if calcType and rate and cnt > 0 then
- local hp = calcHp(obj,target,calcType,rate * cnt, limit, nil, nil, args[6])
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["qusan"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- end
- end
- end
- return ret
- end
- function CMD.hurtwalun2(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtwalun2"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtxia2(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtxia2"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.hurtxia3(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK_COMBAT_NOW) / 10000
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurtxia3"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- function CMD.attributehurt(obj, skillConfig, skillTargets)
- if not skillTargets or nil == _G.next(skillTargets) then
- return
- end
- local args = skillConfig.args
- if not args then
- print("[attributehurt] 不存在对应配置直接返回")
- return
- end
- local nAttrID = args[1] -- 属性ID
- local nRate = args[2] -- 属性倍数
- local nEnemyAttrID = args[3] -- 敌方属性
- local nNowHurt = CombatObj.getValue(obj, RoleDefine.ATK)
- local nAttrValue = CombatObj.getValue(obj, nAttrID)
- local nValue = nAttrValue * nRate
- local nMaxHurt = CombatObj.getValue(obj, RoleDefine.ATK) * 10
- -- print("[attributehurt] 计算出来的进攻方属性加成 nValue = "..nValue.." 获取到的 属性ID = "
- -- ..nAttrID.." 属性值 "..nAttrValue.." 倍率 "..nRate.." 攻击力的10倍 = "..nMaxHurt)
- local ret = {}
- for _, tEnemyObj in ipairs(skillTargets) do
- local nEnemyValue = CombatObj.getValue(tEnemyObj, nEnemyAttrID)
- local nBeginHurt = nValue / nEnemyValue
- local nEndHurt = nBeginHurt * nNowHurt
- nEndHurt = math.min(nMaxHurt, nEndHurt)
- -- print("[attributehurt] 计算出来的最终伤害 nEndHurt = "..nEndHurt.." 获取到的敌方 属性ID = "
- -- ..nEnemyAttrID.." 敌方属性值 "..nEnemyValue.." 开始 nBeginHurt "..nBeginHurt)
- local d = CombatObj.updateHp(tEnemyObj, -nEndHurt, nil, true, obj.pos, CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(tEnemyObj, -nEndHurt, CMD2ID["attributehurt"])
- CombatObj.onHpCB(tEnemyObj, d, obj.pos, skillConfig.id)
- ret[#ret+1] = tEnemyObj
- end
- end
-
- return ret
- end
- NO_SKILL_CHECK_COMBO_LIST = {
- ["hp"] = 1,
- ["revive"] = 1,
- ["baohu"] = 1,
- }
- function skillIsHpOrRevive(obj, argSkillID)
- --local argSkillConf = SkillExcel[argSkillID]
- local argSkillConf = GetSkillConfig(argSkillID)
- if not argSkillConf then return end
- -- 带有伤害
- if argSkillConf.hurtRate[1] then return end
- if argSkillConf.continuous and argSkillConf.continuous == 1 then return true end
- if NO_SKILL_CHECK_COMBO_LIST[argSkillConf.cmd] then
- return true
- end
- local bRet = false
- if argSkillConf.cmd == "groupcmd" then
- for k,v in ipairs(argSkillConf.args) do
- local cmd = v[1]
- if cmd == "hurt" then return end
- if NO_SKILL_CHECK_COMBO_LIST[cmd] then
- bRet = true
- end
- end
- end
- -- 技能包
- if argSkillConf.type == CombatDefine.SKILL_TYPE5 or
- argSkillConf.type == CombatDefine.SKILL_TYPE6 or
- argSkillConf.type == CombatDefine.SKILL_TYPE7 then
- for k,v in ipairs(argSkillConf.otherArgs.skillList) do
- local config = SkillExcel[v]
- -- 带有伤害
- if config and config.hurtRate[1] then return end
- if config then
- if NO_SKILL_CHECK_COMBO_LIST[config.cmd] or config.continuous == 1 then
- bRet = true
- end
-
-
- for k,v in ipairs(config.buffers) do
- --local bufConfig = BufferExcel.buffer[v[1]]
- local bufConfig = CombatBuff.GetBuffConfig(v[1])
- -- 带有伤害
- if bufConfig and NO_SKILL_CHECK_COMBO_LIST[bufConfig.cmd] then
- bRet = true
- end
- end
- end
- end
- for k,v in ipairs(argSkillConf.buffers) do
- --local bufConfig = BufferExcel[v[1]]
- local bufConfig = CombatBuff.GetBuffConfig(v[1])
- -- 带有伤害
- if bufConfig and NO_SKILL_CHECK_COMBO_LIST[bufConfig.cmd] then
- bRet = true
- end
- end
- end
- return bRet
- end
- function CMD.combo(obj,skillConfig,skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- -- if CombatImpl.isFanji or (CombatImpl.comboType > 0 and CombatImpl.comboType ~= 999) then
- -- return
- -- end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 1, skillConfig.args[2], skillConfig.args[3],skillConfig.args[4] or 1, skillConfig.args[5]}
- return true
- end
- end
- --
- function CMD.comboFight(obj,skillConfig,skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- if CombatImpl.isFanji then return end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 1, skillConfig.args[2], skillConfig.args[3],skillConfig.args[4] or 1, skillConfig.args[5]}
- return true
- end
- end
- function CMD.combo1(obj,skillConfig,skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, skillConfig) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- -- if CombatImpl.isFanji or (CombatImpl.comboType > 0 and CombatImpl.comboType ~= 999) then
- -- return
- -- end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 1, skillConfig.args[2], skillConfig.args[3],2}
- return true
- end
- end
- function CMD.combo2(obj,skillConfig,skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- -- if CombatImpl.isFanji or (CombatImpl.comboType > 0 and CombatImpl.comboType ~= 999) then
- -- return
- -- end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 1, skillConfig.args[2], skillConfig.args[3],3}
- return true
- end
- end
- function CMD.comboNormal(obj, skillConfig, skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getNormalSkill(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- if CombatImpl.comboType > 0 then return end
- if CombatImpl.isFanji then
- if GroupSkillCnt > 2 then return end
- else
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- end
-
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 2, skillConfig.args[2], skillConfig.args[3],skillConfig.args[4] or 1}
- end
- end
- function CMD.attrcomboAgain(obj, skillConfig, skillTargets)
- local tComboCof = nil
- for _, v in ipairs(skillConfig.args) do
- if v[1] == 2 then
- tComboCof = v
- break
- end
- end
- if not tComboCof then
- print("[CMD.attrcomboAgain] 不存在连击配置")
- return
- end
- --table.print_lua_table(tComboCof)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = tComboCof[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
-
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- local nSkillID = tComboCof[3] or CombatImpl.getSkillID(obj)
- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- -- if CombatImpl.isFanji or (CombatImpl.comboType > 0 and CombatImpl.comboType ~= 999) then
- -- return
- -- end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- --print("[CMD.attrcomboAgain] nSkillID = "..nSkillID)
- if r < tComboCof[2] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 1, tComboCof[3], nSkillID, tComboCof[5] or 1, tComboCof[6]}
- return true
- end
- end
- function CMD.zhuiji(obj,skillConfig,skillTargets)
- -- 二次元 屏蔽 治疗 复活的连击
- if ProjectLogic.isSsecy() then
- local argSkillID = skillConfig.args[3] or CombatImpl.getSkillID(obj)
- if skillIsHpOrRevive(obj, argSkillID) then
- return
- end
- if skillIsHpOrRevive(obj, skillConfig.id) then
- return
- end
- end
- local objTag = obj.uuid or obj.id
- if CombatImpl.useZhuijiObjList[obj.pos] and (CombatImpl.useZhuijiObjList[obj.pos][objTag] or 0) >= 1 then
- return
- end
- -- if CombatImpl.isFanji or CombatImpl.comboType > 0 then return end
- if GroupSkillCnt ~= 1 then return end--技能包首次技能攻击才能触发
- local r = math.random(0,10000)
- if r < skillConfig.args[1] then
- CombatImpl.comboList[#CombatImpl.comboList + 1] = {obj, 999, skillConfig.args[2], skillConfig.args[3],skillConfig.args[4] or 1, skillConfig.args[5]}
- return true
- end
- end
- function CMD.baohu(obj,skillConfig,skillTargets)
- local d = CombatObj.updateHp(obj,obj.baohuHurt,nil,nil, obj.pos,CombatObj.BUFFER_HP_TYPE)
- if d ~= 0 then
- local attrs = {}
- attrs[RoleDefine.BAOHU_COMBAT] = skillTargets[1].pos
- CombatImpl.setExtraHit(obj,d,CMD2ID["baohu"],attrs)
- CombatObj.onHpCB(obj,d, skillTargets[1].pos)
- end
- end
- function CMD.yinbaoZuzhou(obj,skillConfig,skillTargets)
- CombatBuff.yinbaoZuzhou(obj, skillTargets, skillConfig)
- end
- --指定普攻目标模式
- function CMD.normalTarget(obj,skillConfig)
- obj.normalTarget = {status = {}}
- if skillConfig.args.status then
- for k,v in ipairs(skillConfig.args.status) do
- obj.normalTarget.status[k] = v
- end
- end
- end
- --诅咒附加伤害
- function CMD.zuzhouHurt(obj, skillConfig, skillTargets)
- if not obj.args then return end
- local confArgs = skillConfig.args
- local targets = TargetMode.getTargets(obj, confArgs[1], skillTargets)
- local zuzhouHurt = obj.args * confArgs[2] / 10000
- for _,target in ipairs(targets) do
- if zuzhouHurt ~= 0 then
- local d = CombatObj.updateHp(target,-zuzhouHurt,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-zuzhouHurt,CMD2ID["zuzhouHurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- end
- end
- obj.args = nil
- end
- function CMD.dnexhurt(obj,skillConfig,skillTargets)
- local args = obj.isPet and obj.args or skillConfig.args
- local r = math.random(0,10000)
- if r > args[4] then
- return
- end
- local calcType = args[1]
- local rate = args[2]
- local targets = TargetMode.getTargets(obj, args[3],skillTargets)
- local hp
- local limit
- local ret = {}
- if args[5] then
- limit = args[5] * CombatObj.getValue(obj,RoleDefine.ATK)
- end
- for _,target in ipairs(targets) do
- hp = calcHp(obj,target,calcType,rate,limit)
- if hp ~= 0 then
- local d = CombatObj.updateHp(target,-hp,nil,true, obj.pos,CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hp,CMD2ID["hurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- ret[#ret+1] = target
- end
- end
- end
- return ret
- end
- --拥有指定buff后的额外效果
- function CMD.targetBuffExtraEffect(obj,skillConfig,skillTargets)
- local args = skillConfig.args
- if not args then
- return
- end
- local targetBuffCmd = args[1]
- local targetBuffCnt = args[2]
- if not targetBuffCmd or not targetBuffCnt then
- return
- end
- local nowTargetBuffCnt = CombatBuff.getBuffCnt(obj, targetBuffCmd)
- if nowTargetBuffCnt < targetBuffCnt then
- return
- end
- local targetMode = args[3]
- local targets = TargetMode.getTargets(obj, targetMode, skillTargets)
- local hurt, limitVale
- local calcType, rate = args[4], args[5]
- local maxNum = args[6] or 1
- local nowNum = math.floor(nowTargetBuffCnt / targetBuffCnt)
- if nowNum < maxNum then
- maxNum = nowNum
- end
- local limitAttrType = args[7]
- local limitAttrRate = args[8]
- if limitAttrType and limitAttrRate then
- limitVale = limitAttrRate * CombatObj.getValue(obj, limitAttrType)
- end
- table.shuffle(targets)
- for idx, target in ipairs(targets) do
- if idx > maxNum then
- break
- end
- hurt = calcHp(obj, target, calcType, rate, limitVale)
- if hurt ~= 0 then
- local d = CombatObj.updateHp(target,-hurt,nil,true, obj.pos,CombatObj.SKILL_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(target,-hurt,CMD2ID["hurt"])
- CombatObj.onHpCB(target,d, obj.pos)
- end
- end
- end
- CombatBuff.DelBuffByCmd(obj, targetBuffCmd, nowTargetBuffCnt)
- end
- --debuff 和 buff 数量差的额外伤害
- function CMD.buffDiffHurt(obj,skillConfig,skillTargets)
- local args = skillConfig.args
- if not args then
- return
- end
- local buffType1 = args[1] --buff类型1, 对应配置表buff中qusan分页中的type
- local buffType2 = args[2] --buff类型2, 对应配置表buff中qusan分页中的type
- local targetMode = args[3]
- local calcType, rate = args[4], args[5]
- local limitAttrType, limitAttrMul = args[6], args[7]
- local maxHurt = CombatObj.getValue(obj, limitAttrType) * limitAttrMul
- local targets = TargetMode.getTargets(obj, targetMode, skillTargets)
- for _, targetObj in ipairs(targets) do
- local buffCnt1 = CombatBuff.getCombatBufferCnt(targetObj, buffType1)
- local buffCnt2 = CombatBuff.getCombatBufferCnt(targetObj, buffType2)
- if buffCnt1 > buffCnt2 then
- local hurt = calcHp(obj, targetObj, calcType, rate)
- hurt = hurt * (buffCnt1 - buffCnt2)
- if hurt > maxHurt then
- hurt = maxHurt
- end
- local d = CombatObj.updateHp(targetObj, -hurt, nil, true, obj.pos, CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(targetObj, -hurt, CMD2ID["hurt"])
- CombatObj.onHpCB(targetObj, d, obj.pos)
- end
- end
- end
- end
- -- 与其中一个符合条件的队友交换血量, 交换成功后,恢复自身一定血量
- function CMD.exchangeHP(obj,skillConfig,skillTargets)
- local args = skillConfig.args
- if not args then
- return
- end
- local targetMode = args[3]
- local targets = TargetMode.getTargets(obj, targetMode, skillTargets)
- local targetObj = targets[1]
- if targetObj then
- -- 不能是自己
- if targetObj.pos == obj.pos then
- return
- end
- -- 不能满血
- local attrID = targetMode[4] or RoleDefine.HP -- 默认是HP
- local targetObjSubRate = CombatObj.getValue(targetObj, attrID)
- if targetObjSubRate >= 10000 then
- return
- end
- local targetHP = targetObj.hp
- local attackerHp = obj.hp
- local subHP = attackerHp - targetHP
- -- 施放者血量不能最低
- if subHP > 0 then
- -- 给目标加血量差值
- local d = CombatObj.updateHp(targetObj, subHP, nil, true, obj.pos, CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(targetObj, subHP, CMD2ID["hp"])
- CombatObj.onHpCB(targetObj, d, obj.pos)
- end
- -- 给施放者扣血量差值
- d = CombatObj.updateHp(obj, -subHP, nil, true, targetObj.pos, CombatObj.EXTRA_HP_TYPE)
- if d ~= 0 then
- CombatImpl.setExtraHit(obj, -subHP, CMD2ID["hp"])
- CombatObj.onHpCB(obj, d, targetObj.pos)
- end
- -- 给施放者恢复一定血量
- local calcType = args[1]
- local rate = args[2]
- local hp = calcHp(obj,targetObj, calcType, rate, nil, true)
- d = CombatObj.updateHp(obj,hp, nil, true, obj.pos, CombatObj.EXTRA_HP_TYPE)
- local showHp = hp
- if hp > 0 and d < 0 then
- showHp = hp * (-1)
- end
- CombatImpl.setExtraHit(obj, showHp, CMD2ID["hp"])
- CombatObj.onHpCB(obj,d, obj.pos)
- end
- end
- end
|