From fdbafd1dfe6978d6ed3fbd64aa1976aacffd8ed5 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 30 May 2023 15:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=88=98?= =?UTF-8?q?=E6=96=97=E5=86=85=E4=BD=BF=E7=94=A8=E7=9A=84gm=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_manager.lua | 4 ++++ lua/app/module/gm/gm_const.lua | 10 ++++++++ lua/app/ui/gm/gm_tool_ui.lua | 29 +++++++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index a2538091..621beb99 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -41,6 +41,10 @@ function BattleManager:rspSkillRefresh(result) end end +function BattleManager:isInBattle() + return self.battleController ~= nil +end + function BattleManager:playBattle(battleType, params, returnFunc) params = params or {} if self.battleController then -- 同一时间只能有一场战斗 diff --git a/lua/app/module/gm/gm_const.lua b/lua/app/module/gm/gm_const.lua index c2b0bef8..5aa68163 100644 --- a/lua/app/module/gm/gm_const.lua +++ b/lua/app/module/gm/gm_const.lua @@ -81,6 +81,16 @@ arg2:任务参数 Example: trig_event 22 5]], type = "trig_event" }, + { + title = "添加buff", + desc = [[添加buff type:add_buff +arg1:buff名字 +arg2:buff参数 +arg3:buff回合数 +arg4:buff生效对象,1己方,2敌方 +Example: add_buff atkp_add 5000 2 1]], + type = "add_buff" + }, } return GMConst \ No newline at end of file diff --git a/lua/app/ui/gm/gm_tool_ui.lua b/lua/app/ui/gm/gm_tool_ui.lua index d6d43aa8..593213cc 100644 --- a/lua/app/ui/gm/gm_tool_ui.lua +++ b/lua/app/ui/gm/gm_tool_ui.lua @@ -89,7 +89,13 @@ function GMToolUI:sendMsg(gmCommand) else local args = {} args.args = string.split(gmCommand, " ") - if args.args[1] == "time" then -- 特殊处理 + if args.args[1] == "add_buff" then -- 特殊处理 + if not ModuleManager.BattleManager:isInBattle() then + Logger.logHighlight("不在战斗中") + return + end + self:dealAddBuffGm(args) + elseif args.args[1] == "time" then -- 特殊处理 local args1 = {} args1.args = {} args1.args[1] = args.args[1] @@ -106,4 +112,25 @@ function GMToolUI:updateTime() uiMap["gm_tool_ui.time"]:setText(Time:formatTimeYMDHMS(Time:getServerTime())) end +function GMToolUI:dealAddBuffGm(args) + local battleController = ModuleManager.BattleManager.battleController + local effect = { + ["type"]=args.args[2], + ["num"]=tonumber(args.args[3]), + ["ratio"]=10000, + ["round"]=tonumber(args.args[4]) + } + local targetUnit = battleController.atkTeam:getMainUnit() + if tonumber(args.args[5]) == GConst.BattleConst.SIDE_DEF then + targetUnit = battleController.defTeam:getMainUnit() + end + + local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" + local buffEntity = BattleBuffEntity:create() + buffEntity:init(effect, targetUnit.unitEntity) + buffEntity:setTargetSide(targetUnit) + targetUnit:takeEffect(buffEntity, targetUnit) + self:closeUI() +end + return GMToolUI