fight sync

back_recharge
wangyuan 2019-06-06 17:23:18 +08:00
parent 7fcd9ec264
commit dec631ed02
3 changed files with 74 additions and 38 deletions

View File

@ -139,22 +139,7 @@ local effectList = {
local ct = args[3]
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.RandomAction(f2, function ()
if target.skill then
if f1 == 0 then --值为0时直接清除CD
target.skill.sp = target.skill.spPass
else
if ct == 1 then --加算
target.skill.sp = max(target.skill.sp - floor(f1 * BattleLogic.GameFrameRate), 0)
elseif ct == 2 then --乘加算(百分比属性加算)
target.skill.sp = max(target.skill.sp - floor(target.skill.spPass * f1),0)
elseif ct == 3 then --减算
target.skill.sp = min(target.skill.sp + floor(f1 * BattleLogic.GameFrameRate), target.skill.spPass)
elseif ct == 4 then --乘减算(百分比属性减算)
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
end
end
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
end
target:AddSkillCD(f1, ct)
end)
end)
end,
@ -539,27 +524,9 @@ local effectList = {
local d = args[4]
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.RandomAction(f2, function ()
local func = function()
if target.skill then
if f1 == 0 then --值为0时直接清除CD
target.skill.sp = target.skill.spPass
else
if ct == 1 then --加算
target.skill.sp = max(target.skill.sp - floor(f1 * BattleLogic.GameFrameRate), 0)
elseif ct == 2 then --乘加算(百分比属性加算)
target.skill.sp = max(target.skill.sp - floor(target.skill.spPass * f1),0)
elseif ct == 3 then --减算
target.skill.sp = min(target.skill.sp + floor(f1 * BattleLogic.GameFrameRate), target.skill.spPass)
elseif ct == 4 then --乘减算(百分比属性减算)
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
end
end
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
end
end
func()
target:AddSkillCD(f1, ct)
local trigger = function(skill) --新增监听事件在印记技能结束回调时移除印记buff可覆盖旧buff
func()
target:AddSkillCD(f1, ct)
end
target.Event:AddEvent(BattleEventName.SkillCast, trigger)
target:AddBuff(Buff.Create(caster, BuffName.Brand, d, "cd", function ()
@ -715,7 +682,7 @@ local effectList = {
BattleUtil.CalDamage(caster, target, dt, f1)
if target.isDead then
BattleUtil.RandomAction(f4, function ()
caster.skill.sp = caster.skill.spPass
caster:AddSkillCD(0)
end)
end
end)

View File

@ -156,7 +156,7 @@ function Skill:Cast()
end
self.owner.Event:DispatchEvent(BattleEventName.SkillCast, self)
else
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self.cd) --队伍技能结构和其他相同只是cd项为对应异妖类型
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self.cd, self.owner.camp) --队伍技能结构和其他相同只是cd项为对应异妖类型
end
--技能的施法时间计算根据当前目标id关联的持续时间取其中时间最长的一个

View File

@ -6,6 +6,7 @@ RoleLogic.__index = RoleLogic
local Random = Random
local floor = math.floor
local max = math.max
local min = math.min
local Passivity = require("Modules/Battle/Logic/Base/Passivity")
local skillPool = BattleObjectPool.New(function ()
@ -134,6 +135,74 @@ function RoleLogic:GetSkillCD()
return cd
end
function RoleLogic:AddSkillCD(value, type)
self.Event:DispatchEvent(BattleEventName.RoleCDChanged)
if value == 0 then --为0直接清CD
if self.skill and not self.superSkill then
self.skill.sp = self.skill.spPass
elseif not self.skill and self.superSkill then
self.superSkill.sp = self.superSkill.spPass
elseif self.skill and self.superSkill then
self.skill.sp = self.skill.spPass
self.superSkill.sp = self.superSkill.spPass
end
return
end
local cdTotal = 0
if self.skill and not self.superSkill then
cdTotal = self.skill.spPass
elseif not self.skill and self.superSkill then
cdTotal = self.superSkill.spPass
elseif self.skill and self.superSkill then
if self.superSkill.sp >= self.superSkill.spPass then --滑技cd生效加点技cd否则加滑技cd+点技cd
cdTotal = self.skill.spPass
else
cdTotal = self.superSkill.spPass + self.skill.spPass
end
end
local delta = 0
if type == 1 then --加算
delta = floor(value * BattleLogic.GameFrameRate)
elseif type == 2 then --乘加算(百分比属性加算)
delta = floor(value * cdTotal)
elseif type == 3 then --减算
delta = -floor(value * BattleLogic.GameFrameRate)
elseif type == 4 then --乘减算(百分比属性减算)
delta = -floor(value * cdTotal)
end
if delta > 0 then --加cd加cd最大值
if self.skill and not self.superSkill then
self.skill.spPass = self.skill.spPass + delta
elseif not self.skill and self.superSkill then
self.superSkill.spPass = self.superSkill.spPass + delta
elseif self.skill and self.superSkill then
if self.superSkill.sp < self.superSkill.spPass then --滑技cd没好加滑技cd否则加点技cd
self.superSkill.spPass = self.superSkill.spPass + delta
else
self.skill.spPass = self.skill.spPass + delta
end
end
else --减cd减cd当前值
delta = -delta
if self.skill and not self.superSkill then
self.skill.sp = min(self.skill.sp + delta, self.skill.spPass)
elseif not self.skill and self.superSkill then
self.superSkill.sp = min(self.superSkill.sp + delta, self.superSkill.spPass)
elseif self.skill and self.superSkill then
if delta <= self.superSkill.spPass - self.superSkill.sp then
self.superSkill.sp = self.superSkill.sp + delta
else
delta = delta - self.superSkill.spPass + self.superSkill.sp --滑技cd不够减继续减点技cd
self.superSkill.sp = self.superSkill.spPass
self.skill.sp = self.skill.sp + delta
end
end
end
end
function RoleLogic:GetRoleData(property)
local tarPro = self.data:GetData(property)
local item