【战斗】=============被动 108 200 283 322 修改 新增被动 337
parent
f247221fcc
commit
33b37451e1
|
|
@ -125,6 +125,9 @@ function EffectCaster:Cast()
|
|||
if count == 0 then
|
||||
count = #arr
|
||||
end
|
||||
table.sort(arr, function(a, b)
|
||||
return a.position < b.position
|
||||
end)
|
||||
-- 全部同时生效
|
||||
for j=1, count do
|
||||
if arr[j] and not arr[j]:IsRealDead() then
|
||||
|
|
|
|||
|
|
@ -1960,6 +1960,10 @@ local passivityList = {
|
|||
[108] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
|
||||
--damagetype为3 是 舍身济世分摊伤害
|
||||
if damageType==3 then
|
||||
return
|
||||
end
|
||||
--如果角色死亡就不会反弹伤害
|
||||
if role:IsDead() then
|
||||
return
|
||||
|
|
@ -3898,58 +3902,60 @@ local passivityList = {
|
|||
if not skill then
|
||||
return
|
||||
end
|
||||
-- 伤害降低
|
||||
local finalDamage = BattleUtil.CountValue(damage, f1, ct)
|
||||
local curHp = role:GetRoleData(RoleDataName.Hp)
|
||||
--如果敌方忽略分摊就只减伤
|
||||
local ignoreShara=atkRole.ignoreShara
|
||||
--特殊处理 白骨精附加的普攻不会忽略分摊
|
||||
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
|
||||
ignoreShara=false
|
||||
end
|
||||
if ignoreShara then
|
||||
local dd = damage - finalDamage
|
||||
damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
|
||||
return
|
||||
end
|
||||
-- 不是致死伤害
|
||||
if finalDamage < curHp then
|
||||
-- 找到除自身外的血量最高的两人
|
||||
local list = RoleManager.Query(function(v)
|
||||
return v.camp == role.camp and v.position ~= role.position
|
||||
end)
|
||||
local ff = 1 -- 分摊比
|
||||
-- 检测被动对分摊比的影响
|
||||
local cl = {}
|
||||
local function _CallBack(v, ct)
|
||||
if v then
|
||||
table.insert(cl, {v, ct})
|
||||
--BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime,function()
|
||||
-- 伤害降低
|
||||
local finalDamage = BattleUtil.CountValue(damage, f1, ct)
|
||||
local curHp = role:GetRoleData(RoleDataName.Hp)
|
||||
--如果敌方忽略分摊就只减伤
|
||||
local ignoreShara=atkRole.ignoreShara
|
||||
--特殊处理 白骨精附加的普攻不会忽略分摊
|
||||
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
|
||||
ignoreShara=false
|
||||
end
|
||||
if ignoreShara then
|
||||
local dd = damage - finalDamage
|
||||
damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
|
||||
return
|
||||
end
|
||||
-- 不是致死伤害
|
||||
if finalDamage < curHp then
|
||||
-- 找到除自身外的血量最高的两人
|
||||
local list = RoleManager.Query(function(v)
|
||||
return v.camp == role.camp and v.position ~= role.position
|
||||
end)
|
||||
local ff = 1 -- 分摊比
|
||||
-- 检测被动对分摊比的影响
|
||||
local cl = {}
|
||||
local function _CallBack(v, ct)
|
||||
if v then
|
||||
table.insert(cl, {v, ct})
|
||||
end
|
||||
end
|
||||
role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack,skill)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack,skill)
|
||||
ff = BattleUtil.CountChangeList(ff, cl)
|
||||
|
||||
-- 计算分摊伤害
|
||||
local fenDamage = finalDamage * ff -- 需要分摊的总伤害
|
||||
--根据血量百分比排序
|
||||
BattleUtil.SortByHpFactor(list, 0)
|
||||
local targets = {role, list[1], list[2]}
|
||||
local fd = floor(BattleUtil.ErrorCorrection(fenDamage/#targets)) -- 每个人需要分摊的伤害
|
||||
|
||||
-- 自身伤害
|
||||
if damagingFunc then
|
||||
local unFenDamage = floor(BattleUtil.ErrorCorrection(finalDamage * (1 - ff))) -- 不被分摊的伤害
|
||||
damagingFunc(floor(BattleUtil.ErrorCorrection(damage - (unFenDamage + fd))))
|
||||
end
|
||||
-- 平分给别人
|
||||
if fd > 0 then
|
||||
for i = 2, #targets do
|
||||
--不触发被动
|
||||
BattleUtil.FinalDamage(nil, atkRole, targets[i], fd, nil, 0, dotType)
|
||||
end
|
||||
end
|
||||
end
|
||||
role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack,skill)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack,skill)
|
||||
ff = BattleUtil.CountChangeList(ff, cl)
|
||||
|
||||
-- 计算分摊伤害
|
||||
local fenDamage = finalDamage * ff -- 需要分摊的总伤害
|
||||
--根据血量百分比排序
|
||||
BattleUtil.SortByHpFactor(list, 0)
|
||||
local targets = {role, list[1], list[2]}
|
||||
local fd = floor(BattleUtil.ErrorCorrection(fenDamage/#targets)) -- 每个人需要分摊的伤害
|
||||
|
||||
-- 自身伤害
|
||||
if damagingFunc then
|
||||
local unFenDamage = floor(BattleUtil.ErrorCorrection(finalDamage * (1 - ff))) -- 不被分摊的伤害
|
||||
damagingFunc(floor(BattleUtil.ErrorCorrection(damage - (unFenDamage + fd))))
|
||||
end
|
||||
-- 平分给别人
|
||||
if fd > 0 then
|
||||
for i = 2, #targets do
|
||||
--不触发被动
|
||||
BattleUtil.FinalDamage(nil, atkRole, targets[i], fd, nil, 0, dotType)
|
||||
end
|
||||
end
|
||||
end
|
||||
--end)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage,nil,nil,role)
|
||||
|
||||
|
|
@ -4261,7 +4267,7 @@ local passivityList = {
|
|||
damagingFunc(shareDamage)
|
||||
end
|
||||
-- 分担伤害
|
||||
BattleUtil.ApplyDamage(skill, atkRole, role, shareDamage,false,damageType,dotType,true)
|
||||
BattleUtil.ApplyDamage(skill, atkRole, role, shareDamage,false,3,dotType,true)
|
||||
end
|
||||
end
|
||||
BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage,nil,nil,role)
|
||||
|
|
@ -6288,7 +6294,9 @@ local passivityList = {
|
|||
if not num then
|
||||
num=1
|
||||
end
|
||||
|
||||
local onSkillCastEnd=function(skill)
|
||||
local fireNum=0
|
||||
if skill and not skill.isTriggerJudge and judge==1 then
|
||||
return
|
||||
end
|
||||
|
|
@ -6304,19 +6312,20 @@ local passivityList = {
|
|||
end
|
||||
--查找敌方燃烧数量
|
||||
if num==10 then
|
||||
num=0
|
||||
fireNum=0
|
||||
local arr=skill:GetDirectTargets()
|
||||
-- local arr=RoleManager.Query(function (v) return v.camp~=role.camp end)
|
||||
for i = 1, #arr do
|
||||
local aaa=BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType==1 end,role,1)
|
||||
if aaa then
|
||||
num=num+1
|
||||
fireNum=fireNum+1
|
||||
end
|
||||
end
|
||||
end
|
||||
list=BattleUtil.SortByRage(list,0)
|
||||
|
||||
for i = 1, #list do
|
||||
if i<=num then
|
||||
if i<=fireNum then
|
||||
BattleUtil.CalRage(role, list[i], v1, ct)
|
||||
end
|
||||
end
|
||||
|
|
@ -7332,6 +7341,9 @@ local passivityList = {
|
|||
return
|
||||
end
|
||||
if skill and skill.owner==role and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
if damage~=target.killDamage then
|
||||
return
|
||||
end
|
||||
local dmg= floor(BattleUtil.ErrorCorrection((damage-finalDmg)*f1))
|
||||
if target:IsDead() then
|
||||
allDamage=allDamage+dmg
|
||||
|
|
@ -7739,5 +7751,74 @@ local passivityList = {
|
|||
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role)
|
||||
|
||||
end,
|
||||
-- 直接伤害击杀目标后下回合必定暴击
|
||||
-- a[int]
|
||||
[337] = function(role, args,id,judge)
|
||||
|
||||
local currRound = 1
|
||||
local isKill=false
|
||||
local isRoundCrit=false
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and not skill.isTriggerJudge and judge==1 then
|
||||
return
|
||||
end
|
||||
--如果是技能并且这个被动已经被触发过 return
|
||||
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
|
||||
return
|
||||
end
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
currRound = BattleLogic.GetCurRound()
|
||||
isKill=true
|
||||
if skill then
|
||||
table.insert(skill.triggerPassivityId,id)
|
||||
end
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role)
|
||||
|
||||
local function onRoleDamageAfter(skill)
|
||||
if isRoundCrit then
|
||||
role.mustCrit = false
|
||||
role.Event:RemoveEvent(BattleEventName.SkillCastEnd, onRoleDamageAfter)
|
||||
end
|
||||
end
|
||||
local function onRoleDamageBefore(skill)
|
||||
if skill and not skill.isTriggerJudge and judge==1 then
|
||||
return
|
||||
end
|
||||
--最加的普攻不触发这个被动
|
||||
if skill.type==BattleSkillType.Normal and skill.isAdd then
|
||||
return
|
||||
end
|
||||
if isRoundCrit then
|
||||
role.mustCrit = true
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onRoleDamageAfter,nil,nil,role)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onRoleDamageBefore,nil,nil,role)
|
||||
|
||||
|
||||
local onRoundChange=function(round2)
|
||||
if round2==currRound+1 and isKill then
|
||||
isRoundCrit=true
|
||||
else
|
||||
isRoundCrit=false
|
||||
isKill=false
|
||||
end
|
||||
currRound=round2
|
||||
end
|
||||
|
||||
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange,nil,nil,role)
|
||||
|
||||
|
||||
local onRoundStart=function(round2)
|
||||
isKill=false
|
||||
end
|
||||
|
||||
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, onRoundStart,nil,nil,role)
|
||||
|
||||
|
||||
end,
|
||||
}
|
||||
return passivityList
|
||||
|
|
@ -515,7 +515,7 @@ function BattleUtil.Seckill(skill, atkRole, defRole)
|
|||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||
if finalDmg >= 0 then
|
||||
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
|
||||
defRole:SetDead()
|
||||
defRole:SetDead(damage)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole,skill)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
|
||||
|
|
@ -547,7 +547,7 @@ function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
|
|||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||
if finalDmg >= 0 then
|
||||
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
|
||||
defRole:SetDead()
|
||||
defRole:SetDead(damage)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
|
||||
|
|
@ -679,7 +679,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
|||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||
if finalDmg >= 0 then
|
||||
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
|
||||
defRole:SetDead()
|
||||
defRole:SetDead(damage)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
|
||||
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole,skill,dotType)
|
||||
|
|
@ -707,6 +707,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
|
|||
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- 战斗记录用
|
||||
|
|
@ -799,7 +800,6 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
|
|||
|
||||
-- 计算额外暴击伤害
|
||||
critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageFactor) - critDamageReduceFactor
|
||||
|
||||
--加入被动效果 触发暴击被动
|
||||
local critFunc = function(critEx) critDamageFactor = critEx end
|
||||
atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function RoleLogic:Init(uid, data, position)
|
|||
self.data:Init(self, data.property)
|
||||
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
|
||||
self.isRealDead = self.isDead
|
||||
|
||||
self.killDamage = 0 --致死伤害
|
||||
self.camp = data.camp --阵营 0:我方 1:敌方
|
||||
self.name = data.name
|
||||
self.element = data.element
|
||||
|
|
@ -560,8 +560,9 @@ function RoleLogic:SetDeadFilter(filter)
|
|||
self.deadFilter = filter
|
||||
end
|
||||
-- 要死了
|
||||
function RoleLogic:SetDead()
|
||||
function RoleLogic:SetDead(damage)
|
||||
self.isDead = true
|
||||
self.killDamage=damage
|
||||
RoleManager.AddDeadRole(self)
|
||||
end
|
||||
-- 判断是否死亡
|
||||
|
|
|
|||
Loading…
Reference in New Issue