后端战斗相关lua文件提交

back_recharge
yuanshuai 2021-10-22 16:59:08 +08:00
parent 6066375355
commit 5d963ca404
20 changed files with 1437 additions and 227 deletions

View File

@ -15,6 +15,7 @@ local BuffRegister = {
[BuffName.NoDead] = "NoDead",
[BuffName.Aura] = "Aura",
[BuffName.Brand] = "Brand",
[BuffName.Blood] = "Blood",
}
@ -59,6 +60,9 @@ function Buff.Create(caster, type, duration, ...)
buff.roundPass = 0
buff.startRound = BattleLogic.GetCurRound()
-- 重置buff状态
buff.isBuff = nil
buff.isDeBuff = nil
buff:SetData(...)
return buff
@ -168,6 +172,7 @@ function BuffManager:AddBuff(target, buff)
buff.roundDuration = buff.duration
buff.roundInterval = buff.interval
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
buff.target.Event:DispatchEvent(BattleEventName.BuffBeAdd, buff)
-- 用于记录统计
BattleLogic.Event:DispatchEvent(BattleEventName.RecordBuff, buff.caster, buff.target, buff)
end
@ -323,6 +328,13 @@ function BuffManager:Update()
-- end
buffList:Add(buff)
buff:OnStart()
BattleLogManager.Log(
"Add Buff",
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"type", buff.type)
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
BattleLogic.Event:DispatchEvent(BattleEventName.BuffStart, buff)
end
@ -367,9 +379,18 @@ function BuffManager:PassUpdate()
-- 当前轮释放的buff不结算
if buff.startRound ~= BattleLogic.GetCurRound() then
buff.roundPass = buff.roundPass + 1
if buff.roundPass >= buff.roundDuration then
buff.disperse = true
--如果是Dot类的buff 判断触发次数;其他的还按照之前的逻辑判断 by:wangzhenxing 2021/08/27
if buff.triggerTime then
--现在按照 每回合都会触发来处理的如果存在4回合触发2次的还需处理 by:wangzhenxing 2021/08/27
if buff.triggerTime==buff.roundDuration then
buff.disperse = true
end
else
if buff.roundPass >= buff.roundDuration then
buff.disperse = true
end
end
buff.target.Event:DispatchEvent(BattleEventName.BuffRoundChange, buff)
end
end

View File

@ -200,7 +200,7 @@ local effectList = {
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target)
BattleLogic.WaitForTrigger(interval, function ()
local dmg = BattleUtil.CalDamage(skill, caster, target, dt, f1)
BattleUtil.CalTreat(caster, caster, floor(dmg * f2))
BattleUtil.CalTreat(caster, caster, floor(dmg * f2),1,skill)
end)
end,
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
@ -432,7 +432,7 @@ local effectList = {
local f1 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1))
BattleUtil.CalTreat(caster, target, val)
BattleUtil.CalTreat(caster, target, val,1,skill)
end)
end,
--对[a]的伤害[b]%,持续[c]秒
@ -742,7 +742,7 @@ local effectList = {
[43] = function(caster, target, args, interval, skill)
local i1 = args[1]
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.CalTreat(caster, target, i1)
BattleUtil.CalTreat(caster, target, i1,1,skill)
end)
end,
--造成[a]%的[b]伤害,计算伤害时额外计算[c]%的[d][e]和[f]%的[g][h]
@ -993,7 +993,7 @@ local effectList = {
local count = min(#arr, i1)
local heal = floor(damage / count)
for i=1, count do
BattleUtil.CalTreat(caster, arr[i], heal)
BattleUtil.CalTreat(caster, arr[i], heal,1,skill)
end
end)
end,
@ -1078,7 +1078,7 @@ local effectList = {
if arr[1] ~= caster then
caster.data:SubValue(RoleDataName.Hp, floor(caster:GetRoleData(RoleDataName.Hp) * f1))
end
BattleUtil.CalTreat(caster, arr[1], floor(caster:GetRoleData(RoleDataName.MaxHp) * f2))
BattleUtil.CalTreat(caster, arr[1], floor(caster:GetRoleData(RoleDataName.MaxHp) * f2),1,skill)
end
end)
end,
@ -1357,7 +1357,7 @@ local effectList = {
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.RandomAction(f2, function ()
local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1))
BattleUtil.CalTreat(caster, target, val)
BattleUtil.CalTreat(caster, target, val,1,skill)
end)
end)
end,
@ -1509,7 +1509,7 @@ local effectList = {
local OnBuffStart = function(buff)
if buff.type == BuffName.Control then
local val = floor(BattleUtil.FP_Mul(buff.target:GetRoleData(BattlePropList[pro1]), f2))
BattleUtil.CalTreat(buff.caster, buff.target, val)
BattleUtil.CalTreat(buff.caster, buff.target, val,1,skill)
end
end
caster.Event:AddEvent(BattleEventName.BuffStart, OnBuffStart)
@ -2285,7 +2285,7 @@ local effectList = {
local f1 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local val = floor(BattleUtil.FP_Mul(target:GetRoleData(BattlePropList[pro1]), f1))
BattleUtil.CalTreat(caster, target, val)
BattleUtil.CalTreat(caster, target, val,1,skill)
end)
end,
@ -2399,6 +2399,67 @@ local effectList = {
end)
end)
end,
--造成主角战斗力[a]%+[b]的伤害
--a[float],b[int]
[128] = function(caster, target, args, interval, skill)
local pro = args[1]
local round = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local damage=floor(caster.teamDamage*pro)+round
BattleUtil.FinalDamageCountShield(nil,caster, target,damage)
end)
end,
--回复目标主角战斗力[a]%+[b]的生命值,溢出部分转换为等量御甲值
--a[float],b[int]
[129] = function(caster, target, args, interval, skill)
local pro = args[1]
local round = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local damage=floor(caster.teamDamage*pro)+round
local value=target:GetRoleData(RoleDataName.MaxHp)-target:GetRoleData(RoleDataName.Hp)
local yujia=0
if value>0 then
BattleUtil.FinalTreat(caster, target,value,1,skill)
else
value=0
end
if damage-value>0 then
if target.bloodShield then
target.bloodShield:AddValue(damage-value)
else
target:AddBuff(Buff.Create(caster,BuffName.Blood,0,damage-value))
end
end
end)
end,
--对目标造成流血状态,造成主角战斗力[a]%+[b]的间接伤害,持续[c]回合
--a[float],b[int],c[int]
[130] = function(caster, target, args, interval, skill)
local f1 = args[1]
local v1 = args[2]
local round = args[3]
BattleLogic.WaitForTrigger(interval, function ()
local damage=floor(caster.teamDamage*f1)+v1
local buff=Buff.Create(caster, BuffName.DOT,round, 1,3,damage)
buff.isRealDamage=true
target:AddBuff(buff)
end)
end,
--对目标造成神佑状态,造成主角战斗力[a]%+[b]的血量,持续[c]回合,溢出部分转化为御甲
--a[float],b[int],c[int]
[131] = function(caster, target, args, interval, skill)
local f1 = args[1]
local v1 = args[2]
local round = args[3]
BattleLogic.WaitForTrigger(interval, function ()
local damage=floor(caster.teamDamage*f1)+v1
local buff=Buff.Create(caster, BuffName.HOT,round,1,damage)
buff.hotType=2
target:AddBuff(buff)
end)
end,
}
return effectList

