Merge branch 'master' of 60.1.1.230:backend/jieling_server

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/db/redis/RedisKey.java
back_recharge
wangyuan 2020-05-09 17:08:14 +08:00
commit d394985b52
11 changed files with 378 additions and 120 deletions

View File

@ -164,6 +164,23 @@ function BuffManager:QueryBuff(target, checkFunc)
end
end
function BuffManager:GetBuff(target, checkFunc)
local blist = {}
for i=1, self.buffDic.size do
local list = self.buffDic.vList[i]
for j=1, list.size do
local buff = list.buffer[j]
if buff.target == target then
if not checkFunc or checkFunc(buff)then
table.insert(blist, buff)
end
end
end
end
return blist
end
function BuffManager:HasBuff(target, type, checkFunc)
if self.buffDic.kvList[type] then
local buffList = self.buffDic.kvList[type]

View File

@ -2117,7 +2117,18 @@ local effectList = {
local f1 = args[1]
local i1 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local buff = Buff.Create(caster, BuffName.Curse, i1, CurseTypeName.ShareDamage, f1)
local cl = {}
local function _CallBack(v, ct)
if v then
table.insert(cl, {v, ct})
end
end
caster.Event:DispatchEvent(BattleEventName.Curse_ShareDamage, _CallBack)
target.Event:DispatchEvent(BattleEventName.Be_Curse_ShareDamage, _CallBack)
local f = BattleUtil.CountChangeList(f1, cl)
local buff = Buff.Create(caster, BuffName.Curse, i1, CurseTypeName.ShareDamage, f)
target:AddBuff(buff)
end)
end,

View File

@ -1127,7 +1127,7 @@ local passivityList = {
BattleLogic.WaitForTrigger(f4, function ()
triggerUid[atkRole.uid] = atkRole.uid
BattleUtil.CalDamage(nil, role, atkRole, dt, f2)
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f3, ct))
BattleUtil.RandomControl(1, ct, role, atkRole, f3)
triggerUid[atkRole.uid] = nil
end)
end)
@ -1213,7 +1213,7 @@ local passivityList = {
end
if defRole.camp == role.camp then
BattleUtil.CalDamage(nil, role, atkRole, dt, f1)
atkRole:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
BattleUtil.RandomControl(1, ControlType.Dizzy, role, atkRole, f2)
end
end)
end,
@ -1245,7 +1245,7 @@ local passivityList = {
BattleLogic.WaitForTrigger(f3, function ()
local arr = BattleUtil.ChooseTarget(role, 20000)
for i=1, #arr do
arr[i]:AddBuff(Buff.Create(role, BuffName.Control, f2, 1))
BattleUtil.RandomControl(1, ControlType.Dizzy, role, arr[i], f2)
end
end)
end)
@ -1635,16 +1635,18 @@ local passivityList = {
local dt = args[3]
-- 释放技能后
local onSkillEnd = function(skill)
BattleUtil.RandomAction(f1, function()
BattleLogic.WaitForTrigger(0.1, function()
local list = RoleManager.Query(function(v)
return v.camp == (role.camp + 1) % 2
if skill and skill.type == BattleSkillType.Special then
BattleUtil.RandomAction(f1, function()
BattleLogic.WaitForTrigger(0.1, function()
local list = RoleManager.Query(function(v)
return v.camp == (role.camp + 1) % 2
end)
for _, r in ipairs(list) do
BattleUtil.CalDamage(nil, role, r, dt, f2)
end
end)
for _, r in ipairs(list) do
BattleUtil.CalDamage(nil, role, r, dt, f2)
end
end)
end)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
@ -1667,15 +1669,35 @@ local passivityList = {
-- a[float]
[99] = function(role, args)
local f1 = args[1]
local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType)
local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
BattleUtil.SortByHpFactor(arr, 1)
-- 检测技能伤害治疗加成
local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1])
-- 治疗血量最低队友实际伤害的f1%
BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(finalDmg*f)))
local allDamage = 0
local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.type == BattleSkillType.Special then
allDamage = allDamage + finalDmg
end
end
role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
local function onSkillCast(skill)
if skill.type == BattleSkillType.Special then
allDamage = 0
role.Event:AddEvent(BattleEventName.RoleHit, OnHit)
end
end
local function onSkillCastEnd(skill)
if skill.type == BattleSkillType.Special then
role.Event:RemoveEvent(BattleEventName.RoleHit, OnHit)
local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
BattleUtil.SortByHpFactor(arr, 1)
-- 检测技能伤害治疗加成
local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1])
-- 治疗血量最低队友实际伤害的f1%
BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(allDamage*f)))
-- 清空伤害记录
allDamage = 0
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
@ -1849,10 +1871,10 @@ local passivityList = {
table.insert(cl, {v, ct})
end
end
caster.Event:DispatchEvent(BattleEventName.PassiveRebackDamage, _CallBack)
role.Event:DispatchEvent(BattleEventName.PassiveRebackDamage, _CallBack)
caster.Event:DispatchEvent(BattleEventName.PassiveBeRebackDamage, _CallBack)
rDamage = floor(BattleUtil.ErrorCorrection(BattleUtil.CountChangeList(rDamage, cl)))
BattleUtil.ApplyDamage(nil, role, caster, rDamage)
end
end
@ -2117,7 +2139,6 @@ local passivityList = {
end,
-- TODO 减伤盾效果未添加
-- 释放技能后给己方前排武将附加减伤盾持续时间[a]改变[b]回合
-- a[改变类型]b[int]
[122] = function(role, args)
@ -2140,7 +2161,6 @@ local passivityList = {
end,
--TODO 减伤盾效果未添加
-- 释放技能后给己方前排附加减伤盾效果[a]改变[b]%
-- a[改变类型]b[float]
[123] = function(role, args)
@ -2516,7 +2536,7 @@ local passivityList = {
local dt = args[1]
local f1 = args[2]
local tFactor = function(factorFunc)
factorFunc(dt, f1)
factorFunc(f1, dt)
end
role.Event:AddEvent(BattleEventName.SkillCast, function(skill)
if skill.type == BattleSkillType.Special then
@ -2750,14 +2770,14 @@ local passivityList = {
local onBattleRoundChange = function(func, caster)
attor = {}
end
role.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange)
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange)
-- 被动技能加伤害
local onDamaging = function(func, target, damage, skill)
if attor[target.position] and skill and func then
if attor[target.position] and skill and skill.type == BattleSkillType.Special and func then
local df = f1
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
df = df + f2
df = f2
end
local dd = BattleUtil.CountValue(damage, df, ct) - damage
func(-floor(BattleUtil.ErrorCorrection(dd)))
@ -2805,10 +2825,10 @@ local passivityList = {
local f2 = args[3]
--
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.type == BattleSkillType.Normal then
if skill and skill.type == BattleSkillType.Normal and not skill.isAdd and not defRole:IsDead() then
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
-- 检测被动技能对秒杀参数得影响
local bf, kf = BattleUtil.CheckSeckill(f1, f2, caster, target)
local bf, kf = BattleUtil.CheckSeckill(f1, f2, role, defRole)
--
local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
if ft < bf then
@ -2887,7 +2907,7 @@ local passivityList = {
local df = 1 - lf -- 血量降低百分比 = 1 - 当前血量百分比
local level = floor(df/f1)
if treatFactorFunc then
treatFactorFunc(ct, BattleUtil.ErrorCorrection(level*f2))
treatFactorFunc(BattleUtil.ErrorCorrection(level*f2), ct)
end
end
role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor)
@ -2989,7 +3009,7 @@ local passivityList = {
[161] = function(role, args)
local f1 = args[1]
local function onPassiveDamaging(damagingFunc, target, damage)
local list = BattleLogic.BuffMgr:QueryBuff(target, function(buff)
local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
return buff.type == BuffName.DOT or buff.type == BuffName.Control
end)
if list and damagingFunc then
@ -3001,6 +3021,47 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
-- 当敌方目标处于链接符状态(主动技能110效果时受到链接符传导效果提高[a]%
-- a[float]
[162] = function(role, args)
local f1 = args[1]
local onCurse_ShareDamage = function(func)
if func then func(f1, CountTypeName.Add) end
end
role.Event:AddEvent(BattleEventName.Curse_ShareDamage, onCurse_ShareDamage)
end,
-- 每当对方拥有链接符的目标死亡时,都会使己方输出型武将技能伤害提高[a]%[b]元素输出武将提高[c]%)
-- a[float]b[元素]c[float]
[163] = function(role, args)
local f1 = args[1]
local ele = args[2]
local f2 = args[3]
-- 死亡数量
local num = 0
local onBattleRoleDead = function(defRole)
--
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
num = num + 1
end
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, onBattleRoleDead)
-- 伤害提高
local function onPassiveDamaging(damagingFunc, atkRole, defRole, damage)
if atkRole.professionId == 2 and atkRole.camp == role.camp then
-- 地元素特殊
local f = atkRole.element == ele and f2 or f1
local dd = BattleUtil.CountValue(damage, f * num, CountTypeName.AddPencent) - damage
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
-- 爆伤减免增加[a]%[b]改变
-- a[float]b[改变类型]
@ -3086,7 +3147,7 @@ local passivityList = {
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = RoleManager.Query(function(v) return v.camp == role.camp end)
BattleUtil.SortByHpFactor(list, 1)
BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
local index = 0
for i = 1, #list do
if not list[i]:IsRealDead() and index < 2 then
@ -3122,8 +3183,8 @@ local passivityList = {
local f1 = args[1]
local dt = args[2]
-- 直接伤害后
local onRoleHit = function(target)
if target:IsDead() then
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
if skill and not skill.isAdd and target:IsDead() then
local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
BattleUtil.SortByHpFactor(list, 1)
local index = 0
@ -3155,7 +3216,7 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
local onPassiveRandomControl = function(func, ctrl2)
if ctrl == ctrl2 then
if ctrl == 0 or ctrl == ctrl2 then
if func then func(af, ct) end
end
end
@ -3179,7 +3240,7 @@ local passivityList = {
local f1 = args[1]
local ct = args[2]
local PassiveSkillDamageHeal = function(func)
local onPassiveSkillDamageHeal = function(func)
if func then func(f1, ct) end
end
role.Event:AddEvent(BattleEventName.PassiveSkillDamageHeal, onPassiveSkillDamageHeal)
@ -3228,13 +3289,13 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
local onPassiveRandomDot = function(func, dot2)
if dot == dot2 then
local onPassiveShield = function(func, shieldType)
if shieldType == ShieldTypeName.RateReduce then
if func then func(af, ct) end
end
end
role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
role.Event:AddEvent(BattleEventName.PassiveShield, onPassiveShield)
end,
-- 技能治疗效果提升[a]%, 同时为每个技能目标附加减伤盾,减伤效果[b]%,持续[c]回合
@ -3284,12 +3345,12 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
local onPassiveShield = function(func, shieldType)
if shieldType == ShieldTypeName.RateReduce then
local onPassiveRandomDot = function(func, dot2)
if dot == dot2 then
if func then func(af, ct) end
end
end
role.Event:AddEvent(BattleEventName.PassiveShield, onPassiveShield)
role.Event:AddEvent(BattleEventName.PassiveRandomDot, onPassiveRandomDot)
end,
-- 对别人造成的中毒伤害的[a]%用于治疗自己
@ -3315,7 +3376,7 @@ local passivityList = {
local ct = args[3]
local onPassiveBeRandomControl = function(func, ctrl2, target)
if ctrl == ctrl2 then
if ctrl == 0 or ctrl == ctrl2 then
if func then func(f1, ct) end
end
end
@ -3369,8 +3430,8 @@ local passivityList = {
local dot = args[1]
local onBuffCaster = function(buff)
if buff.type == BuffName.DOT and buff.dotType == dot then
role:AddBuff(Buff.Create(role, BuffName.Control, buff.duration, ControlType.NoHeal))
if buff.type == BuffName.DOT and buff.damageType == dot then
BattleUtil.RandomControl(1, ControlType.NoHeal, role, buff.target, buff.duration)
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
@ -3383,7 +3444,7 @@ local passivityList = {
local i1 = args[2]
local onBuffCaster = function(buff)
if buff.type == BuffName.DOT and buff.dotType == dot then
if buff.type == BuffName.DOT and buff.damageType == dot then
buff:ChangeBuffDuration(CountTypeName.Add, i1)
end
end
@ -3398,13 +3459,34 @@ local passivityList = {
local onRoleHit = function(target)
if target:IsDead() then
local target = RoleManager.GetAggro(role)
local target = RoleManager.GetAliveAggro(role)
BattleUtil.CalDamage(nil, role, target, 1, f1)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 直接伤害击杀目标对仇恨目标追加一次造成[a]%物理伤害的技能
-- a[float]
-- [185] = function(role, args)
-- local f1 = args[1]
-- local onRoleHit = function(target)
-- if target:IsDead() then
-- local skill = {
-- role.skill[1], -- 技能id
-- {
-- 400000, -- chooseId
-- role.skill[2][2], -- 效果时间
-- {1, f1, 1} -- 效果id及参数
-- }
-- }
-- SkillManager.AddSkill(role, skill, BattleSkillType.Normal, nil, true, false)
-- end
-- end
-- role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
-- end,
-- 攻击纵排目标时额外降低目标[a]点怒气
-- a[int]
@ -3487,8 +3569,10 @@ local passivityList = {
damagingFunc(floor(BattleUtil.ErrorCorrection(damage - (unFenDamage + fd))))
end
-- 平分给别人
for i = 2, #targets do
BattleUtil.FinalDamage(skill, atkRole, targets[i], fd, nil, 0, dotType)
if fd > 0 then
for i = 2, #targets do
BattleUtil.FinalDamage(skill, atkRole, targets[i], fd, nil, 0, dotType)
end
end
end
end
@ -3502,13 +3586,30 @@ local passivityList = {
local dot = args[1]
local onBuffCaster = function(buff)
if buff.type == BuffName.DOT and buff.dotType == dot then
role:AddBuff(Buff.Create(role, BuffName.Immune, buff.duration, 4))
if buff.type == BuffName.DOT and buff.damageType == dot then
buff.target:AddBuff(Buff.Create(role, BuffName.Immune, buff.duration, 3))
end
end
role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
end,
-- 所有攻击优先攻击敌方[a]最少的单位
-- a[属性]
[190] = function(role, args)
local pro = args[1]
local function onSkillTargetCheck(func)
local list = RoleManager.Query(function(r)
return r.camp == (role.camp + 1) % 2
end)
list = BattleUtil.SortByProp(list, BattlePropList[pro], 1)
if list and #list > 0 then
if func then func({list[1]}) end
end
end
role.Event:AddEvent(BattleEventName.SkillTargetCheck, onSkillTargetCheck)
end,
-- 技能直接伤害[a]%转化为生命治疗自己
-- a[float]
[191] = function(role, args)
@ -3571,7 +3672,8 @@ local passivityList = {
if not arr then return end
for i = 1, 3 do
if arr[i] and arr[i] == target then
treatingFunc(f1, ct)
local atk = role:GetRoleData(RoleDataName.Attack)
treatingFunc(atk * f1, ct)
end
end
end
@ -3584,7 +3686,7 @@ local passivityList = {
[194] = function(role, args)
local f1 = args[1]
local OnSkillCastEnd = function(skill)
local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill)
local targets = skill:GetDirectTargets()
if not targets or #targets == 0 then return end
local cf = f1/#targets
@ -3596,16 +3698,16 @@ local passivityList = {
end)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
end,
-- 首回合免疫[a]效果
-- a[控制状态]
[195] = function(role, args)
local dot = args[1]
local ctrl = args[1]
local immune = function(buff)
return buff.type == BuffName.DOT and (dot == 0 or buff.dotType == dot)
return buff.type == BuffName.Control and (ctrl == 0 or buff.ctrlType == ctrl)
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
@ -3632,21 +3734,21 @@ local passivityList = {
local onDamageBeShare = function(func)
if func then func(f1, CountTypeName.Sub) end
end
role.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare)
role.Event:AddEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare)
end,
-- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气(输出武将佩戴)
-- a[float]
[197] = function(role, args)
local f1 = args[1]
local onRoleHit = function(target)
if target:IsDead() then
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.type == BattleSkillType.Special and target:IsDead() then
BattleUtil.RandomAction(f1, function()
role:AddRage(target.rage, CountTypeName.Add)
role:AddRage(target.Rage, CountTypeName.Add)
end)
end
end
role.Event:DispatchEvent(BattleEventName.RoleHit, onRoleHit)
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
-- 受到的[a]效果伤害降低[b]%(与减伤盾原理相同)[c]改变
@ -3657,13 +3759,13 @@ local passivityList = {
local ct = args[3]
-- 释放技能后
local onPassiveDamaging = function(damagingFunc, defRole, damage, skill, dotType)
local onPassiveBeDamaging = function(damagingFunc, defRole, damage, skill, dotType)
if dotType and (dotType == dot or dot == 0) then
local dd = damage - BattleUtil.CountValue(damage, f1, ct)
damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging)
end,
@ -3674,18 +3776,16 @@ local passivityList = {
local f1 = args[1]
local curDamage = 0
local function onBattleRoundChange()
local function onRoundChange()
curDamage = 0
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange)
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange)
local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
local maxDamage = role:GetRoleData(RoleDataName.MaxHp) * f1
curDamage = curDamage + damage
if curDamage < maxDamage then
if damagingFunc then damagingFunc(damage) end
else
if curDamage > maxDamage then
-- 计算免除的伤害值
local md = curDamage - maxDamage
if md > damage then
@ -3699,12 +3799,32 @@ local passivityList = {
end,
-- 同阵营武将受到直接伤害时该伤害[a]%转移给有此锦囊的武将转移伤害属于直接伤害(无法触发任何特性)
-- a[float]
[200] = function(role, args)
local f1 = args[1]
local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
if skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then
local shareDamage = floor(BattleUtil.ErrorCorrection(damage * f1))
-- 被攻击武将自身伤害
if damagingFunc then
damagingFunc(shareDamage)
end
-- 分担伤害
BattleUtil.ApplyDamage(nil, atkRole, role, shareDamage)
end
end
BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage)
end,
-- 初始怒气增加[a]点并且目标血量低于[b]%时即有概率秒杀(对应秒杀技能)
-- a[int]b[float]
[200] = function(role, args)
[201] = function(role, args)
local i1 = args[1]
local f1 = args[2]
role.data:CountValue(RoleDataName.InitRage, i1, CountTypeName.Add)
role:AddRage(i1, CountTypeName.Add)
local function onPassiveSeckill(func)
if func then func(f1, CountTypeName.Cover) end
@ -3714,7 +3834,7 @@ local passivityList = {
-- 秒杀概率增加[a]%直接伤害击杀的[b]目标有[c]%概率无法复活触发秒杀的目标[d]%无法复活,秒杀概率[e]改变
-- a[float]b[持续伤害状态]c[float]d[float]e[改变类型]
[201] = function(role, args)
[202] = function(role, args)
local f1 = args[1]
local dot = args[2]
local f2 = args[3]
@ -3730,7 +3850,7 @@ local passivityList = {
-- 直接伤害概率无法复活
local function onRoleHit(target)
if target:IsDead() then
if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.dotType == dot or dot == 0 end) then
if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.damageType == dot or dot == 0 end) then
BattleUtil.RandomAction(f2, function()
target:SetReliveFilter(false)
end)
@ -3753,6 +3873,45 @@ local passivityList = {
-- 初始怒气增加[a]点敌方处于连接符状态的目标在回合结束时有[b]概率减少[c]点怒气
-- a[int]b[int]
[203] = function(role, args)
local i1 = args[1]
local f1 = args[2]
local i2 = args[3]
-- 初始怒气增加
role:AddRage(i1, CountTypeName.Add)
-- 死亡数量
local onRoleTurnEnd = function(target)
if not target:IsDead() and BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
BattleUtil.RandomAction(f1, function()
target:AddRage(i2, CountTypeName.Sub)
end)
end
end
BattleLogic.Event:AddEvent(BattleEventName.RoleTurnEnd, onRoleTurnEnd)
end,
-- 敌方处于连接符状态的目标在获得无敌盾时有[a]%概率获取失败
-- a[float]
[204] = function(role, args)
local f1 = args[1]
-- 死亡数量
local onRoleAddBuffMiss = function(func, target, buff)
-- 无敌盾
if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce then
-- 有连接符
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
-- 提高miss概率
if func then func(f1, CountTypeName.Add) end
end
end
end
BattleLogic.Event:AddEvent(BattleEventName.RoleAddBuffMiss, onRoleAddBuffMiss)
end,
-- 伤害增加[a]%[b]改变
-- a[float]b[改变类型]

View File

@ -122,6 +122,13 @@ function Skill:Cast(func)
local effectGroup = self.effectList.buffer[i]
local chooseId = effectGroup.chooseId
self.effectTargets[i] = BattleUtil.ChooseTarget(self.owner, chooseId)
-- 检测被动对攻击目标的影响
if i == 1 then
local function _PassiveTarget(targets)
self.effectTargets[i] = targets
end
self.owner.Event:DispatchEvent(BattleEventName.SkillTargetCheck, _PassiveTarget)
end
end
end

View File

@ -209,7 +209,8 @@ function BattleLogic.TurnRound(debugTurn)
end
-- 行动
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart) -- 开始行动
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
-- 释放技能后,递归交换阵营
@ -217,7 +218,8 @@ function BattleLogic.TurnRound(debugTurn)
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd) -- 行动结束
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 行动结束
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 开始行动
BattleLogic.TurnRoundNextFrame()
end)
end

View File

@ -11,7 +11,7 @@ function Curse:SetData(curseType, ...)
self.sort = 4
end
--
function Curse:ShareDamageTrigger(atkRole, defRole, damage, skill, dotType, bCrit, damageType)
function Curse:ShareDamageTrigger(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
if skill and defRole.camp == self.target.camp then
-- 没有此印记的队友收到伤害
if not BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then
@ -23,7 +23,9 @@ function Curse:ShareDamageTrigger(atkRole, defRole, damage, skill, dotType, bCri
-- 计算收到的伤害
local f1 = self.args[1] --平分伤害的百分比
local sd = math.floor(BattleUtil.ErrorCorrection(damage * f1 / #sdList))
BattleUtil.ApplyDamage(nil, atkRole, self.target, sd)
if sd ~= 0 then
BattleUtil.ApplyDamage(nil, atkRole, self.target, sd)
end
end
end
end

View File

@ -70,6 +70,7 @@ BattleEventName = {
PassiveBeRandomDot = indexAdd(),
PassiveRebackDamage = indexAdd(),
PassiveBeRebackDamage = indexAdd(),
PassiveSkillDamageHeal = indexAdd(),
PassiveBeSkillDamageHeal = indexAdd(),
@ -90,6 +91,8 @@ BattleEventName = {
RoleViewBullet = indexAdd(), --弹道飞行击中表现
RoleAddBuffMiss = indexAdd(),
BuffCaster = indexAdd(),
BuffStart = indexAdd(),
BuffDodge = indexAdd(),
@ -102,8 +105,12 @@ BattleEventName = {
ShildValueChange = indexAdd(),
Curse_ShareDamage = indexAdd(),
Be_Curse_ShareDamage = indexAdd(),
SkillTargetCheck = indexAdd(),
DebugStop = indexAdd(),
}

View File

@ -289,14 +289,18 @@ function BattleUtil.Seckill(skill, atkRole, defRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.SecKill, defRole)
defRole.Event:DispatchEvent(BattleEventName.BeSecKill, atkRole)
BattleLogic.Event:DispatchEvent(BattleEventName.SecKill, atkRole, defRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole)
defRole.Event:DispatchEvent(BattleEventName.BeSeckill, atkRole)
BattleLogic.Event:DispatchEvent(BattleEventName.Seckill, atkRole, defRole)
end
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, false, finalDmg, 0, false, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, false, finalDmg, 0, false, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, false, finalDmg, 0, false, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, false, finalDmg, 0, false, skill)
if skill then
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, nil, finalDmg, nil, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, nil, finalDmg, nil, skill)
end
end
end
@ -321,6 +325,7 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
end
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage, skill, dotType, bCrit)
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit)
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit)
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage)
@ -332,40 +337,37 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
end
atkRole.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamage, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
BattleLogic.Event:DispatchEvent(BattleEventName.FinalDamage, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
BattleLogic.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
--
return BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType)
end
function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType)
if damage >= 0 then
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead()
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
end
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill)
if bCrit then
atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole, damage, bCrit, finalDmg, damageType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole, damage, bCrit, finalDmg, damageType, skill)
end
if not dotType then
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill)
end
if damage < 0 then damage = 0 end
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead()
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
end
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, bCrit, finalDmg, damageType, dotType, skill)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill)
if bCrit then
atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole, damage, bCrit, finalDmg, damageType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole, damage, bCrit, finalDmg, damageType, skill)
end
if skill then
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill)
end
return finalDmg
else
return damage
end
return finalDmg
end
--执行完整的命中,伤害,暴击计算,返回命中,暴击
@ -483,7 +485,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
local hp = targetRole:GetRoleData(RoleDataName.Hp)
-- 计算被动对治疗系数的影响
local treatFactorFunc = function(dt, df)
local treatFactorFunc = function(df, dt)
baseFactor = BattleUtil.CountValue(baseFactor, df, dt)
end
castRole.Event:DispatchEvent(BattleEventName.PassiveTreatingFactor, treatFactorFunc, targetRole)
@ -491,7 +493,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
local factor = castRole.isTeam and 1 or castRole:GetRoleData(RoleDataName.TreatFacter) --释放者为team则不计算治疗加成属性
local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter)
local baseTreat = floor(BattleUtil.FP_Mul(value, baseFactor, factor, factor2) + 0.5)
local baseTreat = BattleUtil.FP_Mul(value, baseFactor, factor, factor2)
--加入被动效果
local cl = {}
@ -506,7 +508,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
baseTreat = BattleUtil.CountChangeList(baseTreat, cl)
-- 取整
local baseTreat = floor(baseTreat + 0.5)
local treat = min(baseTreat, maxHp - hp)
if treat > 0 then

View File

@ -1,4 +1,3 @@
RoleLogic = {}
RoleLogic.__index = RoleLogic
--local RoleLogic = RoleLogic
@ -36,6 +35,7 @@ function RoleLogic:Init(uid, data, position)
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
self.element = data.element
self.professionId = data.professionId
self.shield:Clear() --护盾列表
self.exCalDmgList:Clear() --额外计算伤害列表
@ -54,7 +54,7 @@ function RoleLogic:Init(uid, data, position)
-- 初始化怒气值默认2
self.Rage = 2 + self:GetRoleData(RoleDataName.InitRage)-- 当前怒气值
self.Rage = 2
self.RageGrow = 2 -- 普通技能怒气成长
self.SuperSkillRage = 4 -- 技能需要释放的怒气值默认为4
self.NoRageRate = 0 -- 不消耗怒气值的概率
@ -79,6 +79,10 @@ function RoleLogic:Init(uid, data, position)
end
end
-- 初始怒气值放在被动之后计算,使被动对初始怒气的影响生效
self.Rage = self.Rage + self:GetRoleData(RoleDataName.InitRage)-- 当前怒气值
--
self.aiOrder = data.ai
self.aiIndex = 1
self.aiTempCount = 0
@ -221,13 +225,28 @@ function RoleLogic:AddBuff(buff)
BattleLogic.BuffMgr:PutBuff(buff)
return
end
for i=1, self.buffFilter.size do
if self.buffFilter.buffer[i](buff) then
BattleLogic.BuffMgr:PutBuff(buff)
return
-- buff的miss率
local missF = 0
-- 检测被动对miss概率的影响
local cl = {}
local function _CallBack(v, ct)
if v then
table.insert(cl, {v, ct})
end
end
BattleLogic.BuffMgr:AddBuff(self, buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffMiss, _CallBack, self, buff)
missF = BattleUtil.CountChangeList(missF, cl)
-- 如果概率为0 或者没有miss
if missF == 0 or not BattleUtil.RandomAction(missF, function() BattleLogic.BuffMgr:PutBuff(buff) end) then
for i=1, self.buffFilter.size do
if self.buffFilter.buffer[i](buff) then
BattleLogic.BuffMgr:PutBuff(buff)
return
end
end
BattleLogic.BuffMgr:AddBuff(self, buff)
end
end
function RoleLogic:Dispose()
@ -401,6 +420,8 @@ end
function RoleLogic:GoDead()
if self:IsCanDead() then
self.isRealDead = true
self.Rage = 0
BattleLogic.BuffMgr:ClearBuff(self)
self.Event:DispatchEvent(BattleEventName.RoleRealDead, self)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleRealDead, self)
return true
@ -415,7 +436,6 @@ end
-- 要死了
function RoleLogic:SetDead()
self.isDead = true
BattleLogic.BuffMgr:ClearBuff(self)
RoleManager.AddDeadRole(self)
end
-- 判断是否死亡

View File

@ -177,11 +177,43 @@ function this.GetAggro(role)
for i = startPos + 1, c*3+3 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsRealDead() then
target = PosList[pos]
break
end
end
if target then return target end
end
end
-- 获取没有进入死亡状态的仇恨目标
function this.GetAliveAggro(role)
-- 计算开始位置
local startPos = role.position
startPos = startPos > 3 and startPos - 3 or startPos
local target
local enemyCamp = role.camp == 0 and 1 or 0
-- c=0 前排 c=1 后排
for c = 0, 1 do
startPos = startPos + c*3
-- 向左
for i = startPos, c*3+1, -1 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsDead() then
target = PosList[pos]
break
end
end
if target then return target end
-- 向右
for i = startPos + 1, c*3+3 do
local pos = i + enemyCamp * 6
if PosList[pos] and not PosList[pos]:IsDead() then
target = PosList[pos]
break
end
end
if target then return target end
end
end
--对位规则: 1敌方相同对位 2若死亡或不存在选取相邻阵位最近且阵位索引最小的

View File

@ -257,11 +257,9 @@ public class RedisKey {
public static final String DEATH_PATH_TOTAL_GUILD_RANK = "DEATH_PATH_TOTAL_GUILD_RANK";
public static final String DEATH_PAHT_TOTAL_CHALLENGE_COUNT = "DEATH_PAHT_TOTAL_CHALLENGE_COUNT";
public final static String CAR_CHALLENGE_RECORD = "CAR_CHALLENGE_RECORD"; //车迟玩法挑战记录