From 37476932d730b5f6ab44306f0c95b599e62f5344 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Apr 2023 12:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8F=B4=E9=97=B4=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/config/buff.lua | 57 +++++++++---------- lua/app/config/const.lua | 5 +- lua/app/config/skill.lua | 4 +- lua/app/module/battle/battle_const.lua | 1 + .../battle/component/battle_unit_comp.lua | 51 +++++++++++++---- .../module/battle/helper/battle_helper.lua | 7 +++ lua/app/module/battle/team/battle_team.lua | 5 +- 7 files changed, 85 insertions(+), 45 deletions(-) diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index dcb0bca9..ab7746ba 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -182,10 +182,6 @@ local buff = { } }, [33]={ - ["name"]="heal_normal_attack", - ["buff_type"]=1 - }, - [34]={ ["name"]="stun", ["buff_type"]=8, ["icon"]="stun", @@ -193,60 +189,60 @@ local buff = { 4001 } }, - [35]={ + [34]={ ["name"]="shield", ["buff_type"]=2, ["fx_continued"]={ 4001 } }, - [36]={ + [35]={ ["name"]="atkp_add", ["buff_type"]=1 }, - [37]={ + [36]={ ["name"]="normal_attack_dec", ["buff_type"]=1, ["fx_continued"]={ 4001 } }, - [38]={ + [37]={ ["name"]="normal_attack_add", ["buff_type"]=1, ["fx_continued"]={ 4001 } }, - [39]={ + [38]={ ["name"]="block", ["buff_type"]=1 }, - [40]={ + [39]={ ["name"]="hpp_add", ["buff_type"]=1 }, - [41]={ + [40]={ ["name"]="crit_add", ["buff_type"]=1 }, - [42]={ + [41]={ ["name"]="crit_time_add", ["buff_type"]=1 }, - [43]={ + [42]={ ["name"]="exp_time_add", ["buff_type"]=7 }, - [44]={ + [43]={ ["name"]="cured_add", ["buff_type"]=1 }, - [45]={ + [44]={ ["name"]="add_skill", ["buff_type"]=7 }, - [46]={ + [45]={ ["name"]="skill_fire_times", ["buff_type"]=7 } @@ -285,25 +281,24 @@ local keys = { ["atkp_purple_add"]=buff[30], ["wavehealp"]=buff[31], ["heal"]=buff[32], - ["heal_normal_attack"]=buff[33], - ["stun"]=buff[34], - ["shield"]=buff[35], - ["atkp_add"]=buff[36], - ["normal_attack_dec"]=buff[37], - ["normal_attack_add"]=buff[38], - ["block"]=buff[39], - ["hpp_add"]=buff[40], - ["crit_add"]=buff[41], - ["crit_time_add"]=buff[42], - ["exp_time_add"]=buff[43], - ["cured_add"]=buff[44], - ["add_skill"]=buff[45], - ["skill_fire_times"]=buff[46] + ["stun"]=buff[33], + ["shield"]=buff[34], + ["atkp_add"]=buff[35], + ["normal_attack_dec"]=buff[36], + ["normal_attack_add"]=buff[37], + ["block"]=buff[38], + ["hpp_add"]=buff[39], + ["crit_add"]=buff[40], + ["crit_time_add"]=buff[41], + ["exp_time_add"]=buff[42], + ["cured_add"]=buff[43], + ["add_skill"]=buff[44], + ["skill_fire_times"]=buff[45] } } local config = { data=buff, keys=keys, -count=46 +count=45 } return config \ No newline at end of file diff --git a/lua/app/config/const.lua b/lua/app/config/const.lua index 6dcf6fe1..b2e5b217 100644 --- a/lua/app/config/const.lua +++ b/lua/app/config/const.lua @@ -1,9 +1,12 @@ local const = { ["element_combo"]={ ["value"]=2 + }, + ["support_interval"]={ + ["value"]=500 } } local config = { -data=const,count=1 +data=const,count=2 } return config \ No newline at end of file diff --git a/lua/app/config/skill.lua b/lua/app/config/skill.lua index 73f92706..63222814 100644 --- a/lua/app/config/skill.lua +++ b/lua/app/config/skill.lua @@ -196,10 +196,10 @@ local skill = { }, [14]={ ["effect_type"]=2, - ["trigger"]=3, + ["trigger"]=5, ["effect"]={ { - ["type"]="heal_normal_attack", + ["type"]="heal", ["num"]=500, ["ratio"]=10000, ["round"]=1 diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 0272071b..4f3da124 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -72,6 +72,7 @@ BattleConst.UNIT_STATE = { SWITCH_IN = 7, -- 入场 SWITCH_OUT = 8, -- 离场 ASSISTING_ATTACK = 9, -- 协助攻击 + WAIT = 10, -- 等待 } BattleConst.MATCH_DMG_ADDITION_NAME = { diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 95a2425e..0c9303c4 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -222,7 +222,7 @@ function BattleUnitComp:beforeAttack() self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self) end -function BattleUnitComp:useAssistingSkill(count, callback) +function BattleUnitComp:useAssistingSkill(count, delay, callback) local skill = self.unitEntity:getAssistingSkill() if skill == nil then callback() @@ -232,10 +232,22 @@ function BattleUnitComp:useAssistingSkill(count, callback) local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()] self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, count*DEFAULT_FACTOR, true) self.actionOverCallback = callback - if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then - self.actionOverCallback = nil - self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) - callback() + if delay > 0 then + self.waitTime = delay + self.waitingState = UNIT_STATE.ASSISTING_ATTACK + if not self:changeState(UNIT_STATE.WAIT) then + if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then + self.actionOverCallback = nil + self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) + callback() + end + end + else + if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then + self.actionOverCallback = nil + self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) + callback() + end end end @@ -341,6 +353,8 @@ function BattleUnitComp:changeState(state) self:exitSwitchInState() elseif self.currState == UNIT_STATE.SWITCH_OUT then self:exitSwitchOutState() + elseif self.currState == UNIT_STATE.WAIT then + self:exitWaitState() end -- 进入目标状态 self.currState = state @@ -350,18 +364,20 @@ function BattleUnitComp:changeState(state) self:enterNormalAttackState() elseif state == UNIT_STATE.SKILL_ATTACK then self:enterSkillAttackState() - elseif self.currState == UNIT_STATE.ASSISTING_ATTACK then + elseif state == UNIT_STATE.ASSISTING_ATTACK then self:enterAssistingAttackState() elseif state == UNIT_STATE.DEAD then self:enterDeadState() - elseif self.currState == UNIT_STATE.BORN then + elseif state == UNIT_STATE.BORN then self:enterBornState() - elseif self.currState == UNIT_STATE.ENTER_BATTLEFIELD then + elseif state == UNIT_STATE.ENTER_BATTLEFIELD then self:enterEnterBattlefieldState() - elseif self.currState == UNIT_STATE.SWITCH_IN then + elseif state == UNIT_STATE.SWITCH_IN then self:enterSwitchInState() - elseif self.currState == UNIT_STATE.SWITCH_OUT then + elseif state == UNIT_STATE.SWITCH_OUT then self:enterSwitchOutState() + elseif state == UNIT_STATE.WAIT then + self:enterWaitState() end return true end @@ -498,6 +514,19 @@ function BattleUnitComp:updateHurt(dt) end end +function BattleUnitComp:enterWaitState() +end + +function BattleUnitComp:exitWaitState() +end + +function BattleUnitComp:updateWaitState(dt) + self.waitTime = self.waitTime - dt + if self.waitTime < 0 then + self:changeState(self.waitingState) + end +end + function BattleUnitComp:enterAssistingAttackState() self.attackOver = false self.attackTime = 0 @@ -989,6 +1018,8 @@ function BattleUnitComp:tick(dt) self:updateSwitchInState(dt) elseif self.currState == UNIT_STATE.SWITCH_OUT then self:updateSwitchOutState(dt) + elseif self.currState == UNIT_STATE.WAIT then + self:updateWaitState(dt) end end diff --git a/lua/app/module/battle/helper/battle_helper.lua b/lua/app/module/battle/helper/battle_helper.lua index 34f847b5..55d50e02 100644 --- a/lua/app/module/battle/helper/battle_helper.lua +++ b/lua/app/module/battle/helper/battle_helper.lua @@ -30,6 +30,13 @@ function BattleHelper:random(min, max) return min + self.seed*(max - min + 1)//233280 end +function BattleHelper:getSupportInterval() + if self.supportInterval == nil then + self.supportInterval = GFunc.getConstIntValue("support_interval")/1000 + end + return self.supportInterval +end + function BattleHelper:loadBattleHeroModel(id, parent, callback) local pool = self.characterPools[id] if pool and #pool > 0 then diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 6a9aef06..7271c321 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -1,4 +1,5 @@ local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle" +local BattleHelper = require "app/module/battle/helper/battle_helper" local BattleTeam = class("BattleTeam") @@ -88,11 +89,13 @@ function BattleTeam:useAssistingSkill(assistingList, callback) callback() end end + local delay = 0 for _, v in ipairs(assistingList) do local unit = self.unitMap[v.skillMatch] if unit then unit:resetBeforeAttack() - unit:useAssistingSkill(v.count, finish) + unit:useAssistingSkill(v.count, delay, finish) + delay = delay + BattleHelper:getSupportInterval() else finish() end