View File

@ -29,6 +29,14 @@ function EffectCaster:Init(skill, effects, targets)
effect.args[k-1] = v[j][k]
end
effectGroup.effects[j-1] = effect
BattleLogManager.Log(
"Init Effect",
"camp", skill.owner.camp,
"position", skill.owner.position,
"skillId", tostring(skill.id),
"effectType", tostring(effect.type)
)
end
table.insert(self.effectList, effectGroup)
end
@ -51,6 +59,15 @@ function EffectCaster:DoEffect(caster, target, eff, duration, skill)
caster.Event:DispatchEvent(BattleEventName.SkillEffectBefore, skill, e, _PassiveCheck,target,eff)
target.Event:DispatchEvent(BattleEventName.BeSkillEffectBefore, skill, e, _PassiveCheck)
BattleLogManager.Log(
"Do Effect",
"camp", caster.camp,
"position", caster.position,
"tcamp", target.camp,
"tposition", target.position,
"skillId", tostring(skill.id),
"effectType", tostring(e.type)
)
--
if Effect[e.type] then
Effect[e.type](caster, target, e.args, duration, skill)
@ -188,7 +205,16 @@ function EffectCaster:GetDirectTargetsNoExile()
return list
end
-- 获取直接目标和没有被放逐的目标,不包含不灭可能为空
function EffectCaster:GetDirectTargetsNoNODead()
local list = {}
for _, role in ipairs(self.effectTargets[1]) do
if not BattleLogic.BuffMgr:HasBuff(role,BuffName.NoDead) then
table.insert(list, role)
end
end
return list
end
-- »ñÈ¡¼¼ÄÜÄ¿±ê×î´óÈËÊý
function EffectCaster:GetMaxTargetNum()

File diff suppressed because it is too large Load Diff

View File

@ -234,8 +234,12 @@ function BattleLogic.TurnRound(debugTurn)
-- 第一次进入 或者 本轮结束 初始化流程状态
if CurRound == 0 or (CurSkillPos[0] == 6 and CurSkillPos[1] == 6) then
if CurRound ~= 0 then
-- 上一轮结束
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound)
if BattleLogic.CheckHaveInsertRole() then
return
else
-- 上一轮结束
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound)
end
end
-- 检测一次灵兽技能
SkillManager.CheckMonsterSkill(function()
@ -378,6 +382,61 @@ function BattleLogic.CheckBattleLogic()
SkillRole:CastSkill()
end
--检测是否有插入得英雄
function BattleLogic.CheckHaveInsertRole()
if insertSkillRole then
local SkillRole=insertSkillRole
insertSkillRole=nil
-- 如果找不到下一个人,直接交换阵营
if not SkillRole then
BattleLogManager.Log( "No Skill Position" )
BattleLogic.TurnRoundNextFrame()
return
end
--
BattleLogManager.Log(
"Position Change",
"position", CurSkillPos[CurCamp]
)
-- 行动
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
-- buff计算
BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
-- 设置行动完成回调
SkillManager.SetTurnRoundFunc(function()
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
BattleLogic.BuffMgr:PassUpdateNoDead() -- 计算buff不灭
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 行动结束
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 开始行动
BattleLogic.TurnRoundNextFrame()
end)
-- 如果角色无法释放技能
if not SkillRole:IsAvailable() -- 角色不能释放技能
or (SkillRole:IsDead() -- 将死状态
and not BattleLogic.BuffMgr:HasBuff(SkillRole,BuffName.NoDead) --将死但没有不死buff
and not SkillManager.HaveMySkill(SkillRole)) -- 也没有要释放的技能
then
SkillManager.CheckTurnRound()
return
end
-- 释放技能后,递归交换阵营
SkillRole:CastSkill()
return true
else
return false
end
end
function BattleLogic.WaitForTrigger(delayTime, action)
delayTime = BattleUtil.ErrorCorrection(delayTime)
local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5)

View File

@ -0,0 +1,62 @@
Blood = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function Blood:SetData(...)
-- 刷新排序等级
self.bloodValue=...
self.sort = 4
end
function Blood:AddValue(value)
self.bloodValue=self.bloodValue+value
self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp),1,value)
end
--初始化后调用一次
function Blood:OnStart()
self.target.bloodShield = self
self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp),1,self.bloodValue)
end
function Blood:GetCurValue()
return self.bloodValue
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function Blood:OnTrigger()
return true
end
--效果结束时调用一次
function Blood:OnEnd()
self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,0)
self.target.bloodShield = nil
self.bloodValue=0
end
--计算血甲
function Blood:CountBloodValue(damage)
local finalDamage=0
self.bloodValue=self.bloodValue-damage
if self.bloodValue<=0 then
self.disperse=true
finalDamage=self.bloodValue
end
local value=0
if self.bloodValue<=0 then
value=0
end
self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp))
return finalDamage
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function Blood:OnCover(newBuff)
return true
end
return Blood

View File

@ -8,6 +8,7 @@ function DOT:SetData(...)
self.damagePro, --1 物理 2 魔法 (真实伤害时 为伤害值)
self.damageFactor = ... --伤害系数
self.isRealDamage = false
self.triggerTime=0
--if self.damageType == 2 then
-- self.cover = true
-- self.layer = 1
@ -18,14 +19,14 @@ function DOT:SetData(...)
-- 刷新排序等级
self.sort = 2
if self.damageType == 3 then -- 流血buff在行动之后刷新
self.sort = 3
end
-- if self.damageType == 3 then -- 流血buff在行动之后刷新
-- self.sort = 3
-- end
end
--初始化后调用一次
function DOT:OnStart()
if self.caster.isTeam then
if self.caster.isTeam or self.caster.type == BattleUnitType.Player then
self.isRealDamage = true
end
end
@ -38,12 +39,14 @@ function DOT:OnTrigger()
else
BattleUtil.CalDamage(nil, self.caster, self.target, self.damagePro, self.damageFactor, 0, self.damageType)
end
self.triggerTime=self.triggerTime+1
return true
end
--效果结束时调用一次
function DOT:OnEnd()
BattleLogic.Event:DispatchEvent(BattleEventName.DotBuffEnd, self)
self.triggerTime=0
end
--只有当cover字段为true时触发返回true则被新效果覆盖

View File

@ -5,7 +5,7 @@ function HOT:SetData(...)
self.interval,
self.healValue = ...
self.hotType=1 -- 1:治愈 2.神佑
-- 刷新排序等级
self.sort = 1 -- 最先计算回血
end
@ -19,7 +19,7 @@ end
--修改持续加血效果的加血值
function HOT:ChangeHealValue(newValue)
if newValue then
if newValue and self.hotType~=2 then
self.healValue=newValue
end
end
@ -28,7 +28,24 @@ end
function HOT:OnTrigger()
if not self.target.ctrl_noheal or self.target:IsDead() then --禁疗和死亡无法加血
BattleUtil.ApplyTreat(self.caster, self.target, self.healValue)
if self.hotType==2 then
local value=self.target:GetRoleData(RoleDataName.MaxHp)-self.target:GetRoleData(RoleDataName.Hp)
local yujia=0
if value>0 then
BattleUtil.FinalTreat(self.caster, self.target,value,1,nil)
else
value=0
end
if self.healValue-value>0 then
if self.target.bloodShield then
self.target.bloodShield:AddValue(self.healValue-value)
else
self.target:AddBuff(Buff.Create(self.caster,BuffName.Blood,0,self.healValue-value))
end
end
else
BattleUtil.ApplyTreat(self.caster, self.target, self.healValue)
end
end
return true
end

View File

@ -14,6 +14,13 @@ local immune3 = function(buff)
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
end
--免疫控制不免疫禁疗
local immune5 = function(buff)
return buff.type == BuffName.Control and buff.ctrlType and buff.ctrlType~=4
end
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function Immune:SetData(type,func)
self.immuneType = type
@ -39,10 +46,10 @@ function Immune:OnStart()
if self.immune4 then
self.target.buffFilter:Add(self.immune4)
end
elseif self.immuneType==5 then--免疫控制 不免疫禁疗
self.target.buffFilter:Add(immune5)
end
if condition then
-- body
end
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd

View File

@ -131,6 +131,7 @@ BattleEventName = {
BuffStart = indexAdd(),
BuffDodge = indexAdd(),
BuffTrigger = indexAdd(),
BuffBeAdd=indexAdd(),
BuffEnd = indexAdd(),
BuffCountChange = indexAdd(),
BuffCover = indexAdd(),
@ -153,9 +154,10 @@ BattleEventName = {
RoleCastSkillBefore = indexAdd(),
--护盾buff消失以后
ShieldBuffEnd=indexAdd(),
--治疗效果导入
--治疗效果结束
HotBuffEnd=indexAdd(),
--dot buff结束
DotBuffEnd=indexAdd(),
-- 战斗记录用
RecordDamage = indexAdd(), -- 伤害
RecordTreat = indexAdd(), -- 治疗
@ -170,6 +172,9 @@ BattleEventName = {
RecordRageChange = indexAdd(), -- 怒气改变时
ActionOperateAngerAfter =indexAdd(),--角色行动操作怒气后
HitRoleInBurn = indexAdd(), --击中在燃烧状态得敌人
ActionOperateAngerBefore =indexAdd(),--角色行动操作怒气前
BloodValueChange = indexAdd(), --御甲只发发生改变
CheckLiZhanZhiQu = indexAdd(),--检测历战之躯
}
BattleMaxFrame = 1000000
@ -203,6 +208,7 @@ RoleDataName = {
DarkDamageReduceFactor = indexAdd(), --暗系伤害减免系数(%
ElementDamageBocusFactor = indexAdd(), --属性伤害加成系数(%
InitRage = indexAdd(), --初始怒气值
}
BuffName = {
@ -218,6 +224,7 @@ BuffName = {
NoDead = 10,
Aura = 11,
Brand = 12,
Blood = 13,
}
DotType = {
@ -322,7 +329,8 @@ OutDataName = {
BattleUnitType = {
Role = 1,
Monster = 2
Monster = 2,
Player = 3,
}
BattleRoleElementType = {

View File

@ -8,6 +8,23 @@ local min = math.min
--local BattleEventName = BattleEventName
BattleUtil.Passivity = require("Modules/Battle/Logic/Base/Passivity")
local function table_removebyvalue(array, value, removeall)
local c, i, max = 0, 1, #array
while i <= max do
if array[i] == value then
table.remove(array, i)
c = c + 1
i = i - 1
max = max - 1
if not removeall then
break
end
end
i = i + 1
end
return c
end
local function clamp(v, minValue, maxValue)
if v < minValue then
return minValue
@ -202,6 +219,16 @@ function BattleUtil.SortByHpFactorAndHp(arr, sort)
end)
return arr
end
--移除队列有不灭的单位
function BattleUtil.RemoveNoDeadRole(arr)
for i = 1, #arr do
local role=arr[i]
if BattleLogic.BuffMgr:HasBuff(role,BuffName.NoDead) then
table_removebyvalue(arr,role)
end
end
end
--按怒气排序
function BattleUtil.SortByRage(arr, sort)
BattleUtil.Sort(arr, function(a, b)
@ -352,6 +379,8 @@ function BattleUtil.ChooseTarget(role, chooseId)
BattleUtil.SortByProp(arr, RoleDataName.Hp, sort)
elseif chooseWeight == 2 then -- 血量百分比
BattleUtil.SortByHpFactor(arr, sort)
--选血量百分比最低的 不选择有不灭的,如果伤害要选有不灭的 需处理
BattleUtil.RemoveNoDeadRole(arr)
elseif chooseWeight == 3 then -- 攻击力
BattleUtil.SortByProp(arr, RoleDataName.Attack, sort)
elseif chooseWeight == 4 then -- 防御
@ -508,7 +537,7 @@ end
-- 秒杀
function BattleUtil.Seckill(skill, atkRole, defRole)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster then
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
local damage = defRole:GetRoleData(RoleDataName.Hp)
@ -520,7 +549,7 @@ function BattleUtil.Seckill(skill, atkRole, defRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole,damage,nil,finalDmg)
defRole.Event:DispatchEvent(BattleEventName.BeSeckill, atkRole)
BattleLogic.Event:DispatchEvent(BattleEventName.Seckill, atkRole, defRole)
end
@ -540,7 +569,7 @@ end
-- 秒杀定额血量
function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster then
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
local damage = floor(BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp),pro))
@ -551,7 +580,7 @@ function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole)
atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole,damage,nil,finalDmg)
defRole.Event:DispatchEvent(BattleEventName.BeSeckill, atkRole)
BattleLogic.Event:DispatchEvent(BattleEventName.Seckill, atkRole, defRole)
end
@ -571,7 +600,7 @@ end
-- 计算真实伤害
function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster then
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
@ -613,9 +642,31 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
return BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
end
-- 计算真实伤害(没有被动增伤)
function BattleUtil.ApplyDamageNoPassive(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
damage = damage - dmgDeduction
end
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamageEnd, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType,isDirect)
BattleLogic.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
--
return BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
end
-- 怒气计算
function BattleUtil.CalRage(caster, target, value, countType)
function BattleUtil.CalRage(caster, target, value, countType,isBorrow)
-- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56
if (countType==3 or countType==4) -- 降怒
@ -625,9 +676,21 @@ function BattleUtil.CalRage(caster, target, value, countType)
return
end
local lastRage=target.Rage
--如果每回合减的怒气超过了每回合上限就不再减怒
if (countType==3 or countType==4) and target.RoundMaxSubRage~=0 and target.RoundMaxSubRage<=target.AllSubRage then
return
end
--这个减的怒气+已经间的怒气> 怒气限制
if (countType==3 or countType==4) and target.RoundMaxSubRage~=0 and value+target.AllSubRage>target.RoundMaxSubRage then
value=target.RoundMaxSubRage-target.AllSubRage
end
-- 操作怒气
local deltaRage = target:AddRage(value, countType)
BattleLogic.Event:DispatchEvent(BattleEventName.RecordRageChange, caster, target, deltaRage,countType,value,lastRage)
if (countType==3 or countType==4) and target.RoundMaxSubRage~=0 then
target.AllSubRage=target.AllSubRage-deltaRage
end
BattleLogic.Event:DispatchEvent(BattleEventName.RecordRageChange, caster, target, deltaRage,countType,value,lastRage,isBorrow)
-- 用于记录统计
BattleLogic.Event:DispatchEvent(BattleEventName.RecordRage, caster, target, deltaRage)
end
@ -672,11 +735,30 @@ end
function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster then
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
if damage < 0 then damage = 0 end
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if skill and skill.type==BattleSkillType.Special then
skill.owner.superSkillDamage=damage
end
--计算血量防护
local realDamage=damage
--血量防护只会防直接伤害
if defRole.bloodShield and skill then
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage))
-- damage=realDamage
end
--检测历战之躯
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
realDamage = realDamage - dmgDeduction
damage=realDamage
end
defRole.Event:DispatchEvent(BattleEventName.CheckLiZhanZhiQu, damagingFunc, atkRole, realDamage, skill, dotType, bCrit, damageType,isDirect)
--御甲过滤后的伤害只会处理扣血 by: wangzhenxing shihongyi 2021/09/27
local finalDmg = defRole.data:SubValue(RoleDataName.Hp,realDamage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead(damage)
@ -726,15 +808,98 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
return finalDmg
end
--计算盾的最终伤害
function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
if damage < 0 then damage = 0 end
if skill and skill.type==BattleSkillType.Special then
skill.owner.superSkillDamage=damage
end
--计算血量防护
local realDamage=damage
--血量防护只会防直接伤害
if defRole.bloodShield and skill then
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage))
-- damage=realDamage
end
--检测历战之躯
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
realDamage = realDamage - dmgDeduction
damage=realDamage
end
defRole.Event:DispatchEvent(BattleEventName.CheckLiZhanZhiQu, damagingFunc, atkRole, realDamage, skill, dotType, bCrit, damageType,isDirect)
--LogError("最后扣除伤害=="..realDamage)
--御甲过滤后的伤害只会处理扣血 by: wangzhenxing shihongyi 2021/09/27
local finalDmg = defRole.data:SubValue(RoleDataName.Hp,realDamage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead(damage)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole,skill,dotType)
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,isDirect)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
--如果目标是主燃烧目标 or 目标身上有燃烧效果
if atkRole.curMainTarget==defRole or BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT,function(buff) return buff.damageType == 1 end) then
atkRole.Event:DispatchEvent(BattleEventName.HitRoleInBurn,skill,defRole)
end
end
--如果不是技能带的伤害,并且是直接伤害就,,,,,
--用于处理不触发特性并且是直接伤害的伤害 isDirect 暂时先为bool值后期可根据需求做修改扩展 by:王振兴 2020/10/12 16:18
if isDirect and not skill then
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
end
end
-- 战斗记录用
BattleLogic.Event:DispatchEvent(BattleEventName.RecordDamage, atkRole, defRole, damage)
--
BattleLogManager.Log(
"Final Damage",
"acamp", atkRole.camp,
"apos", atkRole.position,
"tcamp", defRole.camp,
"tpos", defRole.position,
"damage", damage,
"dotType", tostring(dotType)
)
return finalDmg
end
--执行完整的命中,伤害,暴击计算,返回命中,暴击
--skill造成伤害的技能 atkRole攻击者 defRole受击者 damageType伤害类型 baseFactor伤害系数 ignoreDef无视防御参数 dotType是持续伤害类型
function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, ignoreDef, dotType)
-- 灵兽无效
if defRole.type == BattleUnitType.Monster then
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
-- 判断是否命中
if skill and not skill:CheckTargetIsHit(defRole) then
if skill and not skill:CheckTargetIsHit(defRole) and atkRole.type==BattleUnitType.Role then
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
atkRole.Event:DispatchEvent(BattleEventName.HitMiss, defRole, skill)
defRole.Event:DispatchEvent(BattleEventName.BeHitMiss, atkRole, skill)
@ -764,7 +929,7 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
-- 无视防御系数
ignoreDef = 1 - (ignoreDef or 0)
-- 基础伤害 = 攻击力 - 防御力
baseDamage = max(attack - BattleUtil.FP_Mul(0.5, defence, ignoreDef), 0)
baseDamage = max(attack - BattleUtil.FP_Mul(defence, ignoreDef), 0)
-- 基础伤害增加系数
local addDamageFactor = 1 + atkRole:GetRoleData(RoleDataName.DamageBocusFactor) - defRole:GetRoleData(RoleDataName.DamageReduceFactor)
@ -822,9 +987,9 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
return finalDmg, bCrit
end
function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor,skill)
-- 灵兽无效
if targetRole.type == BattleUnitType.Monster then
if targetRole.type == BattleUnitType.Monster or targetRole.type == BattleUnitType.Player then
return
end
BattleLogic.Event:DispatchEvent(BattleEventName.DisposeRoleCtrl_noheal, castRole,targetRole)
@ -851,10 +1016,54 @@ function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor)
-- 基础伤害增加系数
local addDamageFactor = 1 + castRole:GetRoleData(RoleDataName.DamageBocusFactor)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeHealed, castRole)
BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor)
BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor,skill)
end
function BattleUtil.FinalTreat(castRole, targetRole, value, baseFactor,skill)
-- 灵兽无效
if targetRole.type == BattleUnitType.Monster or targetRole.type == BattleUnitType.Player then
return
end
BattleLogic.Event:DispatchEvent(BattleEventName.DisposeRoleCtrl_noheal, castRole,targetRole)
if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血
--禁疗并且没有死亡的单位显示血量+0 不走后面代码,防止触发后面的被动 by:王振兴 2021/1/27
if targetRole.ctrl_noheal and not targetRole:IsDead() then
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, 0, 0)
end
return
end
targetRole.Event:DispatchEvent(BattleEventName.RoleBeHealed, castRole)
local maxHp = targetRole:GetRoleData(RoleDataName.MaxHp)
local hp = targetRole:GetRoleData(RoleDataName.Hp)
baseFactor = baseFactor or 1
local baseTreat = BattleUtil.FP_Mul(value, baseFactor)
--baseTreat = BattleUtil.CountChangeList(baseTreat, cl)
-- 取整
local baseTreat = floor(baseTreat + 0.5)
local treat = min(baseTreat, maxHp - hp)
if treat > 0 then
targetRole.data:AddValue(RoleDataName.Hp, treat)
end
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
--添加发送到battleLogic的治疗消息用于计算总的战斗伤害值
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
-- 战斗记录用
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, castRole, targetRole, baseTreat)
BattleLogManager.Log(
"Final Treat",
"acamp", castRole.camp,
"apos", castRole.position,
"tcamp", targetRole.camp,
"tpos", targetRole.position,
"value", value
)
end
function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor)
function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor,skill)
-- 灵兽无效
if targetRole.type == BattleUnitType.Monster then
return
@ -875,7 +1084,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag
local treatFactorFunc = function(df, dt)
baseFactor = BattleUtil.CountValue(baseFactor, df, dt)
end
castRole.Event:DispatchEvent(BattleEventName.PassiveTreatingFactor, treatFactorFunc, targetRole)
castRole.Event:DispatchEvent(BattleEventName.PassiveTreatingFactor, treatFactorFunc, targetRole,skill)
targetRole.Event:DispatchEvent(BattleEventName.PassiveBeTreatedFactor, treatFactorFunc, castRole)
local factor = castRole.isTeam and 1 or castRole:GetRoleData(RoleDataName.TreatFacter) --释放者为team则不计算治疗加成属性
@ -973,6 +1182,7 @@ function BattleUtil.RandomControl(rand, ctrl, caster, target, round)
target:AddBuff(buff)
end)
if not isAdd then
buff.target=target
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff)
end
return isAdd

