战斗逻辑提交
parent
4c78acd96f
commit
a10f5b21de
|
@ -130,6 +130,10 @@ function BuffManager.GenerateBuffId()
|
|||
return curBuffId
|
||||
end
|
||||
function BuffManager:AddBuff(target, buff)
|
||||
-- 灵兽无效
|
||||
if target.type == BattleUnitType.Monster then
|
||||
return
|
||||
end
|
||||
buff.target = target
|
||||
self.buffQueue:Enqueue(buff)
|
||||
-- buff.frameDuration = floor(buff.duration * BattleLogic.GameFrameRate)
|
||||
|
@ -252,7 +256,7 @@ function BuffManager:Update()
|
|||
oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
|
||||
putBuff(oldBuff)
|
||||
-- 覆盖老buff
|
||||
buffList.buffer[i] = buff
|
||||
buffList.buffer[i] = buff
|
||||
buff:OnStart()
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
|
||||
|
|
|
@ -2245,6 +2245,35 @@ local effectList = {
|
|||
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
|
|
@ -54,8 +54,8 @@ local passivityList = {
|
|||
local OnSkillCast = function(skill)
|
||||
BattleUtil.RandomAction(f1, function ()
|
||||
local duration = 0
|
||||
for i=1, skill.effectList.size do
|
||||
duration = max(duration, skill.effectList.buffer[i].duration)
|
||||
for i=1, skill.effectCaster.effectList.size do
|
||||
duration = max(duration, skill.effectCaster.effectList.buffer[i].duration)
|
||||
end
|
||||
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
|
||||
end)
|
||||
|
@ -3554,7 +3554,7 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
|
||||
local onSkillCastEnd = function(skill)
|
||||
local effectGroup = skill.effectList.buffer[1]
|
||||
local effectGroup = skill.effectCaster.effectList.buffer[1]
|
||||
local chooseId = effectGroup.chooseId
|
||||
local chooseLimit = floor(chooseId / 10000) % 10
|
||||
if chooseLimit == 3 then -- 打纵列
|
||||
|
|
|
@ -270,4 +270,11 @@ OutDataName = {
|
|||
BattleUnitType = {
|
||||
Role = 1,
|
||||
Monster = 2
|
||||
}
|
||||
|
||||
BattleRoleElementType = {
|
||||
REN = 1,
|
||||
FO = 2,
|
||||
YAO = 3,
|
||||
DAO = 4
|
||||
}
|
|
@ -188,7 +188,22 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
end
|
||||
arr = tempArr
|
||||
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
|
||||
|
||||
-- 选择条件
|
||||
|
@ -298,6 +313,10 @@ end
|
|||
|
||||
-- 秒杀
|
||||
function BattleUtil.Seckill(skill, atkRole, defRole)
|
||||
-- 灵兽无效
|
||||
if defRole.type == BattleUnitType.Monster then
|
||||
return
|
||||
end
|
||||
local damage = defRole:GetRoleData(RoleDataName.Hp)
|
||||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||
if finalDmg >= 0 then
|
||||
|
@ -324,6 +343,11 @@ end
|
|||
|
||||
-- 计算真实伤害
|
||||
function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
|
||||
-- 灵兽无效
|
||||
if defRole.type == BattleUnitType.Monster then
|
||||
return
|
||||
end
|
||||
|
||||
bCrit = bCrit or false
|
||||
damageType = damageType or 0
|
||||
|
||||
|
@ -396,6 +420,10 @@ function BattleUtil.GetExtraSkillbyId(id)
|
|||
end
|
||||
|
||||
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
|
||||
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
|
||||
if finalDmg >= 0 then
|
||||
|
@ -442,6 +470,10 @@ end
|
|||
--执行完整的命中,伤害,暴击计算,返回命中,暴击
|
||||
--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
|
||||
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)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
|
||||
|
||||
|
||||
fixDamage = max(floor(attack * 0.1), fixDamage)
|
||||
|
||||
|
||||
local finalDmg = 0 --计算实际造成的扣血
|
||||
if not defRole:IsRealDead() then
|
||||
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
|
||||
|
@ -530,15 +560,19 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
|
|||
end
|
||||
|
||||
function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
|
||||
-- 灵兽无效
|
||||
if targetRole.type == BattleUnitType.Monster then
|
||||
return
|
||||
end
|
||||
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
|
||||
return
|
||||
end
|
||||
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
|
||||
local bCrit = false
|
||||
local critRandom = Random.Range01()
|
||||
local critCondition = castRole:GetRoleData(RoleDataName.Crit)
|
||||
bCrit = critRandom <= critCondition
|
||||
bCrit = bCrit or targetRole.isFlagCrit == true -- 必定暴击
|
||||
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
|
||||
local bCrit = false
|
||||
local critRandom = Random.Range01()
|
||||
local critCondition = castRole:GetRoleData(RoleDataName.Crit)
|
||||
bCrit = critRandom <= critCondition
|
||||
bCrit = bCrit or targetRole.isFlagCrit == true -- 必定暴击
|
||||
-- 计算暴伤害系数
|
||||
local critDamageFactor = 1
|
||||
--计算暴击
|
||||
|
@ -553,6 +587,10 @@ function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
|
|||
end
|
||||
|
||||
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 --禁疗和死亡无法加血
|
||||
return
|
||||
end
|
||||
|
|
|
@ -32,6 +32,20 @@ local _ConditionConfig = {
|
|||
return BattleUtil.CompareValue(curRound, comValue, comType)
|
||||
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
|
||||
local conId = condition[1]
|
||||
local comType = condition[2]
|
||||
|
@ -39,7 +53,7 @@ local _ConditionConfig = {
|
|||
-- 当前释放技能的单位的职业
|
||||
local professionId = skill.owner.professionId
|
||||
return professionId == comValue
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- 条件检测
|
||||
|
|
|
@ -23,7 +23,6 @@ function MSkill:Init(owner, group, index, skillData)
|
|||
|
||||
self.curRoundCount = 0
|
||||
self.maxRoundCount = self.skillData.maxRoundCount
|
||||
--LogError("最大释放次数"..self.maxCastCount.."最大回合次数"..self.maxRoundCount)
|
||||
-- 将技能加入触发检测
|
||||
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function MSkillGroup:Init(monster, groupData)
|
|||
self.skillGroupData = groupData
|
||||
-- 创建技能
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -68,7 +68,7 @@ function Skill:Cast(func)
|
|||
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self)
|
||||
-- 只对效果1的目标发送事件,效果1是技能的直接伤害目标
|
||||
self.effectCaster:ForeachTargets(function(role)
|
||||
role.Event:DispatchEvent(BattleEventName.BeSkillCastEnd, self)
|
||||
role.Event:DispatchEvent(BattleEventName.BeSkillCast, self)
|
||||
end)
|
||||
--技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个
|
||||
local duration = self.hitTime + self.continueTime
|
||||
|
|
|
@ -17,7 +17,6 @@ end
|
|||
|
||||
--
|
||||
function this.AddMonsterSkill(skill)
|
||||
--LogPink("灵兽技能加入"..skill.id)
|
||||
if skill.type == BattleSkillType.Monster then
|
||||
table.insert(this.MonsterSkillList, skill)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue