战斗逻辑提交
parent
4c78acd96f
commit
a10f5b21de
|
@ -130,6 +130,10 @@ function BuffManager.GenerateBuffId()
|
||||||
return curBuffId
|
return curBuffId
|
||||||
end
|
end
|
||||||
function BuffManager:AddBuff(target, buff)
|
function BuffManager:AddBuff(target, buff)
|
||||||
|
-- 灵兽无效
|
||||||
|
if target.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
buff.target = target
|
buff.target = target
|
||||||
self.buffQueue:Enqueue(buff)
|
self.buffQueue:Enqueue(buff)
|
||||||
-- buff.frameDuration = floor(buff.duration * BattleLogic.GameFrameRate)
|
-- buff.frameDuration = floor(buff.duration * BattleLogic.GameFrameRate)
|
||||||
|
|
|
@ -2245,6 +2245,35 @@ local effectList = {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-- [a]%概率[b]改变[c]点怒气
|
||||||
|
-- a[float],b[改变类型],c[int]
|
||||||
|
[117] = function(caster, target, args, interval, skill)
|
||||||
|
local f1 = args[1]
|
||||||
|
local ct = args[2]
|
||||||
|
local i1 = args[3]
|
||||||
|
|
||||||
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
|
BattleUtil.RandomAction(f1, function()
|
||||||
|
target:AddRage(i1, ct)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
-- 造成[a]*[b]%的直接伤害(不会被分摊机制分摊)
|
||||||
|
-- a[属性],b[float]
|
||||||
|
[118] = function(caster, target, args, interval, skill)
|
||||||
|
local pro = args[1]
|
||||||
|
local f1 = args[2]
|
||||||
|
|
||||||
|
BattleLogic.WaitForTrigger(interval, function ()
|
||||||
|
local damage = BattleUtil.ErrorCorrection(f1 * caster:GetRoleData(BattlePropList[pro]))
|
||||||
|
BattleUtil.FinalDamage(skill, caster, target, damage, nil, 0, nil, true)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return effectList
|
return effectList
|
|
@ -54,8 +54,8 @@ local passivityList = {
|
||||||
local OnSkillCast = function(skill)
|
local OnSkillCast = function(skill)
|
||||||
BattleUtil.RandomAction(f1, function ()
|
BattleUtil.RandomAction(f1, function ()
|
||||||
local duration = 0
|
local duration = 0
|
||||||
for i=1, skill.effectList.size do
|
for i=1, skill.effectCaster.effectList.size do
|
||||||
duration = max(duration, skill.effectList.buffer[i].duration)
|
duration = max(duration, skill.effectCaster.effectList.buffer[i].duration)
|
||||||
end
|
end
|
||||||
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
|
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
|
||||||
end)
|
end)
|
||||||
|
@ -3554,7 +3554,7 @@ local passivityList = {
|
||||||
local i1 = args[1]
|
local i1 = args[1]
|
||||||
|
|
||||||
local onSkillCastEnd = function(skill)
|
local onSkillCastEnd = function(skill)
|
||||||
local effectGroup = skill.effectList.buffer[1]
|
local effectGroup = skill.effectCaster.effectList.buffer[1]
|
||||||
local chooseId = effectGroup.chooseId
|
local chooseId = effectGroup.chooseId
|
||||||
local chooseLimit = floor(chooseId / 10000) % 10
|
local chooseLimit = floor(chooseId / 10000) % 10
|
||||||
if chooseLimit == 3 then -- 打纵列
|
if chooseLimit == 3 then -- 打纵列
|
||||||
|
|
|
@ -271,3 +271,10 @@ BattleUnitType = {
|
||||||
Role = 1,
|
Role = 1,
|
||||||
Monster = 2
|
Monster = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BattleRoleElementType = {
|
||||||
|
REN = 1,
|
||||||
|
FO = 2,
|
||||||
|
YAO = 3,
|
||||||
|
DAO = 4
|
||||||
|
}
|
|
@ -188,7 +188,22 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
||||||
end
|
end
|
||||||
arr = tempArr
|
arr = tempArr
|
||||||
end
|
end
|
||||||
|
elseif chooseLimit == 4 then -- 处于灼烧状态
|
||||||
|
local tempArr = {}
|
||||||
|
for i = 1, #arr do
|
||||||
|
if BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType == DotType.Burn end) then
|
||||||
|
table.insert(tempArr, arr[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
arr = tempArr
|
||||||
|
elseif chooseLimit == 5 then -- 人阵营
|
||||||
|
local tempArr = {}
|
||||||
|
for i = 1, #arr do
|
||||||
|
if arr[i].element == BattleRoleElementType.REN then
|
||||||
|
table.insert(tempArr, arr[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
arr = tempArr
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 选择条件
|
-- 选择条件
|
||||||
|
@ -298,6 +313,10 @@ end
|
||||||
|
|
||||||
-- 秒杀
|
-- 秒杀
|
||||||
function BattleUtil.Seckill(skill, atkRole, defRole)
|
function BattleUtil.Seckill(skill, atkRole, defRole)
|
||||||
|
-- 灵兽无效
|
||||||
|
if defRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
local damage = defRole:GetRoleData(RoleDataName.Hp)
|
local damage = defRole:GetRoleData(RoleDataName.Hp)
|
||||||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||||
if finalDmg >= 0 then
|
if finalDmg >= 0 then
|
||||||
|
@ -324,6 +343,11 @@ end
|
||||||
|
|
||||||
-- 计算真实伤害
|
-- 计算真实伤害
|
||||||
function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
|
function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
|
||||||
|
-- 灵兽无效
|
||||||
|
if defRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
bCrit = bCrit or false
|
bCrit = bCrit or false
|
||||||
damageType = damageType or 0
|
damageType = damageType or 0
|
||||||
|
|
||||||
|
@ -396,6 +420,10 @@ function BattleUtil.GetExtraSkillbyId(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
|
function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
|
||||||
|
-- 灵兽无效
|
||||||
|
if defRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
if damage < 0 then damage = 0 end
|
if damage < 0 then damage = 0 end
|
||||||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||||
if finalDmg >= 0 then
|
if finalDmg >= 0 then
|
||||||
|
@ -442,6 +470,10 @@ end
|
||||||
--执行完整的命中,伤害,暴击计算,返回命中,暴击
|
--执行完整的命中,伤害,暴击计算,返回命中,暴击
|
||||||
--skill造成伤害的技能 atkRole攻击者 defRole受击者 damageType伤害类型 baseFactor伤害系数 ignoreDef无视防御参数 dotType是持续伤害类型
|
--skill造成伤害的技能 atkRole攻击者 defRole受击者 damageType伤害类型 baseFactor伤害系数 ignoreDef无视防御参数 dotType是持续伤害类型
|
||||||
function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, ignoreDef, dotType)
|
function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, ignoreDef, dotType)
|
||||||
|
-- 灵兽无效
|
||||||
|
if defRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- 判断是否命中
|
-- 判断是否命中
|
||||||
if skill and not skill:CheckTargetIsHit(defRole) then
|
if skill and not skill:CheckTargetIsHit(defRole) then
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
|
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
|
||||||
|
@ -518,10 +550,8 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
|
||||||
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, fixDamage)
|
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, fixDamage)
|
||||||
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
|
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
|
||||||
|
|
||||||
|
|
||||||
fixDamage = max(floor(attack * 0.1), fixDamage)
|
fixDamage = max(floor(attack * 0.1), fixDamage)
|
||||||
|
|
||||||
|
|
||||||
local finalDmg = 0 --计算实际造成的扣血
|
local finalDmg = 0 --计算实际造成的扣血
|
||||||
if not defRole:IsRealDead() then
|
if not defRole:IsRealDead() then
|
||||||
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
|
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
|
||||||
|
@ -530,15 +560,19 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
|
function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
|
||||||
|
-- 灵兽无效
|
||||||
|
if targetRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
|
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
|
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
|
||||||
local bCrit = false
|
local bCrit = false
|
||||||
local critRandom = Random.Range01()
|
local critRandom = Random.Range01()
|
||||||
local critCondition = castRole:GetRoleData(RoleDataName.Crit)
|
local critCondition = castRole:GetRoleData(RoleDataName.Crit)
|
||||||
bCrit = critRandom <= critCondition
|
bCrit = critRandom <= critCondition
|
||||||
bCrit = bCrit or targetRole.isFlagCrit == true -- 必定暴击
|
bCrit = bCrit or targetRole.isFlagCrit == true -- 必定暴击
|
||||||
-- 计算暴伤害系数
|
-- 计算暴伤害系数
|
||||||
local critDamageFactor = 1
|
local critDamageFactor = 1
|
||||||
--计算暴击
|
--计算暴击
|
||||||
|
@ -553,6 +587,10 @@ function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor)
|
function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor)
|
||||||
|
-- 灵兽无效
|
||||||
|
if targetRole.type == BattleUnitType.Monster then
|
||||||
|
return
|
||||||
|
end
|
||||||
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
|
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,6 +32,20 @@ local _ConditionConfig = {
|
||||||
return BattleUtil.CompareValue(curRound, comValue, comType)
|
return BattleUtil.CompareValue(curRound, comValue, comType)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
[3] = function(skill, condition) --2:回合数 【比较类型】 N 且 概率为 N
|
||||||
|
local conId = condition[1]
|
||||||
|
local comType = condition[2]
|
||||||
|
local comValue = condition[3]
|
||||||
|
local rand = condition[3]
|
||||||
|
-- 获取当前回合
|
||||||
|
local curRound = BattleLogic.GetCurRound()
|
||||||
|
local isRoundOk = BattleUtil.CompareValue(curRound, comValue, comType)
|
||||||
|
-- 判断概率
|
||||||
|
local r = Random.Range01()
|
||||||
|
local isRandomOk = r <= rand/10000
|
||||||
|
return isRoundOk and isRandomOk
|
||||||
|
end,
|
||||||
|
|
||||||
[4] = function(skill, condition) --4:行动单位的职业设定 【比较类型】 N
|
[4] = function(skill, condition) --4:行动单位的职业设定 【比较类型】 N
|
||||||
local conId = condition[1]
|
local conId = condition[1]
|
||||||
local comType = condition[2]
|
local comType = condition[2]
|
||||||
|
@ -39,7 +53,7 @@ local _ConditionConfig = {
|
||||||
-- 当前释放技能的单位的职业
|
-- 当前释放技能的单位的职业
|
||||||
local professionId = skill.owner.professionId
|
local professionId = skill.owner.professionId
|
||||||
return professionId == comValue
|
return professionId == comValue
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 条件检测
|
-- 条件检测
|
||||||
|
|
|
@ -23,7 +23,6 @@ function MSkill:Init(owner, group, index, skillData)
|
||||||
|
|
||||||
self.curRoundCount = 0
|
self.curRoundCount = 0
|
||||||
self.maxRoundCount = self.skillData.maxRoundCount
|
self.maxRoundCount = self.skillData.maxRoundCount
|
||||||
--LogError("最大释放次数"..self.maxCastCount.."最大回合次数"..self.maxRoundCount)
|
|
||||||
-- 将技能加入触发检测
|
-- 将技能加入触发检测
|
||||||
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
|
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ function MSkillGroup:Init(monster, groupData)
|
||||||
self.skillGroupData = groupData
|
self.skillGroupData = groupData
|
||||||
-- 创建技能
|
-- 创建技能
|
||||||
self.skillList = {}
|
self.skillList = {}
|
||||||
for index, data in ipairs(self.skillGroupData[1]) do
|
for index, data in ipairs(self.skillGroupData) do
|
||||||
self.skillList[index] = MSkillManager.CreateMSkill(monster, self, index, data)
|
self.skillList[index] = MSkillManager.CreateMSkill(monster, self, index, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,7 +68,7 @@ function Skill:Cast(func)
|
||||||
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self)
|
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self)
|
||||||
-- 只对效果1的目标发送事件,效果1是技能的直接伤害目标
|
-- 只对效果1的目标发送事件,效果1是技能的直接伤害目标
|
||||||
self.effectCaster:ForeachTargets(function(role)
|
self.effectCaster:ForeachTargets(function(role)
|
||||||
role.Event:DispatchEvent(BattleEventName.BeSkillCastEnd, self)
|
role.Event:DispatchEvent(BattleEventName.BeSkillCast, self)
|
||||||
end)
|
end)
|
||||||
--技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个
|
--技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个
|
||||||
local duration = self.hitTime + self.continueTime
|
local duration = self.hitTime + self.continueTime
|
||||||
|
|
|
@ -17,7 +17,6 @@ end
|
||||||
|
|
||||||
--
|
--
|
||||||
function this.AddMonsterSkill(skill)
|
function this.AddMonsterSkill(skill)
|
||||||
--LogPink("灵兽技能加入"..skill.id)
|
|
||||||
if skill.type == BattleSkillType.Monster then
|
if skill.type == BattleSkillType.Monster then
|
||||||
table.insert(this.MonsterSkillList, skill)
|
table.insert(this.MonsterSkillList, skill)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue