From 37c8d8f6a8b5dc7961b81037533e69011b5c94b0 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Wed, 3 Aug 2022 14:20:57 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/Logic/Base/Buff.lua | 1 + .../Modules/Battle/Logic/Base/Passivity.lua | 145 +++++++++++++++++- .../~Lua/Modules/Battle/Logic/Buff/Blood.lua | 6 + .../Modules/Battle/Logic/Buff/Suppress.lua | 34 ++++ .../Battle/Logic/Buff/Suppress.lua.meta | 7 + .../Battle/Logic/Misc/BattleDefine.lua | 1 + .../Modules/Battle/Logic/Misc/BattleUtil.lua | 8 + .../Modules/Battle/Logic/Role/RoleLogic.lua | 1 + .../Modules/Battle/View/Unit/BuffCtrl.lua | 18 +++ .../Modules/Battle/View/Unit/EnemyView.lua | 3 +- .../Modules/Battle/View/Unit/PlayerView.lua | 3 +- 11 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua create mode 100644 Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua.meta diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua index 9a2cd90a7e..2c82dee87e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua @@ -21,6 +21,7 @@ local BuffRegister = { [BuffName.CommonSign] = "CommonSign", [BuffName.BreakArmor] = "BreakArmor", [BuffName.AddAttack] = "AddAttack", + [BuffName.Suppress] = "Suppress", } diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 0f1d9e1ee2..4ee66ac880 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -10807,8 +10807,11 @@ local passivityList = { local v1=args[2] local p2=args[3] local v2=args[4] - if target~=role and target.camp==role.camp and not BattleUtil.CheckIsNoDead(target) then + if not role:IsDead() and target~=role and target.camp==role.camp and not BattleUtil.CheckIsNoDead(target) then BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime*2, function () + if role==nil then + return + end local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1]) * v1)) local tv2 = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p2]) * v2)) BattleUtil.FinalTreat(role,role,tv) @@ -11398,7 +11401,147 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, OnSkillCastEnd,nil,nil,role) end, + --敌方处于[a]状态的神将,己方神将造成伤害时,额外造成[b]属性[c]%的伤害,每回合同一神将最多受[d]次额外伤害 + --a[int],b[int],c[float],d[int] + [440]=function(role, args,id,judge) + local type=args[1] + local pro=args[2] + local v1=args[3] + local max=args[4] + local heroTimes={} + local onPassiveBeDamaging = function(func, atkRole, defRole, damage, skill) + if not skill then + return + end + if skill and not skill.isTriggerJudge and judge==1 then + return + end + + if BattleLogic.BuffMgr:HasBuff(defRole, type, function(buff) return true end) then + local isBoss=BattleUtil.CheckIsBoss(defRole) + if isBoss and pro==12 then + return + end + if heroTimes[defRole.position] and heroTimes[defRole.position]>=max then + return + end + local val = floor(BattleUtil.FP_Mul(v1, defRole:GetRoleData(BattlePropList[pro]))) + BattleUtil.FinalDamageCountShield(nil,role,defRole, val) + if heroTimes[defRole.position] then + heroTimes[defRole.position]=heroTimes[defRole.position]+1 + else + heroTimes[defRole.position]=1 + end + end + end + BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveBeDamaging,nil,nil,role) + local onRoundEnd=function() + heroTimes={} + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundEnd,onRoundEnd,nil,nil,role) + end, + -- 释放技能后降低目标[a]点怒气(如果目标处于[b][c][d][e][f][g]类型的buff) + -- a[int],b[int],c[int],d[int],e[int],f[int],g[int] + [441] = function(role, args,id,judge) + local v1 = args[1] + local t1 = args[2] + local t2 = args[3] + local t3 = args[4] + local t4 = args[5] + local t5 = args[6] + local t6 = args[7] + local types={} + if t1 then + table.insert(types,t1) + end + if t2 then + table.insert(types,t2) + end + if t3 then + table.insert(types,t3) + end + if t4 then + table.insert(types,t4) + end + if t5 then + table.insert(types,t5) + end + if t6 then + table.insert(types,t6) + end + -- 释放技能后 + local onSkillEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special then + local list = skill:GetDirectTargetsNoMiss() + if list then + for i = 1, #list do + -- BattleUtil.CalRage(role, list[i], i1, CountTypeName.Sub) + local isAdd=false + for key, value in pairs(types) do + if not isAdd and BattleLogic.BuffMgr:HasBuff(list[i],value) then + BattleUtil.CalRage(role, list[i], v1, CountTypeName.Sub) + isAdd=true + end + end + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) + end, + --敌方处于[a]类型[b]状态的单位死亡,有[c]*己方[d]阵营存活数的概率,将效果转移,持续[e]回合给目标周围有[f][g][h][i]类型效果的神将 + --a[int],b[int],c[int],d[int],e[float],f[int] + [442]=function(role,args,id,judge) + local t1=args[1] + local t2=args[2] + local pro=args[3] + local ele=args[4] + local round=args[5] + local t3=args[6] + local t4=args[7] + local t5=args[8] + local t6=args[9] + local types={} + if t3 then + table.insert(types,t3) + end + if t4 then + table.insert(types,t4) + end + if t5 then + table.insert(types,t5) + end + if t6 then + table.insert(types,t6) + end + local onRoleDead=function(defRole, atkRole) + if defRole and defRole.camp==role.camp then + return + end + if BattleUtil.CheckIsNoDead(defRole) then + return + end + local arr = RoleManager.QueryIncludeExile(function(v) return role.camp == v.camp and v.element==ele end) + BattleUtil.RandomAction(pro*#arr,function() + local list = RoleManager.GetNeighbor(defRole, 1) + for i=1, #list do + for key, value in pairs(types) do + if BattleLogic.BuffMgr:HasBuff(list[i],value) then + list[i]:AddBuff(Buff.Create(role, t1, round)) + break + end + end + end + end) + + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead,onRoleDead,nil,nil,role) + + end, } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua index 0e4a40e838..25a8f74dad 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua @@ -14,6 +14,9 @@ function Blood:AddValue(value) local passiveChange=function(addValue) value=value+addValue end + if self.target==nil then + return + end BattleLogic.Event:DispatchEvent(BattleEventName.BloodValuePassiveChange,passiveChange,self.target,self.caster,value) self.bloodValue=self.bloodValue+value self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp),1,value) @@ -48,6 +51,9 @@ end --计算血甲 function Blood:CountBloodValue(damage,atkRole) local finalDamage=0 + if self.target==nil then + return + end self.bloodValue=self.bloodValue-damage if self.bloodValue<=0 then self.disperse=true diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua new file mode 100644 index 0000000000..afe8eae363 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua @@ -0,0 +1,34 @@ +Suppress = Buff:New() --压制 + +--初始化Buff,通过传入一些自定义参数控制成长相关的数值 +function Suppress:SetData(...) + -- self.atkType, --1 物理 2.魔法 + -- self.ct, + -- self.value1=... + -- 刷新排序等级 + self.sort = 4 +end + + +--初始化后调用一次 +function Suppress:OnStart() + + self.target.isSuppress=true +end + +--间隔N帧触发,返回true时表示继续触发,返回false立刻触发OnEnd +function Suppress:OnTrigger() + return true +end + +--效果结束时调用一次 +function Suppress:OnEnd() + self.target.isSuppress=false +end + +--只有当cover字段为true时触发,返回true则被新效果覆盖 +function Suppress:OnCover(newBuff) + return true +end + +return Suppress \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua.meta b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua.meta new file mode 100644 index 0000000000..ec3c86f1d5 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Suppress.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2f60a02f48ba9e84cb05e2a714c0a407 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua index b9dfadea7b..c163414839 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -284,6 +284,7 @@ BuffName = { CommonSign = 16, BreakArmor = 17, AddAttack = 18, + Suppress = 19, } DotType = { diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 8b489ada7e..1de9413fe8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -459,6 +459,11 @@ function BattleUtil.ChooseTarget(role, chooseId,queryType) -- return aaa elseif chooseWeight ==16 then --(血量百分比 含不灭) BattleUtil.SortByHpFactor(arr, sort) + elseif chooseWeight ==17 then --怒气 + if sort~=0 then + --BattleUtil.SortByProp(arr, RoleDataName.Hp, sort) + BattleUtil.SortByRage(arr, sort) + end end local finalArr = {} if num == 0 then @@ -785,6 +790,9 @@ function BattleUtil.CalRage(caster, target, value, countType,isBorrow) then return end + if (countType==1 or countType==2) and target.isSuppress and caster~=target then + return + end local lastRage=target.Rage --如果每回合减的怒气超过了每回合上限就不再减怒 if (countType==3 or countType==4) and target.RoundMaxSubRage~=0 and target.RoundMaxSubRage<=target.AllSubRage then diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index 4bfe32697e..c5d07ab2f9 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -90,6 +90,7 @@ function RoleLogic:Init(uid, data, position) self.ctrl_blind = false --致盲 self.ctrl_chaos = false --混乱 self.deadFilter = true -- 控制死亡,置为false则角色暂时无法死亡 + self.isSuppress = false self.isExile = false --是否放逐 self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果 self.reliveHPF = 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/BuffCtrl.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/BuffCtrl.lua index 135296d70b..9dfcca8b70 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/BuffCtrl.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/BuffCtrl.lua @@ -16,6 +16,7 @@ local BuffTypeToConfigType = { [BuffName.CommonSign] = 13, [BuffName.BreakArmor] = 14, [BuffName.AddAttack] = 15, + [BuffName.Suppress] = 16, } local function _GetPropChangeBuffCType(pName) for cType, pn in ipairs(BattlePropList) do @@ -62,6 +63,8 @@ local function _GetBuffEffectConfig(buff) cType = 1 elseif bType==BuffName.BreakArmor then cType=buff.signType + elseif bType==BuffName.Suppress then + cType=1 else cType = 1 end @@ -252,6 +255,11 @@ function BuffCtrl:AddBuffIcon(buff, icon) self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1) return end + elseif buffType ==BuffName.Suppress then + -- if self.BuffIconList[key].buffSignType==currBuff.signType then + self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1) + return + --end end end end @@ -362,6 +370,16 @@ function BuffCtrl:RemoveBuffIcon(buff) end return end + elseif buffType == BuffName.Suppress then + --if self.BuffIconList[key].buffSignType==buff.signType then + if floor==1 then + self.BuffIconList[key]:Dispose() + self.BuffIconList[key] = nil + else + self.BuffIconList[key]:SetCount(floor-1) + end + return + --end else self.BuffIconList[key]:Dispose() self.BuffIconList[key] = nil diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua index 0ee314ab91..3e57b336cc 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua @@ -733,12 +733,13 @@ function EnemyView:onRoleRelive() self.Floater:ImageBuffFloating("z_zhandou_fuhuo_zh") end) + end function EnemyView:onDispose() self.spLoader:Destroy() - + self.role.Event:RemoveEvent(BattleEventName.BloodValueChange,self.OnBloodValueChange,self) self.GameObject.transform.parent.localScale = Vector3.one self.Floater:Dispose() diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua index 272a9f144d..76e4a7e6f2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua @@ -266,6 +266,7 @@ end -- type==1 增加 function PlayerView:OnBloodValueChange(value,type,num) + self.yujiaSlider.fillAmount = value if type and num then if type==1 then @@ -819,7 +820,7 @@ end function PlayerView:onDispose() self.GameObject.transform.parent.localScale = Vector3.one - + self.role.Event:RemoveEvent(BattleEventName.BloodValueChange,self.OnBloodValueChange,self) self.spLoader:Destroy() self.Floater:Dispose()