From 501140fa52e2232f9d182630ea4aca4ae036b6a9 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 13 May 2021 11:24:35 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=E8=A2=AB=E5=8A=A8=E5=A2=9E=E5=8A=A0=20316-321?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/Logic/Base/Buff.lua | 15 ++ .../Modules/Battle/Logic/Base/Passivity.lua | 180 ++++++++++++++++++ .../Modules/Battle/Logic/Buff/Control.lua | 5 +- .../Battle/Logic/Misc/BattleDefine.lua | 1 + .../Modules/Battle/Logic/Misc/BattleUtil.lua | 9 +- .../Modules/Battle/Logic/Role/RoleLogic.lua | 1 + 6 files changed, 207 insertions(+), 4 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua index 98358be52f..44640e4e61 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua @@ -202,6 +202,21 @@ function BuffManager:GetBuff(target, checkFunc) end return blist end +--根据条件获取所有的buff +function BuffManager:GetAllBuffByFunc(checkFunc) + local blist = {} + for i=1, self.buffDic.size do + local list = self.buffDic.vList[i] + for j=1, list.size do + local buff = list.buffer[j] + if not checkFunc or checkFunc(buff)then + table.insert(blist, buff) + end + end + end + return blist +end + function BuffManager:HasBuff(target, type, checkFunc) if self.buffDic.kvList[type] then diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 830a8e174a..9039d039fc 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -6871,5 +6871,185 @@ local passivityList = { [315] = function(role, args,id,judge) role.ctrl_noheal=true end, + --同一回合受同一目标(站位)直接伤害每次降低[a]% + --a[float] + [316] = function(role, args,id,judge) + local f1 = args[1] + local curRound=1 + local attackRecord={} + local curDamage = 0 + local function onRoundChange(round) + if round==curRound+1 then + attackRecord={} + end + curRound=round + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange,nil,nil,role) + + + local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType,isDirect) + -- 非直接伤害不免除 + if not skill and not isDirect then + return + end + if atkRole.camp==role.camp then + return + end + --攻击次数 + local time=0 + for key, value in pairs(attackRecord) do + if value[1]==atkRole.position then + time=value[2] + value[2]=time+1 + end + end + if time==0 then + table.insert(attackRecord,{atkRole.position,1}) + return + end + curDamage=floor(damage*f1*time) + if damagingFunc then damagingFunc(curDamage) end + + end + role.Event:AddEvent(BattleEventName.FinalBeDamageEnd, onFinalBeDamage,nil,nil,role) + end, + --每次行动击杀敌方单位(不按人头算)驱散随机一个有异常的队友随机一个异常 + [317] = function(role, args,id,judge) + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if target.camp==role.camp then + return + end + --如果是技能并且这个被动已经被触发过 return + if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then + return + end + if not skill and judge==1 then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then + if skill then + table.insert(skill.triggerPassivityId,id) + end + local list=BattleLogic.BuffMgr:GetAllBuffByFunc(function(buff) return buff.target.camp==role.camp and (buff.type==BuffName.Control or buff.type==BuffName.DOT or buff.type==BuffName.Exile ) end) + local len=BattleUtil.LengthOfTable(list) + if list and len>0 then + local index=Random.RangeInt(1,len) + BattleLogic.BuffMgr:ClearBuff(list[index].target, function (buff) + return buff==list[index] + end) + end + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) + end, + -- 技能施加控制状态失败,回复自身[a]点怒气() + -- a[int] + [318] = function(role, args) + local f1 = args[1] + local ctrlNum=0 + local isCtrl=false + -- 死亡数量 + local onRoleAddBuffMiss = function(buff) + if buff then + if buff.type==BuffName.Control and buff.caster==role then + isCtrl=true + ctrlNum=ctrlNum+1 + end + end + end + BattleLogic.Event:AddEvent(BattleEventName.RoleAddBuffFail, onRoleAddBuffMiss,nil,nil,role) + local onSkillCastEnd= function(skill) + local maxNum=#skill:GetDirectTargets() + LogError("ctrlnum=="..ctrlNum.."maxNum=="..maxNum) + if isCtrl and ctrlNum>=maxNum then + BattleUtil.CalRage(role, role,f1, CountTypeName.Add) + end + isCtrl=false + ctrlNum=0 + end + role.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCastEnd,nil,nil,role) + end, + --死亡时,按剩余怒气乘[a]平均分给存活队友,每人至少[b]点,按站位优先 + --a[int],b[int] + [319] = function(role, args,id,judge) + local v1 = args[1] + local v2 = args[2] + + local OnDead = function(atkRole,skill) + local arr=RoleManager.Query(function(v) return v.camp==role.camp and v~=role end) + local len=#arr + LogError("长度:"..len) + local rage1=role.Rage*v1 + if rage1=v1 then + return + end + BattleUtil.RandomAction(p1, function () + curDamage=floor(damage-damage1) + if damagingFunc then damagingFunc(curDamage) end + time=time+1 + end) + + + end + role.Event:AddEvent(BattleEventName.FinalBeDamageEnd, onFinalBeDamage,nil,nil,role) + end, + } return passivityList diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Control.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Control.lua index 91d4d347d5..e41ab35af4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Control.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Control.lua @@ -52,7 +52,10 @@ function Control:OnEnd() self.target.lockTarget = nil self.target.ctrl_slient = false elseif self.ctrlType == 4 then --禁疗 - self.target.ctrl_noheal = false + local isHave=self.target:CheckHavePassive(315) + if not isHave then + self.target.ctrl_noheal = false + end elseif self.ctrlType == 5 then --致盲 self.target.ctrl_blind = false elseif self.ctrlType == 7 then --麻痹 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua index b42d1fc1c1..b5a823db14 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -166,6 +166,7 @@ BattleEventName = { DisposeRoleCtrl_noheal = indexAdd(),--处理角色禁疗 RoleBeExile = indexAdd(),--角色被放逐 RoleExileEnd = indexAdd(),--角色放逐结束 + RoleAddBuffFail = indexAdd(),--角色添加buff失败 } BattleMaxFrame = 1000000 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 8d1dd35252..b6d8a88fda 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -960,11 +960,14 @@ function BattleUtil.RandomControl(rand, ctrl, caster, target, round) caster.Event:DispatchEvent(BattleEventName.PassiveRandomControl, _CallBack, ctrl, target) target.Event:DispatchEvent(BattleEventName.PassiveBeRandomControl, _CallBack, ctrl, target) rand = BattleUtil.CountChangeList(rand, cl) - - return BattleUtil.RandomAction(rand, function() - local buff = Buff.Create(caster, BuffName.Control, round, ctrl) + local buff = Buff.Create(caster, BuffName.Control, round, ctrl) + local isAdd=BattleUtil.RandomAction(rand, function() target:AddBuff(buff) end) + if not isAdd then + BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff) + end + return isAdd end -- diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index add0627473..df6004b712 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -281,6 +281,7 @@ function RoleLogic:AddBuff(buff) for i=1, self.buffFilter.size do if self.buffFilter.buffer[i](buff,self) then BattleLogic.BuffMgr:PutBuff(buff) + BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self) return end end