sync battle
parent
747f844281
commit
5bfdf0486c
|
@ -246,48 +246,53 @@ function BuffManager:Update()
|
|||
end
|
||||
end
|
||||
|
||||
-- 每一个人的轮次都刷新
|
||||
function BuffManager:TurnUpdate(sort)
|
||||
-- 计算buff 剩余步数(根据当前回合人刷新其造成的所有buff回合数)
|
||||
function BuffManager:PassUpdate()
|
||||
local curCamp, curPos = BattleLogic.GetCurTurn()
|
||||
for i=1, self.buffDic.size do
|
||||
local buffList = self.buffDic.vList[i]
|
||||
if buffList.size > 0 then
|
||||
local index = 1
|
||||
while index <= buffList.size do
|
||||
for index = 1, buffList.size do
|
||||
local buff = buffList.buffer[index]
|
||||
local curCamp, curPos = BattleLogic.GetCurTurn()
|
||||
if buff.sort == sort -- 当前buff刷新等级
|
||||
and buff.target.camp == curCamp -- 当前阵营
|
||||
and buff.target.position == curPos then -- 当前位置
|
||||
--印记类型的buff不处理更新逻辑
|
||||
if buff.roundDuration == 0 and buff.roundInterval < 0 then
|
||||
else
|
||||
buff.roundPass = buff.roundPass + 1
|
||||
if buff.roundDuration == 0 then
|
||||
if buff.roundInterval == 0 or buff.roundPass % buff.roundInterval == 0 then
|
||||
if not buff:OnTrigger() then
|
||||
buff.disperse = true
|
||||
end
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffTrigger, buff)
|
||||
end
|
||||
elseif buff.roundInterval < 0 then
|
||||
if buff.roundPass >= buff.roundDuration then
|
||||
buff.disperse = true
|
||||
end
|
||||
else
|
||||
if buff.roundInterval == 0 or buff.roundPass % buff.roundInterval == 0 then
|
||||
if not buff:OnTrigger() then
|
||||
buff.disperse = true
|
||||
end
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffTrigger, buff)
|
||||
end
|
||||
if buff.roundPass >= buff.roundDuration then
|
||||
buff.disperse = true
|
||||
end
|
||||
end
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffRoundChange, buff)
|
||||
if not buff.disperse -- 没过期
|
||||
and buff.caster.camp == curCamp -- 释放者是当前轮到的人
|
||||
and buff.caster.position == curPos then
|
||||
buff.roundPass = buff.roundPass + 1
|
||||
if buff.roundPass >= buff.roundDuration then
|
||||
buff.disperse = true
|
||||
end
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffRoundChange, buff)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 每一个人的轮次都刷新
|
||||
function BuffManager:TurnUpdate(sort)
|
||||
local curCamp, curPos = BattleLogic.GetCurTurn()
|
||||
for i=1, self.buffDic.size do
|
||||
local buffList = self.buffDic.vList[i]
|
||||
if buffList.size > 0 then
|
||||
for index = 1, buffList.size do
|
||||
local buff = buffList.buffer[index]
|
||||
if not buff.disperse -- 没有过期
|
||||
and buff.sort == sort -- 当前buff刷新等级
|
||||
and buff.target.camp == curCamp -- 当前阵营
|
||||
and buff.target.position == curPos then -- 当前位置
|
||||
--触发buff
|
||||
if buff.roundInterval >= 0 then
|
||||
if buff.roundInterval == 0 or buff.roundPass % buff.roundInterval == 0 then
|
||||
if not buff:OnTrigger() then
|
||||
buff.disperse = true
|
||||
end
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffTrigger, buff)
|
||||
end
|
||||
else
|
||||
buff.disperse = true
|
||||
end
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2225,28 +2225,39 @@ local passivityList = {
|
|||
-- [130] = {},
|
||||
|
||||
|
||||
-- 敌方每[a]改变[b]人自身[c]就[d]改变[e]% (敌方每死亡i1个则自身属性改变)
|
||||
-- a[改变类型]b[int]c[属性]d[改变类型]e[float]
|
||||
-- 敌方每[a]改变[b]人自身伤害就[d]改变[e]% (敌方每死亡i1个则自身属性改变)
|
||||
-- a[改变类型]b[int]d[改变类型]e[float]
|
||||
[131] = function(role, args)
|
||||
local ct1 = args[1]
|
||||
local i1 = args[2]
|
||||
local pro = args[3]
|
||||
local ct2 = args[4]
|
||||
local f1 = args[5]
|
||||
local ct2 = args[3]
|
||||
local f1 = args[4]
|
||||
|
||||
local deadNum = 0
|
||||
local extra = 0
|
||||
-- 释放技能后
|
||||
local OnDead = function(deadRole)
|
||||
if deadRole.camp == (role.camp + 1)%2 then
|
||||
deadNum = deadNum + 1
|
||||
if deadNum >= i1 then
|
||||
deadNum = 0
|
||||
local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, ct2)
|
||||
role:AddBuff(buff)
|
||||
extra = extra + f1
|
||||
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, ct2)
|
||||
-- role:AddBuff(buff)
|
||||
end
|
||||
end
|
||||
end
|
||||
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead)
|
||||
|
||||
local passivityDamaging = function(func, caster, damage, skill)
|
||||
if skill then
|
||||
if func then
|
||||
local dd = BattleUtil.CountValue(damage, extra, ct2) - damage
|
||||
func(-floor(BattleUtil.ErrorCorrection(dd)))
|
||||
end
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
|
||||
end,
|
||||
|
||||
-- 无132
|
||||
|
@ -2524,7 +2535,7 @@ local passivityList = {
|
|||
|
||||
local index, tran
|
||||
local OnRoleDamageBefore = function(target, factorFunc, damageType, skill)
|
||||
if skill.type == BattleSkillType.Special and
|
||||
if skill and skill.type == BattleSkillType.Special and
|
||||
BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
index, tran = role:AddPropertyTransfer(propertyList[pro], f1, propertyList[pro], ct)
|
||||
end
|
||||
|
@ -2546,17 +2557,20 @@ local passivityList = {
|
|||
local ct = args[3]
|
||||
|
||||
local onPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
if damagingFunc then
|
||||
damagingFunc(-floor(BattleUtil.FP_Mul(f1, damage)))
|
||||
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
if damagingFunc then
|
||||
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
|
||||
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
|
||||
end
|
||||
end
|
||||
end
|
||||
local onSkillCast = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
if skill.type == BattleSkillType.Normal then
|
||||
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
|
||||
end
|
||||
end
|
||||
local onSkillCastEnd = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
if skill.type == BattleSkillType.Normal then
|
||||
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
|
||||
end
|
||||
end
|
||||
|
@ -2612,8 +2626,34 @@ local passivityList = {
|
|||
-- a[float]b[持续伤害状态]c[float]
|
||||
-- [149]
|
||||
|
||||
-- 同 114
|
||||
-- [150]
|
||||
-- 技能对[a]目标当次伤害提升[b]%,[c]改变
|
||||
-- a[持续伤害状态]b[flaot]c[改变类型]
|
||||
[150] = function(role, args)
|
||||
local dot = args[1]
|
||||
local f1 = args[2]
|
||||
local ct = args[3]
|
||||
|
||||
local onPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
if damagingFunc then
|
||||
local dd = BattleUtil.CountValue(damage, f1, ct) - damage
|
||||
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
|
||||
end
|
||||
end
|
||||
end
|
||||
local onSkillCast = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
|
||||
end
|
||||
end
|
||||
local onSkillCastEnd = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
|
||||
end,
|
||||
|
||||
-- TODO
|
||||
-- 释放普通攻击如目标[a],且血量低于[b]%则有[c]%概率秒杀
|
||||
|
|
|
@ -68,7 +68,7 @@ function RoleData:AddPencentValue(name, pencent)
|
|||
end
|
||||
|
||||
function RoleData:SubDeltaValue(name, delta)
|
||||
if delta < 0 or not self.data[name] then --delta必须非负
|
||||
if not delta or delta < 0 or not self.data[name] then --delta必须非负
|
||||
return 0
|
||||
end
|
||||
if self.data[name] then
|
||||
|
|
|
@ -251,6 +251,8 @@ function BattleLogic.TurnRound(debugTurn)
|
|||
if cpos == 0 then
|
||||
-- 保存当前释放技能的位置
|
||||
CurSkillPos[CurCamp] = cpos
|
||||
-- 刷新异妖buff轮数(暂时不用)
|
||||
-- BattleLogic.BuffMgr:PassUpdate()
|
||||
-- 检测异妖技能释放
|
||||
BattleLogic.CheckTeamSkillCast(CurCamp)
|
||||
else
|
||||
|
@ -267,6 +269,7 @@ function BattleLogic.TurnRound(debugTurn)
|
|||
end
|
||||
|
||||
-- 如果当前位置不能释放技能也需要走buff轮转
|
||||
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
|
||||
BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
|
||||
BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
|
||||
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
|
||||
|
@ -278,14 +281,15 @@ function BattleLogic.TurnRound(debugTurn)
|
|||
return
|
||||
end
|
||||
|
||||
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart)
|
||||
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart) -- 开始行动
|
||||
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
|
||||
BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
|
||||
BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
|
||||
-- 释放技能后,递归交换阵营
|
||||
SkillRole:CastSkill(function()
|
||||
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
|
||||
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
|
||||
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd)
|
||||
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd) -- 行动结束
|
||||
BattleLogic.TurnRound()
|
||||
end)
|
||||
end
|
||||
|
|
|
@ -33,6 +33,7 @@ function RoleLogic:Init(uid, data, position)
|
|||
|
||||
self.camp = data.camp --阵营 0:我方 1:敌方
|
||||
self.name = data.name
|
||||
self.element = data.element
|
||||
|
||||
self.shield:Clear() --护盾列表
|
||||
self.exCalDmgList:Clear() --额外计算伤害列表
|
||||
|
@ -69,9 +70,13 @@ function RoleLogic:Init(uid, data, position)
|
|||
for j = 2, #v do
|
||||
args[j-1] = v[j]
|
||||
end
|
||||
BattleUtil.Passivity[id](self, args)
|
||||
-- 加入被动列表
|
||||
table.insert(self.passiveList, {id, args})
|
||||
if BattleUtil.Passivity[id] then
|
||||
BattleUtil.Passivity[id](self, args)
|
||||
-- 加入被动列表
|
||||
table.insert(self.passiveList, {id, args})
|
||||
else
|
||||
print("被动技能"..id.."不存在")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue