Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
chenxi 2023-04-14 18:22:39 +08:00
commit 0d084c0438
9 changed files with 305 additions and 120 deletions

View File

@ -42,10 +42,10 @@ local buff = {
["icon"]="dec_dmg_red_add"
},
[8]={
["name"]="dec_dmg_ryellow_add",
["name"]="dec_dmg_yellow_add",
["buff_type"]=1,
["decr"]=1,
["icon"]="dec_dmg_ryellow_add"
["icon"]="dec_dmg_yellow_add"
},
[9]={
["name"]="dec_dmg_green_add",
@ -136,12 +136,42 @@ local buff = {
["name"]="dmg_addition_all_add"
},
[25]={
["name"]="atkp_color_add",
["buff_type"]=1,
["decr"]=1
},
[26]={
["name"]="atkp_red_add",
["buff_type"]=1,
["decr"]=1
},
[27]={
["name"]="atkp_yellow_add",
["buff_type"]=1,
["decr"]=1
},
[28]={
["name"]="atkp_green_add",
["buff_type"]=1,
["decr"]=1
},
[29]={
["name"]="atkp_blue_add",
["buff_type"]=1,
["decr"]=1
},
[30]={
["name"]="atkp_purple_add",
["buff_type"]=1,
["decr"]=1
},
[31]={
["name"]="wavehealp",
["buff_type"]=5,
["decr"]=3,
["formula"]=2
},
[26]={
[32]={
["name"]="heal",
["buff_type"]=5,
["decr"]=3,
@ -150,7 +180,7 @@ local buff = {
4001
}
},
[27]={
[33]={
["name"]="hit_heal",
["buff_type"]=5,
["decr"]=3,
@ -159,7 +189,7 @@ local buff = {
4001
}
},
[28]={
[34]={
["name"]="stun",
["buff_type"]=8,
["decr"]=2,
@ -168,12 +198,12 @@ local buff = {
4001
}
},
[29]={
[35]={
["name"]="hit_stun",
["buff_type"]=8,
["decr"]=2
},
[30]={
[36]={
["name"]="shield",
["buff_type"]=2,
["decr"]=1,
@ -181,22 +211,22 @@ local buff = {
4001
}
},
[31]={
[37]={
["name"]="atkp_add",
["buff_type"]=1,
["decr"]=1
},
[32]={
[38]={
["name"]="atkp_add_defenderhp",
["buff_type"]=1,
["decr"]=1
},
[33]={
[39]={
["name"]="atkp_add_connect",
["buff_type"]=1,
["decr"]=3
},
[34]={
[40]={
["name"]="spd_dec",
["buff_type"]=8,
["decr"]=2,
@ -204,51 +234,21 @@ local buff = {
4001
}
},
[35]={
[41]={
["name"]="block",
["buff_type"]=1,
["decr"]=1
},
[36]={
[42]={
["name"]="hit_block",
["buff_type"]=1,
["decr"]=1
},
[37]={
[43]={
["name"]="atk_times_add",
["buff_type"]=7,
["decr"]=1
},
[38]={
["name"]="atkp_color_add",
["buff_type"]=1,
["decr"]=1
},
[39]={
["name"]="atkp_red_add",
["buff_type"]=1,
["decr"]=1
},
[40]={
["name"]="atkp_yellow_add",
["buff_type"]=1,
["decr"]=1
},
[41]={
["name"]="atkp_green_add",
["buff_type"]=1,
["decr"]=1
},
[42]={
["name"]="atkp_blue_add",
["buff_type"]=1,
["decr"]=1
},
[43]={
["name"]="atkp_purple_add",
["buff_type"]=1,
["decr"]=1
},
[44]={
["name"]="hpp_add",
["buff_type"]=1,
@ -299,7 +299,7 @@ local keys = {
["hurt_blue"]=buff[5],
["hurt_purple"]=buff[6],
["dec_dmg_red_add"]=buff[7],
["dec_dmg_ryellow_add"]=buff[8],
["dec_dmg_yellow_add"]=buff[8],
["dec_dmg_green_add"]=buff[9],
["dec_dmg_blue_add"]=buff[10],
["dec_dmg_purple_add"]=buff[11],
@ -316,25 +316,25 @@ local keys = {
["dmg_addition_blue_add"]=buff[22],
["dmg_addition_purple_add"]=buff[23],
["dmg_addition_all_add"]=buff[24],
["wavehealp"]=buff[25],
["heal"]=buff[26],
["hit_heal"]=buff[27],
["stun"]=buff[28],
["hit_stun"]=buff[29],
["shield"]=buff[30],
["atkp_add"]=buff[31],
["atkp_add_defenderhp"]=buff[32],
["atkp_add_connect"]=buff[33],
["spd_dec"]=buff[34],
["block"]=buff[35],
["hit_block"]=buff[36],
["atk_times_add"]=buff[37],
["atkp_color_add"]=buff[38],
["atkp_red_add"]=buff[39],
["atkp_yellow_add"]=buff[40],
["atkp_green_add"]=buff[41],
["atkp_blue_add"]=buff[42],
["atkp_purple_add"]=buff[43],
["atkp_color_add"]=buff[25],
["atkp_red_add"]=buff[26],
["atkp_yellow_add"]=buff[27],
["atkp_green_add"]=buff[28],
["atkp_blue_add"]=buff[29],
["atkp_purple_add"]=buff[30],
["wavehealp"]=buff[31],
["heal"]=buff[32],
["hit_heal"]=buff[33],
["stun"]=buff[34],
["hit_stun"]=buff[35],
["shield"]=buff[36],
["atkp_add"]=buff[37],
["atkp_add_defenderhp"]=buff[38],
["atkp_add_connect"]=buff[39],
["spd_dec"]=buff[40],
["block"]=buff[41],
["hit_block"]=buff[42],
["atk_times_add"]=buff[43],
["hpp_add"]=buff[44],
["crit_add"]=buff[45],
["crit_time_add"]=buff[46],

View File

@ -1,7 +1,6 @@
local skill = {
[1]={
["method"]=2,
["skill_type"]=0,
["position"]=1,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -15,6 +14,7 @@ local skill = {
["skill_position"]=1
},
[2]={
["position"]=2,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -28,6 +28,7 @@ local skill = {
["skill_position"]=1
},
[3]={
["position"]=3,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -41,6 +42,7 @@ local skill = {
["skill_position"]=1
},
[4]={
["position"]=4,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -54,6 +56,7 @@ local skill = {
["skill_position"]=1
},
[5]={
["position"]=5,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -67,8 +70,7 @@ local skill = {
["skill_position"]=1
},
[6]={
["method"]=2,
["skill_type"]=0,
["position"]=1,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -82,6 +84,7 @@ local skill = {
["skill_position"]=2
},
[7]={
["position"]=2,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -95,6 +98,7 @@ local skill = {
["skill_position"]=2
},
[8]={
["position"]=3,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -108,6 +112,7 @@ local skill = {
["skill_position"]=2
},
[9]={
["position"]=4,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -121,6 +126,7 @@ local skill = {
["skill_position"]=2
},
[10]={
["position"]=5,
["effect_type"]=1,
["trigger"]=1,
["effect"]={
@ -163,7 +169,7 @@ local skill = {
["trigger"]=1,
["effect"]={
{
["type"]="hurt",
["type"]="hurt_yellow",
["num"]=20000,
["ratio"]=10000,
["round"]=0
@ -202,7 +208,7 @@ local skill = {
["trigger"]=1,
["effect"]={
{
["type"]="hurt",
["type"]="hurt_yellow",
["num"]=20000,
["ratio"]=10000,
["round"]=0
@ -398,7 +404,7 @@ local skill = {
["trigger"]=1,
["effect"]={
{
["type"]="hurt",
["type"]="hurt_blue",
["num"]=15000,
["ratio"]=10000,
["round"]=0
@ -441,7 +447,7 @@ local skill = {
["trigger"]=1,
["effect"]={
{
["type"]="hurt",
["type"]="hurt_blue",
["num"]=15000,
["ratio"]=10000,
["round"]=0

View File

@ -445,7 +445,7 @@ local skill_rogue = {
["type"]=5,
["effect"]={
{
["type"]="dec_dmg_add",
["type"]="weakness_all_add",
["num"]=1000,
["ratio"]=10000,
["round"]=999

View File

@ -23,6 +23,19 @@ BattleConst.UNIT_FRONT_DISTANCE = 50
BattleConst.MOVE_SPEED = 500 -- 战斗单位的移动速度
BattleConst.HURT_STATE_CRIT = 1 -- 暴击
BattleConst.BATTLE_ROUND_STEP = {
WAIT_BEGIN = 0, -- 等待开始
ON_BEGIN = 1, -- 回合开始
ON_ELIMINATION_BEGIN = 3, -- 消除开始
ON_ELIMINATION = 4, -- 等待消除
ON_ATK_STEP = 5, -- 攻击方行动
ON_ATK_STEP_OVER = 6, -- 攻击方行动结束(可能直接跳转到刷新棋盘/回合结束)
ON_DEF_STEP = 7, -- 防守方行动
ON_DEF_STEP_OVER = 8, -- 防守方行动结束(可能直接跳转到刷新棋盘/回合结束)
ON_REFRESH_BOARD = 9, -- 刷新棋盘
ON_END = 10, -- 回合结束
}
-- 为方便存储,这里使用字符串
BattleConst.BATTLE_TYPE = {
STAGE = "1",

View File

@ -98,13 +98,19 @@ function BattleController:onLinkChange()
end
self.battleUI:refreshSkill(elementTypeMap)
Logger.logHighlight("---------onLinkChange--------------")
Logger.printTable(elementTypeMap)
if mainElementType then
Logger.logHighlight("mainElementType " .. mainElementType)
end
end
function BattleController:onRoundBegin()
end
function BattleController:onEliminationBegin()
end
-- *************各个子模块的战斗需要重写的方法 END*************
function BattleController:ctor()
@ -114,7 +120,10 @@ end
function BattleController:init(params)
params = params or {}
self.chapterId = self:getChapterId()
self.waveIndex = 1
self.waveIndex = 0
self.maxWaveIndex = self:getMaxWave()
self.victory = false
self.roundStep = BattleConst.BATTLE_ROUND_STEP.WAIT_BEGIN
self.atkUnits = {}
self.defUnits = {}
self.allUnits = {}
@ -125,7 +134,6 @@ function BattleController:init(params)
BattleScheduler:init()
BattleHelper:init()
self:prepareFight()
self:battleStart()
end
function BattleController:prepareFight()
@ -144,7 +152,7 @@ function BattleController:prepareFight()
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
self:initAtkUnits(onPreloadFinished)
self:initDefUnits(onPreloadFinished)
self:generateBoard()
self:battleStart()
end)
self:loadOtherRes(onPreloadFinished)
end
@ -195,9 +203,117 @@ function BattleController:battleStart()
self.tickSid = BattleScheduler:scheduleGlobal(function(dt)
self:_tick(dt)
end, 0)
self:enterNextWave()
end
---- start 回合步骤
function BattleController:enterNextWave()
local atkTeam = self.battleData:getAtkTeam()
if not atkTeam or atkTeam:getIsDead() then
self.victory = false
self:battleEnd()
return
end
if self.waveIndex >= self.maxWaveIndex then
self.victory = true
self:battleEnd()
return
end
self.waveIndex = self.waveIndex + 1
if self.waveIndex == 1 then -- 第一波
self:generateBoard()
return
end
if self.isBossWave then -- 如果上一波是boss波次则重新生成棋盘
self:putBoardCacheSkill(function()
self:generateBoard()
end)
else
self:enterRoundBegin()
end
end
function BattleController:enterRoundBegin()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN
self:onRoundBegin()
self:enterEliminationBegin()
end
function BattleController:enterEliminationBegin()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN
self:onEliminationBegin()
self:popBoardCacheSkill(function()
self:enterElimination()
end)
end
function BattleController:enterElimination()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
end
function BattleController:enterAtkStep()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
self:exeInstructions(function()
self:enterAtkStepOver()
end)
end
function BattleController:enterAtkStepOver()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP_OVER
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
self:enterRefreshBoard()
return
end
self:enterDefStep()
end
function BattleController:enterDefStep()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
-- defTodo
self:enterDefStepOver()
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
---- 临时直接调用
self:enterRefreshBoard()
end
function BattleController:enterRefreshBoard()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_REFRESH_BOARD
self:fillBoard()
end
function BattleController:enterRoundEnd()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_END
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
self:enterNextWave()
return
end
self:enterRoundBegin()
end
---- end回合步骤
function BattleController:onTouchEvent(eventType, posId)
if self.roundStep ~= BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION then
return
end
local entity = self.battleData:getGridEntity(posId)
if not entity:canLink() then
return
@ -412,9 +528,7 @@ function BattleController:onLinkOver()
self.battleUI:disableUITouch()
self.battleUI:eliminationAni(sequence, function()
self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap)
self:exeInstructions(function()
self:fillBoard()
end)
self:enterAtkStep()
end)
end
@ -479,6 +593,7 @@ end
function BattleController:onFillBoardOver()
self:generateSkill()
self.battleUI:refreshSkill()
self:enterRoundEnd()
end
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
@ -548,16 +663,18 @@ end
function BattleController:exeInstructions(callback)
Logger.logHighlight("--------exeInstructions----------")
Logger.printTable(self.instructions)
if #self.instructions <= 0 then
if not self.instructions or #self.instructions <= 0 then
callback()
return
end
local instruction = table.remove(self.instructions)
local func = BattleController._doInstruction[instruction.name]
if func then
func(self, instruction, callback)
func(self, instruction, function()
self:exeInstructions(callback)
end)
else
callback()
self:exeInstructions(callback)
end
end
@ -571,42 +688,49 @@ function BattleController:generateBoard()
return
end
local skillCount = 0
local skillList = {}
for posId, entity in pairs(self.battleData:getGridEnties()) do
if entity:getSkillId() then
table.insert(skillList, {skillId = entity:getSkillId(), posId = posId})
skillCount = skillCount + 1
self.curBoardIndex = (self.curBoardIndex or 0) + 1
local board = boardList[self.curBoardIndex]
self.battleData:refreshBoard(board)
self.battleUI:initGridCell()
self:enterRoundBegin()
end
function BattleController:putBoardCacheSkill(callback)
if not self.battleUI then
return
end
self.battleData:cacheBoardSkill()
local skillList, skillCount = self.battleData:getCacheBoardSkill()
self.battleUI:cacheSkillAni(skillList, false, callback)
end
function BattleController:popBoardCacheSkill(callback)
local skillList, skillCount = self.battleData:getCacheBoardSkill()
self.battleData:clearCacheBoardSkill()
if self.battleUI and skillCount > 0 then
local posidList = {}
for posId, entity in pairs(self.battleData:getGridEnties()) do
if entity:isEmptyIdle() then
table.insert(posidList, posId)
end
end
posidList = table.shuffle(posidList)
local newSkillId = {}
for index, info in ipairs(skillList) do
if posidList[1] then
newSkillId[index] = info
newSkillId[index].posId = table.remove(posidList)
else
break
end
end
self.battleUI:cacheSkillAni(newSkillId, true, callback)
else
if callback then
callback()
end
end
self.battleUI:cacheSkillAni(skillList, false, function()
self.curBoardIndex = (self.curBoardIndex or 0) + 1
local board = boardList[self.curBoardIndex]
self.battleData:refreshBoard(board)
self.battleUI:initGridCell()
if skillCount > 0 then
local posidList = {}
for posId, entity in pairs(self.battleData:getGridEnties()) do
if entity:isEmptyIdle() then
table.insert(posidList, posId)
end
end
posidList = table.shuffle(posidList)
local newSkillId = {}
for index, info in ipairs(skillList) do
if posidList[1] then
newSkillId[index] = info
newSkillId[index].posId = table.remove(posidList)
else
break
end
end
self.battleUI:cacheSkillAni(newSkillId, true)
end
end)
end
function BattleController:generateSkill()
@ -988,6 +1112,10 @@ function BattleController:_tick(dt)
self:tick(dt)
end
function BattleController:battleEnd()
self:controllBattleEnd()
end
function BattleController:clear()
if self.alreadyClear then
return

View File

@ -73,4 +73,8 @@ function BattleControllerStage:getNotInvolvedSkills()
return self.notInvolvedSkills
end
function BattleControllerStage:controllBattleEnd()
end
return BattleControllerStage

View File

@ -186,6 +186,7 @@ function BattleUI:showBoardMask(elementType)
end
function BattleUI:eliminationAni(sequence, callback)
self:showMask(true)
if not sequence then
if callback then
callback()
@ -193,7 +194,6 @@ function BattleUI:eliminationAni(sequence, callback)
return
end
self.boardMask:setVisible(true)
self.boardMask:getTransform():SetAsLastSibling()
if self.eliminationAniSeq then
self.eliminationAniSeq:Kill()
@ -240,12 +240,12 @@ function BattleUI:eliminationAni(sequence, callback)
callback()
end
self.boardMask:setVisible(false)
self:refreshSkill()
end)
end
function BattleUI:fallGrid(listInfo, callback)
self:showMask(false)
self.fallAniCount = 0
for posId, info in pairs(listInfo) do
self.fallAniCount = self.fallAniCount + 1
@ -416,6 +416,13 @@ function BattleUI:doCachePopAni(skillInfo, callback)
end)
end
function BattleUI:showMask(show)
if not self.boardMask then
return
end
self.boardMask:setVisible(show)
end
function BattleUI:clear()
if self.alreadyClear then
return

View File

@ -274,6 +274,29 @@ function BattleData:changeSkillId(elementType, newId)
end
end
function BattleData:cacheBoardSkill()
self.cacheSkillList = {}
self.cacheSkillCount = 0
for posId, entity in pairs(self:getGridEnties()) do
if entity:getSkillId() then
table.insert(self.cacheSkillList, {skillId = entity:getSkillId(), posId = posId})
self.cacheSkillCount = self.cacheSkillCount + 1
end
end
end
function BattleData:getCacheBoardSkill()
if not self.cacheSkillList then
return self.cacheSkillList, 0
end
return self.cacheSkillList, self.cacheSkillCount
end
function BattleData:clearCacheBoardSkill()
self.cacheSkillList = {}
self.cacheSkillCount = 0
end
function BattleData:initTeam(side)
local data = nil
if side == BattleConst.SIDE_ATK then

View File

@ -184,4 +184,8 @@ function BattleTeamEntity:die()
self.isDead = true
end
function BattleTeamEntity:getIsDead()
return self.isDead
end
return BattleTeamEntity