View File

@ -16,15 +16,27 @@ end
function Monster:Init(data)
self.type = BattleUnitType.Monster
self.camp = data.camp
-- if data.position==10 then
-- self.type = BattleUnitType.Player
-- end
self.position = data.position
self.star = data.star
self.uid= data.id
self.teamDamage=data.teamDamage
self.roleData = data
self.data:Init(self, data.property)
self.buffFilter:Clear() --buff屏蔽列表
self.Event:ClearEvent()
self.exileTargets={}--已经被放逐过的目标
self.skillGroup = MSkillManager.CreateMSkillGroup(self, data.skill)
-- self.skillGroup = MSkillManager.CreateMSkillGroup(self, data.skill)
-- self.skillList=data.skill
self.skillGroupList = {}
for i = 1, #data.skill do
-- LogError("---------------------"..data.skill[i].skillData.effect[1])
--LogError("monster skill id=="..data.skill[i])
self.skillGroupList[i] = MSkillManager.CreateMSkillGroup(self, i, data.skill[i])
end
end

View File

@ -1,7 +1,7 @@
MCondition = {}
local this = MCondition
local skillRound={}
local _ConditionConfig = {
[0] = function(skill, condition) --0:无限制条件
return true
@ -134,6 +134,26 @@ local _ConditionConfig = {
end
return false
end,
[8] = function(skill, condition) --6:回合cd数限制
local conId = condition[1]
local comType = condition[2]
local comValue = condition[3]
-- 获取当前回合
--return true
local curRound = BattleLogic.GetCurRound()
if not skillRound[skill.id] then
skillRound[skill.id]=curRound
return true
else
if curRound==skillRound[skill.id]+comValue then
skillRound[skill.id]=curRound
return true
end
end
return false
end,
}
-- 条件检测
@ -147,5 +167,12 @@ function MCondition.CheckCondition(skill, condition)
return _ConditionConfig[conId](skill, condition)
end
-- 清除缓存
function MCondition.ClearCache()
if skillRound then
skillRound={}
end
end
return MCondition

View File

@ -19,14 +19,15 @@ function MSkill:Init(owner, group, index, skillData)
self.curCastCount = 0
self.maxCastCount = self.skillData.maxCount
-- LogError("monster skill id=="..skillData.effect[1])
self.curRoundCount = 0
self.maxRoundCount = self.skillData.maxRoundCount
-- 将技能加入触发检测
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
--MTrigger.AddSkill(self.skillData, self.skillData.triggerCondition, self)
local effectData = self.skillData.effect
self.id = effectData[1] -- 技能ID
-- 将技能加入触发检测
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
self.hitTime = effectData[2] -- 效果命中需要的时间
self.continueTime = effectData[3] -- 命中后伤害持续时间
self.attackCount = effectData[4] -- 伤害持续时间内伤害次数

View File

@ -8,13 +8,21 @@ function MSkillGroup:New()
end
-- 初始化数据
function MSkillGroup:Init(monster, groupData)
function MSkillGroup:Init(monster, groupIndex, groupData)
self.owner = monster
self.groupIndex = groupIndex
self.skillGroupData = groupData
-- 创建技能
self.skillList = {}
for index, data in ipairs(self.skillGroupData) do
self.skillList[index] = MSkillManager.CreateMSkill(monster, self, index, data)
local num=0
-- for index, data in ipairs(self.skillGroupData) do
-- LogError("careat skill=="..index.." data=="..data.effect[1])
-- num=num+1
-- self.skillList[num] = MSkillManager.CreateMSkill(monster, self, num, data)
-- end
for i = 1, #self.skillGroupData do
self.skillList[i] = MSkillManager.CreateMSkill(monster, self, i, self.skillGroupData[i])
end
end

View File

@ -12,31 +12,38 @@ function this.Init()
end
-- 创建一个技能组
function this.CreateMSkillGroup(monster, skillGroupData)
local index = monster:GetCamp() * 6 + monster:GetPosition()
function this.CreateMSkillGroup(monster, groupIndex, skillGroupData)
local position = monster:GetCamp() * 6 + monster:GetPosition()
if not this.MSkillGroupList then
this.MSkillGroupList = {}
end
if not this.MSkillGroupList[index] then
this.MSkillGroupList[index] = MSkillGroup:New()
if not this.MSkillGroupList[position] then
this.MSkillGroupList[position] = MSkillGroup:New()
end
this.MSkillGroupList[index]:Init(monster, skillGroupData)
this.MSkillGroupList[position]:Init(monster, groupIndex, skillGroupData)
return this.MSkillGroupList[position]
end
-- 创建一个技能
function this.CreateMSkill(monster, group, index, skilldata)
local owner = group:GetOwner()
local m_index = owner:GetCamp() * 6 + owner:GetPosition()
local groupIndex = group.groupIndex
local position = owner:GetCamp() * 6 + owner:GetPosition()
if not this.MSkillList then
this.MSkillList = {}
end
if not this.MSkillList[m_index] then
this.MSkillList[m_index] = {}
if not this.MSkillList[position] then
this.MSkillList[position] = {}
end
if not this.MSkillList[m_index][index] then
this.MSkillList[m_index][index] = MSkill:New()
if not this.MSkillList[position][groupIndex] then
this.MSkillList[position][groupIndex] = {}
end
this.MSkillList[m_index][index]:Init(monster, group, index, skilldata)
if not this.MSkillList[position][groupIndex][index] then
this.MSkillList[position][groupIndex][index] = MSkill:New()
end
this.MSkillList[position][groupIndex][index]:Init(monster, group, index, skilldata)
return this.MSkillList[position][groupIndex][index]
end
return MSkillManager

View File

@ -102,11 +102,14 @@ end
-- 初始化事件监听
function this.InitListener()
--每次初始化时间监听前 清除下缓存数据
MCondition.ClearCache()
for triggerId, config in pairs(_TriggerConfig) do
BattleLogic.Event:AddEvent(config.event, function(...)
-- 用于排序
local sortList = {}
-- 判断是否有需要触发的技能
local triggerSkill = this.TriggerList[triggerId]
if not triggerSkill then
return
@ -154,7 +157,7 @@ function MTrigger.AddSkill(triggerId, condition, skill)
if not this.TriggerList[triggerId] then
this.TriggerList[triggerId] = {}
end
table.insert(this.TriggerList[triggerId], {condition = condition, skill = skill})
table.insert(this.TriggerList[triggerId], {condition = condition, skill = skill,trigger= triggerId})
end
return MTrigger

View File

@ -29,6 +29,9 @@ function RoleLogic:Init(uid, data, position)
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
self.isRealDead = self.isDead
self.killDamage = 0 --致死伤害
self.teamDamage = data.teamDamage --最高战斗力
self.superSkillDamage = 0 --技能伤害
self.killRole=nil --击杀英雄
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
self.element = data.element
@ -60,7 +63,8 @@ function RoleLogic:Init(uid, data, position)
self.aiOrder = data.ai
self.aiIndex = 1
self.aiTempCount = 0
self.RoundMaxSubRage=0 --每回合最多减少怒气
self.AllSubRage =0 -- 每回合减少的怒气
self.IsDebug = false
self.enemyType = EnemyType.normal
self.lockTarget = nil --嘲讽
@ -75,7 +79,7 @@ function RoleLogic:Init(uid, data, position)
self.reliveFilter = true -- 控制复活的标志位置为false角色将不再享受复活效果
self.reliveHPF = 1
self.reliveCaster = nil
self.bloodShield = nil
self.IsCanAddSkill = true -- 是否可以追加技能
self.mustHit=false --必定命中
self.mustCrit=false --必定暴击
@ -98,6 +102,14 @@ function RoleLogic:Init(uid, data, position)
end
if BattleUtil.Passivity[id] then
BattleUtil.Passivity[id](self, args,passivityId,judge)
BattleLogManager.Log(
"Add Passive",
"id", tostring(id),
"camp", tostring(self.camp),
"pos", tostring(self.position),
"passivityId", tostring(passivityId),
"judge", tostring(judge)
)
-- 加入被动列表
table.insert(self.passiveList, {id, args,passivityId})
end
@ -290,10 +302,19 @@ function RoleLogic:AddBuff(buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffMiss, _CallBack, self, buff)
missF = BattleUtil.CountChangeList(missF, cl)
BattleLogManager.Log(
"Add Buff random",
"missF", missF)
-- 如果概率为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,self) then
BattleLogManager.Log(
"Buff Filter",
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"type", buff.type)
BattleLogic.BuffMgr:PutBuff(buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self)
return
@ -310,6 +331,15 @@ end
-- 判断角色是否可以释放技能
function RoleLogic:IsAvailable(skill)
if skill and skill.effectCaster then
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/09/17
--为解决攻击目标只剩被放逐的单位导致我方不放技能扣除怒气
skill.effectCaster:ChooseTarget()
local targets=BattleUtil.LengthOfTable(skill.effectCaster:GetDirectTargetsNoExile())
if targets==0 then
return false
end
end
--角色没有真正死亡 在 被眩晕/沉默的 情况下 任然能释放死亡技能
if (self.ctrl_dizzy or self.ctrl_slient) and self:IsDead() and skill and skill.type==BattleSkillType.DeadSkill then
return true
@ -344,7 +374,7 @@ function RoleLogic:SkillCast(skill, func)
_CastDone()
return
end
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerBefore,self)
-- 没有麻痹,释放普通攻击
if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then
@ -411,28 +441,22 @@ end
-- targets 指定目标
-- isAdd 是否是追加技能
-- isRage 是否正常操作怒气值
function RoleLogic:AddSkill(type, isRage, isAdd, targets)
function RoleLogic:AddSkill(type, isRage, isAdd, targets,isTrigger,isLoop)
if not self.IsCanAddSkill and isAdd then return end
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
--角色被混乱后
local isTriggerJudge=true
if isTrigger~=nil then
isTriggerJudge=isTrigger
end
if self.ctrl_chaos then
type=BattleSkillType.ChaosNormal
--混乱普攻使用普攻特效
effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{100001,{1,1,1}}}
isTriggerJudge=false
end
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage,isTriggerJudge)
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage,isTriggerJudge,isLoop)
--
BattleLogManager.Log(
"Add Skill",
"camp", self.camp,
"pos", self.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"targets", targets and #targets or "0"
)
end
--加入额外技能,用于额外释放技能 by:王振兴
@ -450,15 +474,6 @@ function RoleLogic:InsertExtraSkill(id,type)
end
--和老史,佳琦确认果 附加技能算绝技 被沉默无法释放 可以套娃 递归触发 by:王振兴
SkillManager.InsertSkill(self, effectData, skillType, nil, true, false,isTrigger)
BattleLogManager.Log(
"Insert Extra Skill",
"camp", self.camp,
"pos", self.position,
"type", skillType,
"isRage", tostring(false),
"isAdd", tostring(true),
"targets", targets and #targets or "0"
)
end
end
@ -468,16 +483,6 @@ function RoleLogic:InsertSkill(type, isRage, isAdd, targets)
if not self.IsCanAddSkill and isAdd then return end
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
SkillManager.InsertSkill(self, effectData, type, targets, isAdd, isRage)
--
BattleLogManager.Log(
"Insert Skill",
"camp", self.camp,
"pos", self.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"targets", targets and #targets or "0"
)
end
-- 设置是否可以追加技能
function RoleLogic:SetIsCanAddSkill(isCan)

