From 26bbd14614eb65bf88cfd8dece34e1f03b7b4756 Mon Sep 17 00:00:00 2001 From: "PC-202302260912\\Administrator" <1769111741@qq.com> Date: Mon, 23 Oct 2023 17:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luafight/Modules/Battle/Data/ConfigData.lua | 1 - luafight/Modules/Battle/Logic/Base/Effect.lua | 112 +++++++++++++++++- .../Battle/Logic/Base/EffectCaster.lua | 5 + .../Modules/Battle/Logic/Base/Passivity.lua | 73 ++++++++++++ luafight/Modules/Battle/Logic/BattleLogic.lua | 6 + .../Battle/Logic/Misc/BattleDefine.lua | 3 +- .../Logic/Monster/MonsterSkill/MSkill.lua | 2 +- .../Modules/Battle/Logic/Role/RoleLogic.lua | 7 +- luafight/Modules/Battle/Logic/Role/Skill.lua | 24 ++-- .../Modules/Battle/Logic/SkillManager.lua | 18 ++- 10 files changed, 234 insertions(+), 17 deletions(-) diff --git a/luafight/Modules/Battle/Data/ConfigData.lua b/luafight/Modules/Battle/Data/ConfigData.lua index 040bfe37a..6ebb0e1fc 100644 --- a/luafight/Modules/Battle/Data/ConfigData.lua +++ b/luafight/Modules/Battle/Data/ConfigData.lua @@ -184,7 +184,6 @@ ConfigName = { Tips = "TipsConfig", Hongmeng = "Hongmeng", HongmengUp = "HongmengUp", - NewHeroConfig = "NewHeroConfig", MainLevelBossConfig = "MainLevelBoss", ActivityGroups = "ActivityGroups", ArroGantFly = "ArroGantFly", diff --git a/luafight/Modules/Battle/Logic/Base/Effect.lua b/luafight/Modules/Battle/Logic/Base/Effect.lua index 1b24d9fd0..cf4dddaa7 100644 --- a/luafight/Modules/Battle/Logic/Base/Effect.lua +++ b/luafight/Modules/Battle/Logic/Base/Effect.lua @@ -54,6 +54,7 @@ end --效果表 local effectList = { + --造成[a]%的[b]伤害 --a[float],b[伤害类型] [1] = function(caster, target, args, interval, skill) @@ -62,6 +63,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () BattleUtil.CalDamage(skill, caster, target, dt, f1) + -- LogError("造成伤害"..os:clock()); end) end, --造成[a]%的[b]伤害【AOE】 @@ -180,7 +182,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () local dmg = BattleUtil.CalDamage(skill, caster, target, dt, f1) - if f2==0 then + if f2==0 or dmg==nil then return end BattleUtil.CalTreat(caster, caster, floor(dmg * f2),1,skill) @@ -3137,6 +3139,49 @@ local effectList = { target:AddBuff(Buff.Create(caster, BuffName.Control, round, ctrType)) end) end, + --近战造成[a]次,[b]%的[C]伤害 + --a[int],b[float],C[伤害类型] + [160] = function(caster, target, args, interval, skill) + local f1 = args[1] + local dt = args[2] + + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) + local skillNumberTime=skill.skillnumberTime or nil + if skillNumberTime and skillNumberTime[1][1]~=0 then + for i = 1, #skillNumberTime do + local index=i + BattleLogic.WaitForTrigger(skillNumberTime[index][2]/1000, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + -- LogError("触发"..index.."次"..skillNumberTime[index][2].."|"..interval) + --LogError("attackdamage"..os.date()) + --LogError("currentframe"..BattleLogic.CurFrame()) + + end) + + end + + else + + BattleLogic.WaitForTrigger(interval, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + --LogError("attackdamage"..os.date()) + end) + end + + end, + --远程造成[a]次,[b]%的[C]伤害 + --a[int],b[float],C[伤害类型] + [161] = function(caster, target, args, interval, skill) + local f1 = args[1] + local dt = args[2] + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) + BattleLogic.WaitForTrigger(interval, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + + end) + end, + + -- --己方场上人数 < 地方人数,对[a]目标选择[b]属性[c]%的法术伤害并附加逆风效果,不低于对[d]目标选择[e]属性[f]%的御甲并附加乘风效果。 -- [160] = function(caster, target, args, interval, skill) -- local c1 = args[1]--持续回合数 @@ -3162,7 +3207,8 @@ local effectList = { --添加一个[a]印记,持续[b]回合 --a[int]:7逆风风 8:顺风风 - [160] = function(caster, target, args, interval, skill) + [162] = function(caster, target, args, interval, skill) + local type = args[1] local round= args[2] BattleLogic.WaitForTrigger(interval, function () @@ -3175,9 +3221,53 @@ local effectList = { target:AddBuff(Buff.Create(caster, BuffName.BreakArmor, round,type)) end) end, - --为目标添加[a]属性[b]%的御甲 + + --近战造成[a]次,[b]%的[C]伤害 + --a[int],b[float],C[伤害类型] + [163] = function(caster, target, args, interval, skill) + local f1 = args[1] + local dt = args[2] + + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) + local skillNumberTime=skill.skillnumberTime or nil + if skillNumberTime and skillNumberTime[1][1]~=0 then + for i = 1, #skillNumberTime do + local index=i + BattleLogic.WaitForTrigger(skillNumberTime[index][2]/1000, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + -- LogError("触发"..index.."次"..skillNumberTime[index][2].."|"..interval) + --LogError("attackdamage"..os.date()) + --LogError("currentframe"..BattleLogic.CurFrame()) + + end) + + end + + else + + BattleLogic.WaitForTrigger(interval, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + --LogError("attackdamage"..os.date()) + end) + end + + end, + --远程造成[a]次,[b]%的[C]伤害 + --a[int],b[float],C[伤害类型] + [164] = function(caster, target, args, interval, skill) + local f1 = args[1] + local dt = args[2] + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) + BattleLogic.WaitForTrigger(interval, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + + end) + end, + --为目标添加[a]属性[b]%的御甲 --a[int],b[float] - [161] = function(caster, target, args, interval, skill) + + [165] = function(caster, target, args, interval, skill) + local pro = args[1] local v1 = args[2] BattleLogic.WaitForTrigger(interval, function () @@ -3187,6 +3277,20 @@ local effectList = { end) end, + --如果目标生命百分比小于等于[a]%,直接斩杀剩余所有血量(御甲无效) + --a[float] + [166] = function(caster, target, args, interval, skill) + local prop = args[1] + local isBoss=BattleUtil.CheckIsBoss(target) + if isBoss then + return + end + local curProp=BattleUtil.GetHPPencent(target) + if curProp>prop then + return + end + BattleUtil.Seckill(skill,caster,target) + end, } return effectList \ No newline at end of file diff --git a/luafight/Modules/Battle/Logic/Base/EffectCaster.lua b/luafight/Modules/Battle/Logic/Base/EffectCaster.lua index c92c11e6c..b05719466 100644 --- a/luafight/Modules/Battle/Logic/Base/EffectCaster.lua +++ b/luafight/Modules/Battle/Logic/Base/EffectCaster.lua @@ -71,6 +71,7 @@ function EffectCaster:DoEffect(caster, target, eff, duration, skill) -- if Effect[e.type] then Effect[e.type](caster, target, e.args, duration, skill) + -- LogError("Ч"..os.date()) end end @@ -135,13 +136,16 @@ function EffectCaster:Cast() local arr = self.effectTargets[i] if arr and #arr > 0 then -- Чӳ1֡Ч + -- LogError("עeffect"..os.date()) BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function() + local effects = effectGroup.effects local weight = math.floor(chooseId % 10000 / 100) local count = math.min(chooseId % 10, #arr) if count == 0 then count = #arr end + -- LogError("ִeffect1"..os.date()) table.sort(arr, function(a, b) return a.position < b.position end) @@ -152,6 +156,7 @@ function EffectCaster:Cast() if i == 1 then self.targetIsHit[arr[j]] = BattleUtil.CheckIsHit(self.skill.owner, arr[j],self.skill) end + --LogError("ִeffect2"..os.date()) self:takeEffect(self.skill.owner, arr[j], effects, i, self.skill.hitTime, self.skill) end end diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index 64729efe9..93031e91d 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -12720,5 +12720,78 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onBattleRoundChange,nil,nil,role) end, + --回合结束时,再次释放一次技能 + --a[int] + [480]=function(role,args,id,judge) + local num=args[1] + local onRoundChange=function(round) + if round<1 then + return + end + role:AddSkill(BattleSkillType.Special, false,true, nil,true) + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundEndBefore, onRoundChange,nil,nil,role) + end, + --释放技能如果造成减怒,对目标造成 减除怒气*属性[a][b]%的伤害,每回合最多触发[c]次 + --a[int],b[float],c[int] + [481]=function(role,args,id,judge) + local f1=args[1] + local v1 =args[2] + local num=args[3] + local triggerNum=0 + local isTrigger=false + local curRound=0 + local onRageChange=function(caster, target, deltaRage,type,value) + if triggerNum>=num then + return + end + if caster~=role then + return + end + if type~=CountTypeName.Sub then + return + end + if (f1==12 or f1==13) and BattleUtil.CheckIsBoss(target) then + return + end + local val = floor(BattleUtil.FP_Mul(v1*value, target:GetRoleData(BattlePropList[f1]))) + BattleUtil.FinalDamageCountShield(nil,role,target,val) + isTrigger=true + end + + + local onSkillCastEnd=function(_skill) + if _skill and not _skill.isTriggerJudge and judge==1 then + return + end + if _skill.owner==role and (_skill.type==BattleSkillType.Special or _skill.type==BattleSkillType.Extra) then + role.Event:AddEvent(BattleEventName.RecordRageChange,onRageChange,nil,nil,role) + end + + end + role.Event:AddEvent(BattleEventName.SkillCast,onSkillCastEnd,nil,nil,role) + + + local onRoleTurn=function(_skill) + if _skill and not _skill.isTriggerJudge and judge==1 then + return + end + if isTrigger then + triggerNum=triggerNum+1 + isTrigger=false + end + role.Event:RemoveEvent(BattleEventName.RecordRageChange,onRageChange,nil,nil,role) + + end + role.Event:AddEvent(BattleEventName.SkillCastBefore,onRoleTurn,nil,nil,role) + + local onRoundChange=function(round) + BattleLogic.WaitForTrigger(2,function() + triggerNum=0 + end) + curRound=round + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, onRoundChange,nil,nil,role) + end, } return passivityList diff --git a/luafight/Modules/Battle/Logic/BattleLogic.lua b/luafight/Modules/Battle/Logic/BattleLogic.lua index 6d0c13120..dcc84ec9b 100644 --- a/luafight/Modules/Battle/Logic/BattleLogic.lua +++ b/luafight/Modules/Battle/Logic/BattleLogic.lua @@ -286,6 +286,7 @@ function BattleLogic.TurnRound(debugTurn) return else -- 上一轮结束 + BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEndBefore, CurRound) BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound) end end @@ -430,6 +431,7 @@ function BattleLogic.CheckBattleLogic() end -- 释放技能后,递归交换阵营 + --RoleLogic SkillRole:CastSkill() end @@ -492,7 +494,9 @@ end function BattleLogic.WaitForTrigger(delayTime, action) + delayTime = BattleUtil.ErrorCorrection(delayTime) + local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5) if delayFrame == 0 then --0延迟的回调直接调用 action() @@ -500,6 +504,7 @@ function BattleLogic.WaitForTrigger(delayTime, action) end local item = actionPool:Get() item[1] = curFrame + delayFrame + --LogError("curFrame"..curFrame+delayFrame) item[2] = action tbActionList:Add(item) end @@ -563,6 +568,7 @@ function BattleLogic.Update() local action = tbActionList.buffer[index] if action[1] <= curFrame then action[2]() + -- LogError("执行帧位"..action[1]) actionPool:Put(action) tbActionList:Remove(index) else diff --git a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua index d58d89875..24fc5332e 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -54,7 +54,7 @@ BattleEventName = { BattleRoundStart = indexAdd(), BattleRoundChange = indexAdd(), BattleRoundEnd = indexAdd(), - + BattleRoundEndBefore = indexAdd(), RoleBeDamaged = indexAdd(), RoleDamage = indexAdd(), RoleBeDamagedBefore = indexAdd(), @@ -242,6 +242,7 @@ RoleDataName = { InitRage = indexAdd(), --初始怒气值 KongBonus = indexAdd(), --时空系伤害加成 KongReduce = indexAdd(), --时空系伤害减免 + PlayerAddSkill = indexAdd(),--主角连击 } -- 战斗表属性id对应战斗中属性数据 diff --git a/luafight/Modules/Battle/Logic/Monster/MonsterSkill/MSkill.lua b/luafight/Modules/Battle/Logic/Monster/MonsterSkill/MSkill.lua index 8799c1b77..b69d15f3d 100644 --- a/luafight/Modules/Battle/Logic/Monster/MonsterSkill/MSkill.lua +++ b/luafight/Modules/Battle/Logic/Monster/MonsterSkill/MSkill.lua @@ -47,7 +47,7 @@ function MSkill:Init(owner, group, index, skillData,playerSkillIndex) self.attackCount = effectData[4] -- 伤害持续时间内伤害次数 -- 初始化 local effects = {} - for i=5, #effectData do + for i=7, #effectData do table.insert(effects, effectData[i]) end self.effectCaster = EffectCaster:New() diff --git a/luafight/Modules/Battle/Logic/Role/RoleLogic.lua b/luafight/Modules/Battle/Logic/Role/RoleLogic.lua index c737bfd3a..6ec7f6d09 100644 --- a/luafight/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/luafight/Modules/Battle/Logic/Role/RoleLogic.lua @@ -190,6 +190,7 @@ function RoleLogic:Init(uid, data, position) end -- 初始怒气值放在被动之后计算,使被动对初始怒气的影响生效 self.Rage = self.Rage + self:GetRoleData(RoleDataName.InitRage)-- 当前怒气值 + --self.readyAction=data.readAction or (ConfigManager.TryGetConfigData(ConfigName.RoleConfig,self.roleId).ReadyAction or 0) end @@ -562,15 +563,17 @@ function RoleLogic:AddSkill(type, isRage, isAdd, targets,isTrigger,isLoop) 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}}} + -- effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{100001,{1,1,1}},self.skill[5],self.skill[6]} + effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4], self.skill[5] , self.skill[6] ,{200221,{1,1,1}}} isTriggerJudge=false end if self.ctrl_lock then type=BattleSkillType.ChaosNormal --嘲讽普攻使用普攻特效 - effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{200221,{1,1,1}}} + --effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{200221,{1,1,1}},self.skill[5],self.skill[6]} isTriggerJudge=false + effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],self.skill[5] , self.skill[6] ,{200221,{1,1,1}}} end SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage,isTriggerJudge,isLoop) diff --git a/luafight/Modules/Battle/Logic/Role/Skill.lua b/luafight/Modules/Battle/Logic/Role/Skill.lua index 0058f43a2..332333f13 100644 --- a/luafight/Modules/Battle/Logic/Role/Skill.lua +++ b/luafight/Modules/Battle/Logic/Role/Skill.lua @@ -9,15 +9,17 @@ function Skill:New() return o end -function Skill:Init(role, effectData, type, targets, isAdd, isRage,isTriggerJudge) --type 0 异妖 1 点技 2 滑技 +function Skill:Init(role, effectData, type, targets, isAdd, isRage,isTriggerJudge,isSpuer) --type 0 异妖 1 点技 2 滑技 self.type = type --skill = {技能ID, 命中时间, 持续时间, 伤害次数, {目标id1, 效果1, 效果2, ...},{目标id2, 效果3, 效果4, ...}, ...} --效果 = {效果类型id, 效果参数1, 效果参数2, ...} self.owner = role self.id = effectData[1] -- 技能ID - self.hitTime = effectData[2] -- 效果命中需要的时间 - self.continueTime = effectData[3] -- 命中后伤害持续时间 - self.attackCount = effectData[4] -- 伤害持续时间内伤害次数 + self.hitTime = effectData[2] -- 效果命中需要的时间a EffectCombat.KeyFrame + self.continueTime = effectData[3] -- 命中后伤害持续时间 EffectCombat.SkillDuration + self.attackCount = effectData[4] -- 伤害持续时间内伤害次数 EffectCombat.SkillNumber + self.skillnumberTime = effectData[5] -- 多段伤害的每段触发时间 + self.AttackDisplaceOffset = effectData[6] -- 位移終點 self.isTriggePassivity = false -- 是否一个技能只触发一次被动 true:每次释放技能只会触发一次 self.triggerPassivityId={} self.isKill = false --是否技能击杀目标 @@ -33,9 +35,10 @@ function Skill:Init(role, effectData, type, targets, isAdd, isRage,isTriggerJudg else self.isTriggerJudge = true end + self.isSpuer=isSpuer -- 初始化 local effects = {} - for i=5, #effectData do + for i=7, #effectData do table.insert(effects, effectData[i]) end self.effectCaster = EffectCaster:New() @@ -63,6 +66,7 @@ end -- 释放技能 -- func 技能释放完成回调 function Skill:Cast(func) + --基本是自身的dispose加回合切换的检测 self.castDoneFunc = func self.isTriggePassivity=false self.triggerPassivityId={} @@ -79,10 +83,14 @@ function Skill:Cast(func) return end --end + --具体effect的触发,注册延迟造成伤害事件 self.effectCaster:Cast() + --LogError(self.id.."釋放完成"..os:clock()) end self.owner.Event:DispatchEvent(BattleEventName.SkillCastBefore, self) -- 释放技能开始 + --playview的技能表现层通过这个触发,具体的在skillcaster里面的skillcast函数 + --LogError("timestart"..os.date()) self.owner.Event:DispatchEvent(BattleEventName.SkillCast, self) BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self) -- 只对效果1的目标发送事件,效果1是技能的直接伤害目标 @@ -90,13 +98,14 @@ function Skill:Cast(func) role.Event:DispatchEvent(BattleEventName.BeSkillCast, self) end) --技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个 - local duration = self.hitTime + self.continueTime + --local duration = self.hitTime + self.continueTime+(self.skillnumberTime[1][1]==0 and 0 or self.skillnumberTime[#self.skillnumberTime][2]/1000) + local duration = self.continueTime -- 结算时间向后延长0.2秒,避免在效果结算完成前就结束了技能释放 local time=1.2 -- if self.id==1282 then -- time=1 -- end - BattleLogic.WaitForTrigger(duration + time, function() + BattleLogic.WaitForTrigger(duration + time+((tonumber(self.skillnumberTime)==nil or self.skillnumberTime[1][1]==0) and 0 or self.skillnumberTime[#self.skillnumberTime][2])/1000, function() self.owner.Event:DispatchEvent(BattleEventName.SkillCastEnd, self) BattleLogic.Event:DispatchEvent(BattleEventName.SkillCastEnd, self) @@ -106,6 +115,7 @@ function Skill:Cast(func) end) -- 技能结束 self:EndSkill() + --LogError("end"..os.date()) --技能消息发送完后 iskill 设置为false self.isKill=false end) diff --git a/luafight/Modules/Battle/Logic/SkillManager.lua b/luafight/Modules/Battle/Logic/SkillManager.lua index d06053333..78d4ad856 100644 --- a/luafight/Modules/Battle/Logic/SkillManager.lua +++ b/luafight/Modules/Battle/Logic/SkillManager.lua @@ -46,6 +46,22 @@ function this.AddMonsterSkill(skill) "pos", skill.owner.position, "type", BattleSkillType.Monster ) + --判断主角连击属性 + local addPro=skill.owner:GetRoleData(RoleDataName.Speed) + if skill.owner.position==100 then + BattleUtil.RandomAction(addPro,function() + if skill.type == BattleSkillType.Monster then + local addSkill=skill + table.insert(this.MonsterSkillList, addSkill) + BattleLogManager.Log( + "Add Monster continue Skill", + "camp", skill.owner.camp, + "pos", skill.owner.position, + "type", BattleSkillType.Monster + ) + end + end) + end return skill end @@ -211,7 +227,7 @@ function this.Update() return end - + if this.MonsterSkillList and #this.MonsterSkillList > 0 then local skill = this.MonsterSkillList[1] table.remove(this.MonsterSkillList, 1)