先手buff

This commit is contained in:
xiekaidong 2023-05-10 10:10:58 +08:00
parent c9558d872e
commit e6ee7b0093
5 changed files with 82 additions and 69 deletions

View File

@ -406,7 +406,7 @@ local buff = {
},
[59]={
["name"]="first_hand",
["buff_type"]=7,
["buff_type"]=1,
["decr"]=1
},
[60]={
@ -421,13 +421,13 @@ local buff = {
},
[62]={
["name"]="counterattack",
["buff_type"]=7,
["buff_type"]=1,
["stack"]=1,
["decr"]=1
},
[63]={
["name"]="thorns",
["buff_type"]=7,
["buff_type"]=1,
["decr"]=1
},
[64]={

View File

@ -53,10 +53,10 @@ BattleConst.BATTLE_ROUND_STEP = {
ON_BEGIN = 1, -- 回合开始
ON_ELIMINATION_BEGIN = 3, -- 消除开始
ON_ELIMINATION = 4, -- 等待消除
ON_ATK_STEP = 5, -- 攻击方行动
ON_ATK_STEP_OVER = 6, -- 攻击方行动结束(可能直接跳转到刷新棋盘/回合结束)
ON_TEAM_ACTION = 5, -- 队伍行动
ON_ATK_STEP = 6, -- 攻击方行动
ON_DEF_STEP = 7, -- 防守方行动
ON_DEF_STEP_OVER = 8, -- 防守方行动结束(可能直接跳转到刷新棋盘/回合结束)
ON_TEAM_ACTION_OVER = 8, -- 攻击方行动结束(可能直接跳转到刷新棋盘/回合结束/进入下一个队伍行动)
ON_REFRESH_BOARD = 9, -- 刷新棋盘
ON_END = 10, -- 回合结束
}
@ -249,6 +249,7 @@ local BUFF_NAME = {
LOCK = "lock",
UNDEAD = "undead",
THORNS = "thorns",
FIRST_HAND = "first_hand",
}
BattleConst.BUFF_NAME = BUFF_NAME
@ -296,6 +297,7 @@ local ATTR_NAME = {
LETHARGY = "lethargy",
UNDEAD = "undead",
THORNS = "thorns",
FIRST_HAND = "first_hand",
}
BattleConst.ATTR_NAME = ATTR_NAME
@ -336,6 +338,7 @@ BattleConst.BUFF_NAME_TO_ATTR = {
[BUFF_NAME.WEAKEN] = {ATTR_NAME.DMG_DEC_ALL, false},
[BUFF_NAME.CURSE] = {ATTR_NAME.BE_DMG_TO_HEAL, false},
[BUFF_NAME.THORNS] = {ATTR_NAME.THORNS, false},
[BUFF_NAME.FIRST_HAND] = {ATTR_NAME.FIRST_HAND, false},
}
---- 格子类型

View File

@ -523,74 +523,76 @@ function BattleController:enterElimination(needDelay)
end
end
function BattleController:enterAtkStep()
function BattleController:enterBattleStep()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION
if not self.battleTeamActionList then
self.battleTeamActionList = {}
else
for i = #self.battleTeamActionList, 1, -1 do
self.battleTeamActionList[i] = nil
end
end
local atkAction = function()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
self:exeInstructions(function()
self:enterAtkStepOver()
self:enterNextTeamAction()
end)
end
local defAction = function()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
self.defTeam:mainUnitUseAllSkills(function()
self:enterNextTeamAction()
end)
end
if self.battleData:getAtkTeam():getFirstHand() < self.battleData:getDefTeam():getFirstHand() then
table.insert(self.battleTeamActionList, defAction)
table.insert(self.battleTeamActionList, atkAction)
else
table.insert(self.battleTeamActionList, atkAction)
table.insert(self.battleTeamActionList, defAction)
end
self:enterNextTeamAction()
end
function BattleController:enterNextTeamAction()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION_OVER
self:hideCombo()
local atkTeam = self.battleData:getAtkTeam()
if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算
self:enterNextWave()
return
end
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd()
else
self.defTeam:removeAllBuff()
self:onDefDead()
self:enterRefreshBoard()
end
return
end
if not self.battleTeamActionList or not self.battleTeamActionList[1] then
self:enterRefreshBoard()
return
end
local action = table.remove(self.battleTeamActionList, 1)
action()
end
function BattleController:getIsAtkStep()
return self.roundStep == BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
end
function BattleController:enterAtkStepOver()
self:hideCombo()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP_OVER
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd()
else
self.defTeam:removeAllBuff()
self:onDefDead()
self:enterRefreshBoard()
end
return
end
local atkTeam = self.battleData:getAtkTeam()
if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算
self:enterNextWave()
return
end
self:enterDefStep()
end
function BattleController:enterDefStep()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
self.defTeam:mainUnitUseAllSkills(function()
self:enterDefStepOver()
end)
end
function BattleController:enterDefStepOver()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP_OVER
local atkTeam = self.battleData:getAtkTeam()
if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算
self:enterNextWave()
return
end
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
if self.waveIndex >= self.maxWaveIndex then
self:enterRoundEnd()
else
self.defTeam:removeAllBuff()
self:onDefDead()
self:enterRefreshBoard()
end
return
end
self:enterRefreshBoard()
end
function BattleController:enterRefreshBoard()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_REFRESH_BOARD
self:fillBoard()
@ -996,7 +998,7 @@ function BattleController:onLinkOver()
self.battleUI:disableUITouch()
self.battleUI:eliminationAni(sequence, function()
self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementType, elementTypeMap)
self:enterAtkStep()
self:enterBattleStep()
end)
self.eliminateCount = self.eliminateCount + 1

View File

@ -205,6 +205,10 @@ function BattleTeamEntity:getExpTime()
return self.attr.exp_time or 0
end
function BattleTeamEntity:getFirstHand()
return self.attr.first_hand or 0
end
function BattleTeamEntity:addMaxHp(num)
local hpBefore = self.attr.hp
local currPercent = hpBefore * DEFAULT_FACTOR // self.attr.max_hp

View File

@ -310,6 +310,10 @@ function BattleUnitEntity:getThorns()
return self.team:getThorns()
end
function BattleUnitEntity:getFirstHand()
return self.team:getFirstHand()
end
function BattleUnitEntity:addLimit(name, buffEffect)
self.team:addLimit(name, buffEffect)
end