[战斗]=========被动增加 316-321
parent
da33b98dfb
commit
501140fa52
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<len*v2 then
|
||||
rage1=len*v2
|
||||
end
|
||||
local num1=floor(rage1/len)
|
||||
local num2=rage1%len
|
||||
LogError("每人回点数:"..num1.." 多出来的点数:"..num2)
|
||||
for i = 1, len do
|
||||
if i<=num2 then
|
||||
BattleUtil.CalRage(role, arr[i],num1+1, CountTypeName.Add)
|
||||
else
|
||||
BattleUtil.CalRage(role,arr[i],num1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDead, OnDead,nil,nil,role)
|
||||
end,
|
||||
--普攻额外回复怒气增加[a]点
|
||||
--a[int]
|
||||
[320] = function(role, args,id,judge)
|
||||
local v1 = args[1]
|
||||
|
||||
local OnRageGrow = function(rage,growFunc)
|
||||
if growFunc then
|
||||
growFunc(rage+v1)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleRageGrow, OnRageGrow,nil,nil,role)
|
||||
end,
|
||||
--[a]%概率受到的直接伤害变成[b],每回合最多触发[c]次
|
||||
--a[float],b[int],c[int]
|
||||
[321] = function(role, args,id,judge)
|
||||
local p1 = args[1]
|
||||
local damage1=args[2]
|
||||
local v1 =args[3]
|
||||
local curRound=1
|
||||
local time=0
|
||||
local curDamage = 0
|
||||
local function onRoundChange(round)
|
||||
if round==curRound+1 then
|
||||
time=0
|
||||
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
|
||||
if time>=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
|
||||
|
|
|
|||
|
|
@ -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 --麻痹
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ BattleEventName = {
|
|||
DisposeRoleCtrl_noheal = indexAdd(),--处理角色禁疗
|
||||
RoleBeExile = indexAdd(),--角色被放逐
|
||||
RoleExileEnd = indexAdd(),--角色放逐结束
|
||||
RoleAddBuffFail = indexAdd(),--角色添加buff失败
|
||||
}
|
||||
|
||||
BattleMaxFrame = 1000000
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
--
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue