支援间隔

This commit is contained in:
chenxi 2023-04-19 12:23:56 +08:00
parent fa4e1ebd3c
commit 37476932d7
7 changed files with 85 additions and 45 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -72,6 +72,7 @@ BattleConst.UNIT_STATE = {
SWITCH_IN = 7, -- 入场
SWITCH_OUT = 8, -- 离场
ASSISTING_ATTACK = 9, -- 协助攻击
WAIT = 10, -- 等待
}
BattleConst.MATCH_DMG_ADDITION_NAME = {

View File

@ -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,12 +232,24 @@ 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 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
function BattleUnitComp:useSkill(index, count, callback)
self.actionOverCallback = callback
@ -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

View File

@ -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

View File

@ -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