View File

@ -62,7 +62,6 @@ function Skill:Cast(func)
self.castDoneFunc = func
self.isTriggePassivity=false
self.triggerPassivityId={}
-- 技能效果生效
if self.effectCaster then
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/03/26
@ -126,6 +125,11 @@ end
function Skill:GetDirectTargetsNoExile()
return self.effectCaster:GetDirectTargetsNoExile()
end
-- 获取直接目标,不包含触发不灭的目标,可能为空
function Skill:GetDirectTargetsNoNoDead()
return self.effectCaster:GetDirectTargetsNoNODead()
end
-- 获取技能目标最大人数
function Skill:GetMaxTargetNum()
return self.effectCaster:GetMaxTargetNum()

View File

@ -44,13 +44,26 @@ end
-- 向技能列表中追加技能
function this.AddSkill(caster, effectData, type, targets, isAdd, isRage,isTriggerJudge)
function this.AddSkill(caster, effectData, type, targets, isAdd, isRage,isTriggerJudge,isloop)
-- 如果超出最大限制则不再追加技能
if not this.CheckMaxCount() then
return
end
BattleLogManager.Log(
"Add Skill",
"camp", caster.camp,
"pos", caster.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"isTriggerJudge", tostring(isTriggerJudge),
"targets", targets and #targets or "0"
)
local skill = skillPool:Get()
skill:Init(caster, effectData, type, targets, isAdd, isRage,isTriggerJudge)
if isloop then
skill.isNotLoop=isloop
end
if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列
table.insert(this.DeadSkillList, skill)
else
@ -64,6 +77,18 @@ function this.InsertSkill(caster, effectData, type, targets, isAdd, isRage,isTri
if not this.CheckMaxCount() then
return
end
BattleLogManager.Log(
"Insert Skill",
"camp", caster.camp,
"pos", caster.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"isTriggerJudge", tostring(isTriggerJudge),
"isLoop", tostring(isLoop),
"targets", targets and #targets or "0"
)
local skill = skillPool:Get()
--角色被混乱后