【战斗】================增加313被动

dev_chengFeng
wangzhenxing 2021-04-25 15:46:08 +08:00
parent 959a40bca9
commit 26d50be57c
2 changed files with 63 additions and 0 deletions

View File

@ -6833,5 +6833,44 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster,nil,nil,role)
end,
-- 根据生命百分比添加被动 血量百分比[a],被动id[b],...(后面没有的不配)
-- a[float],b[int],c[float],d[int],e[float],f[int],g[float],h[int]
[313] = function(role, args)
local p1 = args[1]
local pass1 = args[2]
local p2 = args[3]
local pass2 = args[4]
local p3 =args[5]
local pass3 = args[6]
local p4 =args[7]
local pass4 = args[8]
--已经添加过的被动id
local passTable={}
if pass1 and p1 then
table.insert(passTable,{pass1,p1})
end
if pass2 and p2 then
table.insert(passTable, {pass2,p2})
end
if pass3 and p3 then
table.insert(passTable,{pass3,p3})
end
if pass4 and p4 then
table.insert(passTable,{pass4,p4})
end
local len=BattleUtil.LengthOfTable(passTable)
local addIds={}
-- 释放技能后
local onRoleBeDamaged = function(caster, damage)
local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
for key, value in pairs(passTable) do
if ft<value and not BattleUtil.ChecklistIsContainValue(passTable,key) then
role:AddPassiveById(key)
table.insert(addIds,key)
end
end
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged,nil,nil,role)
end,
}
return passivityList

View File

@ -106,6 +106,29 @@ function RoleLogic:Init(uid, data, position)
end
-- 根据被动id添加被动
function RoleLogic:AddPassiveById(id)
local config=ConfigManager.GetConfigData(ConfigName.PassiveSkillLogicConfig,id)
if not config then
return
end
local value=config.Value
if not value then
return
end
local args={}
local skills = string.split(value,"#")
if not skills then
return
end
for i = 1, #skills do
args[i]=skills[i]
end
-- 被动生效
BattleUtil.Passivity[id](self, args,id,config.Judge)
-- 加入被动列表
table.insert(self.passiveList, {id, args,id,args})
end
-- 添加一个被动技能
function RoleLogic:AddPassive(id, args, isRepeat)
--判断是否可以叠加
@ -122,6 +145,7 @@ function RoleLogic:AddPassive(id, args, isRepeat)
-- 加入被动列表
table.insert(self.passiveList, {id, args})
end
--
function RoleLogic:CanCastSkill()
return self.sp >= self.spPass and not self.IsDebug