From e8d68d89729f0fcc368bf27f1eed25f4b52a9b4b Mon Sep 17 00:00:00 2001 From: wangyuan Date: Mon, 2 Sep 2019 16:32:32 +0800 Subject: [PATCH] luafight --- .../Modules/Battle/Logic/Base/Passivity.lua | 57 +++++++++++++++++++ luafight/Modules/Battle/Logic/Base/Skill.lua | 12 +++- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 1 + luafight/Modules/Battle/Logic/RoleLogic.lua | 3 +- 4 files changed, 69 insertions(+), 4 deletions(-) diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index e784b363a..96742ff02 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -887,5 +887,62 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) end, + + --战斗中,每[a]秒增加[b]%的异妖能量 + --a[int],b[float] + [50] = function(role, args) + local f1 = args[1] + local f2 = args[2] + + local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r) + BattleLogic.AddMP(role.camp, f2 * 100) + end) + auraBuff.interval = f1 + BattleLogic.BuffMgr:AddBuff(role, auraBuff) + end, + + --战斗中,初始拥有[a]%的异妖能量 + --a[float] + [51] = function(role, args) + local f1 = args[1] + BattleLogic.AddMP(role.camp, f1 * 100) + end, + + --战斗中,队伍每损失[a]%的生命值,增加[b]%的异妖能量 + --a[float],b[float] + [52] = function(role, args) + local f1 = args[1] + local f2 = args[2] + + local maxHp = 0 + local curHp = 0 + if f1 == 0 then + return + end + local curHpGears = 0 + local arr = BattleUtil.ChooseTarget(role, 10000) + for i=1, #arr do + curHp = curHp + arr[i]:GetRoleData(RoleDataName.Hp) + maxHp = maxHp + arr[i]:GetRoleData(RoleDataName.MaxHp) + end + + local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r) + local hp = 0 + for i=1, #arr do + hp = hp + arr[i]:GetRoleData(RoleDataName.Hp) + end + + if hp < curHp then + local gears = floor((maxHp - hp) / (f1 * maxHp)) + if gears > curHpGears then + BattleLogic.AddMP(role.camp, f2 * (gears - curHpGears) * 100) + curHpGears = gears + end + curHp = hp + end + end) + auraBuff.interval = 0 + BattleLogic.BuffMgr:AddBuff(role, auraBuff) + end, } return passivityList \ No newline at end of file diff --git a/luafight/Modules/Battle/Logic/Base/Skill.lua b/luafight/Modules/Battle/Logic/Base/Skill.lua index 81e45bbb8..d3c18517a 100644 --- a/luafight/Modules/Battle/Logic/Base/Skill.lua +++ b/luafight/Modules/Battle/Logic/Base/Skill.lua @@ -146,7 +146,11 @@ function Skill:Cast() if self.owner.superSkill == self then self.sp = 0 self.spPass = floor(self.cd * BattleLogic.GameFrameRate) - BattleLogic.AddMP(self.owner.camp, 10) + if BattleLogic.Type == 4 then --秘境boss的能量特殊处理 + BattleLogic.AddMP(self.owner.camp, 20) + else + BattleLogic.AddMP(self.owner.camp, 10) + end if self.owner.skill then local skill = self.owner.skill skill.sp = 0 @@ -155,7 +159,11 @@ function Skill:Cast() else self.sp = 0 self.spPass = floor(time * BattleLogic.GameFrameRate) - BattleLogic.AddMP(self.owner.camp, 5) + if BattleLogic.Type == 4 then --秘境boss的能量特殊处理 + BattleLogic.AddMP(self.owner.camp, 20) + else + BattleLogic.AddMP(self.owner.camp, 5) + end end self.owner.Event:DispatchEvent(BattleEventName.SkillCast, self) else diff --git a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua index 61848666f..6bacb5a91 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -6,6 +6,7 @@ local min = math.min --local Random = Random --local RoleDataName = RoleDataName --local BattleEventName = BattleEventName +BattleUtil.Passivity = require("Modules/Battle/Logic/Base/Passivity") local function clamp(v, minValue, maxValue) if v < minValue then diff --git a/luafight/Modules/Battle/Logic/RoleLogic.lua b/luafight/Modules/Battle/Logic/RoleLogic.lua index e40e0cbc6..9126d5e34 100644 --- a/luafight/Modules/Battle/Logic/RoleLogic.lua +++ b/luafight/Modules/Battle/Logic/RoleLogic.lua @@ -7,7 +7,6 @@ local Random = Random local floor = math.floor local max = math.max local min = math.min -local Passivity = require("Modules/Battle/Logic/Base/Passivity") local aiList = { [0] = function(skill, superSkill) --默认75%释放点击技、25%释放上滑技 @@ -85,7 +84,7 @@ function RoleLogic:Init(uid, data) for j = 2, #v do args[j-1] = v[j] end - Passivity[id](self, args) + BattleUtil.Passivity[id](self, args) end end