From 76d9e596b40c23d0b48e24f24e3e873bc09baece Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 23 Dec 2021 14:37:19 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=E8=A2=AB?= =?UTF-8?q?=E5=8A=A8412=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 52 ++++++++++++++++++- .../Modules/Battle/Logic/Role/RoleManager.lua | 6 ++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 1ff07fbe3d..b9b22e6c83 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -10607,7 +10607,57 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.RecordBuff, buffBeAdd,nil,nil,role) end, - + --我方神将阵亡后,为随机1个存活神将添加[a]类型[b]效果,持续[c]回合,每场战斗最多触发[d]次,每回合最多触发[e]次 + --a[int],b[int],c[int],d[int],e[int] + [412]=function(role,args,id,judge) + local t1=args[1] + local t2=args[2] + local r1=args[3] + local t3=args[4] + local t4=args[5] + local maxTime=0 + local rTime=0 + if PassiveManager.passiveCountList[role.camp][id] and PassiveManager.passiveCountList[role.camp][id] > 0 then + return + end + PassiveManager.passiveCountList[role.camp][id] = 1 + local RoleVanish=function(deader) + BattleLogic.WaitForTrigger(2,function() + if deader.camp~=role.camp then + return + end + BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () + if maxTime>=t3 then + return + end + if rTime>=t4 then + return + end + local arr=RoleManager.Query(function(v) return v.camp==role.camp and not BattleUtil.CheckIsNoDead(v) end) + if arr==nil or #arr==0 then + return + end + local index = Random.RangeInt(1, #arr) + if arr[index] then + -- local caster=RoleManager.GetRole() + -- caster:Init(role.uid,role.roleData,role.position) + -- caster.type=BattleUnitType.Monster + local buff=Buff.Create(deader,t1,r1,t2,0) + arr[index]:AddBuff(buff) + maxTime=maxTime+1 + rTime=rTime+1 + end + end) + end) + end + --即使被放逐也会同样生效 + BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead,RoleVanish) + + local onBattleRoundChange = function(func, caster) + rTime=0 + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange) + end, } diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua index 0feaadff65..e672f1013d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua @@ -51,6 +51,10 @@ function this.AddRole(roleData, position) BattleLogic.Event:DispatchEvent(BattleEventName.AddRole, role) end end +function this.GetRole() + local role = rolePool:Get() + return role +end -- @@ -117,7 +121,7 @@ function this.CheckDead() for _, pos in ipairs(removePos) do table.insert(RealDeadList,_DeadRoleList[pos]) BattleLogic.WaitForTrigger(1,function() - BattleLogic.Event:DispatchEvent(BattleEventName.RoleIsVanish,RealDeadList) + BattleLogic.Event:DispatchEvent(BattleEventName.RoleIsVanish,RealDeadList,_DeadRoleList[pos]) end) _DeadRoleList[pos] = nil end