back_recharge
gaojie 2019-05-13 15:01:42 +08:00
commit b625e6e810
5 changed files with 29 additions and 27 deletions

View File

@ -87,6 +87,7 @@ function BuffManager:AddBuff(target, buff)
--end
buff.frameInterval = floor(buff.interval * BattleLogic.GameFrameRate)
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
end
function BuffManager:HasBuff(target, type, checkFunc)

View File

@ -121,7 +121,7 @@ local passivityList = {
for i=1, skill.effectList.size do
duration = max(duration, skill.effectList.buffer[i].duration)
end
role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], duration)
role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], duration + BattleLogic.GameDeltaTime * 2)
end)
end
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
@ -187,7 +187,7 @@ local passivityList = {
local OnSkillCastEnd = function(skill)
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 10111)
local arr = chooseTarget(role, 10321)
if arr[1] then
arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, floor(role:GetRoleData(propertyList[pro]) * f2)))
end
@ -302,7 +302,7 @@ local passivityList = {
damagingFunc(floor(role:GetRoleData(propertyList[pro]) * f2))
end)
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
end,
--受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害
@ -351,7 +351,7 @@ local passivityList = {
BattleUtil.RandomAction(f1, function ()
local arr = chooseTarget(role, 20001)
if arr[1] then
BattleUtil.ApplyDamage(role, atkRole, floor(role:GetRoleData(propertyList[pro]) * f2))
BattleUtil.ApplyDamage(role, arr[1], floor(role:GetRoleData(propertyList[pro]) * f2))
end
end)
lastTrigger = 0
@ -521,7 +521,7 @@ local passivityList = {
[22] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local f3 = args[2]
local f3 = args[3]
local triggerCount = 0
local OnDamaged = function(atkRole)
@ -634,12 +634,12 @@ local passivityList = {
local f1 = args[1]
local f2 = args[2]
local OnRoleDamageBefore = function(defRole, factorFunc)
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleUtil.GetHPPencent(defRole) > f1 then
factorFunc(f2)
damagingFunc(-floor(f2 * damage))
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--对血量低于[a]的敌人伤害提高[b]。
@ -648,12 +648,12 @@ local passivityList = {
local f1 = args[1]
local f2 = args[2]
local OnRoleDamageBefore = function(defRole, factorFunc)
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
if BattleUtil.GetHPPencent(defRole) < f1 then
factorFunc(f2)
damagingFunc(-floor(f2 * damage))
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
end,
--发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒
@ -725,7 +725,7 @@ local passivityList = {
local OnPassiveDamaging = function(damagingFunc)
damagingFunc(-f1)
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging)
end,
--进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒
@ -825,10 +825,10 @@ local passivityList = {
[41] = function(role, args)
local f1 = args[1]
local OnDamaged = function(atkRole, damage, bCrit, finalDmg)
local OnDamage = function(defRole, damage, bCrit, finalDmg)
BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged)
role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage)
end,
--造成暴击伤害时,有[a]的概率造成[b]的暴击伤害。

View File

@ -35,6 +35,7 @@ BattleEventName = {
SkillCastEnd = indexAdd(),
PassiveTreating = indexAdd(),
PassiveBeDamaging = indexAdd(),
PassiveDamaging = indexAdd(),
PassiveCriting = indexAdd(),

View File

@ -75,20 +75,12 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType)
--加入被动效果
local damagingFunc = function(dmgDeduction) damage = damage - dmgDeduction end
defRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc)
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage)
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage)
if damage > 0 then
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg > 0 then
if atkRole then
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType)
end
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType)
if bCrit then
atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole)
defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole)
end
if defRole:GetRoleData(RoleDataName.Hp) <= 0 then
defRole.isDead = true
BattleLogic.BuffMgr:ClearBuff(defRole)
@ -100,6 +92,15 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType)
end)
end
end
if atkRole then
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType)
end
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType)
if bCrit then
atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole)
defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole)
end
end
return finalDmg
else
@ -190,8 +191,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
baseFactor = baseFactor or 1
local maxHp = targetRole:GetRoleData(RoleDataName.MaxHp)
local hp = targetRole:GetRoleData(RoleDataName.Hp)
local factor = castRole:GetRoleData(RoleDataName.TreatFacter) + 1
local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter) + 1
local factor = castRole:GetRoleData(RoleDataName.TreatFacter)
local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter)
local baseTreat = floor(value * baseFactor * factor * factor2 + 0.5)
--加入被动效果

View File

@ -154,7 +154,6 @@ function RoleLogic:AddBuff(buff)
return
end
end
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
BattleLogic.BuffMgr:AddBuff(self, buff)
end