From f89526d96a65af37756d8a16750995a44bde87b4 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 6 Jan 2022 15:30:40 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=3D=3D=E8=A2=AB=E5=8A=A8=E6=96=B0=E5=A2=9E=20414=20-417?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 98 +++++++++++++++++++ .../Battle/Logic/Misc/BattleDefine.lua | 1 + .../Modules/Battle/Logic/Misc/BattleUtil.lua | 24 ++++- .../Modules/Battle/View/Unit/EnemyView.lua | 5 +- .../Modules/Battle/View/Unit/PlayerView.lua | 5 +- 5 files changed, 128 insertions(+), 5 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index f43f3d48ad..49b8597000 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -10658,6 +10658,104 @@ local passivityList = { --a[int],b[float],c[属性],d[int] [413] =function(role,args,id,judge) end, + --释放技能后随机[a]次目标,每次改变[b]目标[c]点怒气 + --a[int],b[int],c[int] + [414]=function(role,args,id,judge) + local t1 = args[1] + local ct = args[2] + local num = args[3] + + local OnSkillCastEnd = function(skill) + + if skill and not skill.isTriggerJudge and judge==1 then + return + end + local arr=RoleManager.Query(function(v) return v.camp~=role.camp end) + if arr==nil or #arr==0 then + return + end + for i = 1, t1 do + + local index = Random.RangeInt(1, #arr) + BattleUtil.CalRage(role,arr[index],num,ct) + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,nil,nil,role) + end, + --[a]%的概率免疫一次伤害,每个英雄每场战斗仅触发[b]次 + --a[float],b[int] + [415] = function(role,args,id,judge) + local pro= args[1] + local num=args[2] + local time=0 + local checkDamage=function(func,atkRole,defRole) + if time>=num then + return + end + BattleUtil.RandomAction(pro,function() + if func then + func(true) + role.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Immune) + time=time+1 + end + end) + end + role.Event:AddEvent(BattleEventName.CheckDamageIsImmune,checkDamage,nil,nil,role) + end, + --攻击时,自身生命百分比[a]于目标,造成的伤害[b]改变[c]% + --a[int 1:高于 2:低于 ],b[int],c[float] + [416]=function(role,args,id,judge) + local type=args[1] + local ct=args[2] + local v1=args[3] + + local finalDamage=function(func, defRole, damage, skill) + + local atk=BattleUtil.GetHPPencent(role) + local def=BattleUtil.GetHPPencent(defRole) + if type==1 and atk<=def then + return + end + + if type==2 and atk>=def then + return + end + + local add=damage-floor(BattleUtil.CountValue(damage,v1,ct)) + if func then + func(add) + end + end + role.Event:AddEvent(BattleEventName.FinalDamage,finalDamage,nil,nil,role) + end, + --生命百分比低于[a]%时触发,[b]改表[c]属性[d]%,[e]改变[f]属性[g]%,持续[h]回合,每场战斗触发[i]次 + --a[float],b[int],c[int],d[float],e[int],f[int],g[float],h[int],i[int] + [417]=function(role,args,id,judge) + local pro=args[1] + local ct1=args[2] + local p1 =args[3] + local v1 =args[4] + local ct2=args[5] + local p2 =args[6] + local v2 =args[7] + local round=args[8] + local num=args[9] + local time=0 + local onRoleBeDamage=function() + if time>=num then + return + end + local atk=BattleUtil.GetHPPencent(role) + if atk= 0 then @@ -805,7 +810,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy end atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, dotType, skill) - defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill,isImmune) BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, bCrit, finalDmg, damageType, dotType, skill) BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill) if bCrit then @@ -874,6 +879,11 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri defRole.Event:DispatchEvent(BattleEventName.CheckLiZhanZhiQu, damagingFunc, atkRole, realDamage, skill, dotType, bCrit, damageType,isDirect) --LogError("最后扣除伤害=="..realDamage) --御甲过滤后的伤害只会处理扣血 by: wangzhenxing shihongyi 2021/09/27 + local isImmune=BattleUtil.CheckDamageIsImmune(atkRole,defRole) + if isImmune then + realDamage=0 + damage=0 + end local finalDmg = defRole.data:SubValue(RoleDataName.Hp,realDamage) if finalDmg >= 0 then if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then @@ -884,7 +894,7 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri end atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, dotType, skill) - defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill,isImmune) BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, bCrit, finalDmg, damageType, dotType, skill) BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill) if bCrit then @@ -924,8 +934,16 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri return finalDmg end +--检测伤害是否免疫 +function BattleUtil.CheckDamageIsImmune(atkRole,defRole) + local isImmune=false - + local GetIsImmune=function(isTrue) + isImmune=isTrue + end + defRole.Event:DispatchEvent(BattleEventName.CheckDamageIsImmune,GetIsImmune,atkRole,defRole) + return isImmune +end --执行完整的命中,伤害,暴击计算,返回命中,暴击 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua index c8be2df422..5f9a05295d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/EnemyView.lua @@ -459,7 +459,10 @@ local DotTypeTip = { [3] = Language[10244], } -- -function EnemyView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType, skill) +function EnemyView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType, skill,isImmune) + if isImmune and isImmune==true then + return + end if skill then -- 技能配置 local combatId = BattleManager.GetCombatIdBySkin(skill.id, atkRole.roleData.skinId) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua index 426e23a3a0..45e9558d4e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/PlayerView.lua @@ -533,7 +533,10 @@ local DotTypeTip = { [3] = Language[10244], } -- -function PlayerView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType, skill) +function PlayerView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType, skill,isImmune) + if isImmune and isImmune==true then + return + end if skill then -- 技能配置 local combatId = BattleManager.GetCombatIdBySkin(skill.id, atkRole.roleData.skinId)