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