Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
0d084c0438
@ -42,10 +42,10 @@ local buff = {
|
|||||||
["icon"]="dec_dmg_red_add"
|
["icon"]="dec_dmg_red_add"
|
||||||
},
|
},
|
||||||
[8]={
|
[8]={
|
||||||
["name"]="dec_dmg_ryellow_add",
|
["name"]="dec_dmg_yellow_add",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=1,
|
["decr"]=1,
|
||||||
["icon"]="dec_dmg_ryellow_add"
|
["icon"]="dec_dmg_yellow_add"
|
||||||
},
|
},
|
||||||
[9]={
|
[9]={
|
||||||
["name"]="dec_dmg_green_add",
|
["name"]="dec_dmg_green_add",
|
||||||
@ -136,12 +136,42 @@ local buff = {
|
|||||||
["name"]="dmg_addition_all_add"
|
["name"]="dmg_addition_all_add"
|
||||||
},
|
},
|
||||||
[25]={
|
[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",
|
["name"]="wavehealp",
|
||||||
["buff_type"]=5,
|
["buff_type"]=5,
|
||||||
["decr"]=3,
|
["decr"]=3,
|
||||||
["formula"]=2
|
["formula"]=2
|
||||||
},
|
},
|
||||||
[26]={
|
[32]={
|
||||||
["name"]="heal",
|
["name"]="heal",
|
||||||
["buff_type"]=5,
|
["buff_type"]=5,
|
||||||
["decr"]=3,
|
["decr"]=3,
|
||||||
@ -150,7 +180,7 @@ local buff = {
|
|||||||
4001
|
4001
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[27]={
|
[33]={
|
||||||
["name"]="hit_heal",
|
["name"]="hit_heal",
|
||||||
["buff_type"]=5,
|
["buff_type"]=5,
|
||||||
["decr"]=3,
|
["decr"]=3,
|
||||||
@ -159,7 +189,7 @@ local buff = {
|
|||||||
4001
|
4001
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[28]={
|
[34]={
|
||||||
["name"]="stun",
|
["name"]="stun",
|
||||||
["buff_type"]=8,
|
["buff_type"]=8,
|
||||||
["decr"]=2,
|
["decr"]=2,
|
||||||
@ -168,12 +198,12 @@ local buff = {
|
|||||||
4001
|
4001
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[29]={
|
[35]={
|
||||||
["name"]="hit_stun",
|
["name"]="hit_stun",
|
||||||
["buff_type"]=8,
|
["buff_type"]=8,
|
||||||
["decr"]=2
|
["decr"]=2
|
||||||
},
|
},
|
||||||
[30]={
|
[36]={
|
||||||
["name"]="shield",
|
["name"]="shield",
|
||||||
["buff_type"]=2,
|
["buff_type"]=2,
|
||||||
["decr"]=1,
|
["decr"]=1,
|
||||||
@ -181,22 +211,22 @@ local buff = {
|
|||||||
4001
|
4001
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[31]={
|
[37]={
|
||||||
["name"]="atkp_add",
|
["name"]="atkp_add",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=1
|
["decr"]=1
|
||||||
},
|
},
|
||||||
[32]={
|
[38]={
|
||||||
["name"]="atkp_add_defenderhp",
|
["name"]="atkp_add_defenderhp",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=1
|
["decr"]=1
|
||||||
},
|
},
|
||||||
[33]={
|
[39]={
|
||||||
["name"]="atkp_add_connect",
|
["name"]="atkp_add_connect",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=3
|
["decr"]=3
|
||||||
},
|
},
|
||||||
[34]={
|
[40]={
|
||||||
["name"]="spd_dec",
|
["name"]="spd_dec",
|
||||||
["buff_type"]=8,
|
["buff_type"]=8,
|
||||||
["decr"]=2,
|
["decr"]=2,
|
||||||
@ -204,51 +234,21 @@ local buff = {
|
|||||||
4001
|
4001
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[35]={
|
[41]={
|
||||||
["name"]="block",
|
["name"]="block",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=1
|
["decr"]=1
|
||||||
},
|
},
|
||||||
[36]={
|
[42]={
|
||||||
["name"]="hit_block",
|
["name"]="hit_block",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
["decr"]=1
|
["decr"]=1
|
||||||
},
|
},
|
||||||
[37]={
|
[43]={
|
||||||
["name"]="atk_times_add",
|
["name"]="atk_times_add",
|
||||||
["buff_type"]=7,
|
["buff_type"]=7,
|
||||||
["decr"]=1
|
["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]={
|
[44]={
|
||||||
["name"]="hpp_add",
|
["name"]="hpp_add",
|
||||||
["buff_type"]=1,
|
["buff_type"]=1,
|
||||||
@ -299,7 +299,7 @@ local keys = {
|
|||||||
["hurt_blue"]=buff[5],
|
["hurt_blue"]=buff[5],
|
||||||
["hurt_purple"]=buff[6],
|
["hurt_purple"]=buff[6],
|
||||||
["dec_dmg_red_add"]=buff[7],
|
["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_green_add"]=buff[9],
|
||||||
["dec_dmg_blue_add"]=buff[10],
|
["dec_dmg_blue_add"]=buff[10],
|
||||||
["dec_dmg_purple_add"]=buff[11],
|
["dec_dmg_purple_add"]=buff[11],
|
||||||
@ -316,25 +316,25 @@ local keys = {
|
|||||||
["dmg_addition_blue_add"]=buff[22],
|
["dmg_addition_blue_add"]=buff[22],
|
||||||
["dmg_addition_purple_add"]=buff[23],
|
["dmg_addition_purple_add"]=buff[23],
|
||||||
["dmg_addition_all_add"]=buff[24],
|
["dmg_addition_all_add"]=buff[24],
|
||||||
["wavehealp"]=buff[25],
|
["atkp_color_add"]=buff[25],
|
||||||
["heal"]=buff[26],
|
["atkp_red_add"]=buff[26],
|
||||||
["hit_heal"]=buff[27],
|
["atkp_yellow_add"]=buff[27],
|
||||||
["stun"]=buff[28],
|
["atkp_green_add"]=buff[28],
|
||||||
["hit_stun"]=buff[29],
|
["atkp_blue_add"]=buff[29],
|
||||||
["shield"]=buff[30],
|
["atkp_purple_add"]=buff[30],
|
||||||
["atkp_add"]=buff[31],
|
["wavehealp"]=buff[31],
|
||||||
["atkp_add_defenderhp"]=buff[32],
|
["heal"]=buff[32],
|
||||||
["atkp_add_connect"]=buff[33],
|
["hit_heal"]=buff[33],
|
||||||
["spd_dec"]=buff[34],
|
["stun"]=buff[34],
|
||||||
["block"]=buff[35],
|
["hit_stun"]=buff[35],
|
||||||
["hit_block"]=buff[36],
|
["shield"]=buff[36],
|
||||||
["atk_times_add"]=buff[37],
|
["atkp_add"]=buff[37],
|
||||||
["atkp_color_add"]=buff[38],
|
["atkp_add_defenderhp"]=buff[38],
|
||||||
["atkp_red_add"]=buff[39],
|
["atkp_add_connect"]=buff[39],
|
||||||
["atkp_yellow_add"]=buff[40],
|
["spd_dec"]=buff[40],
|
||||||
["atkp_green_add"]=buff[41],
|
["block"]=buff[41],
|
||||||
["atkp_blue_add"]=buff[42],
|
["hit_block"]=buff[42],
|
||||||
["atkp_purple_add"]=buff[43],
|
["atk_times_add"]=buff[43],
|
||||||
["hpp_add"]=buff[44],
|
["hpp_add"]=buff[44],
|
||||||
["crit_add"]=buff[45],
|
["crit_add"]=buff[45],
|
||||||
["crit_time_add"]=buff[46],
|
["crit_time_add"]=buff[46],
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
local skill = {
|
local skill = {
|
||||||
[1]={
|
[1]={
|
||||||
["method"]=2,
|
["position"]=1,
|
||||||
["skill_type"]=0,
|
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -15,6 +14,7 @@ local skill = {
|
|||||||
["skill_position"]=1
|
["skill_position"]=1
|
||||||
},
|
},
|
||||||
[2]={
|
[2]={
|
||||||
|
["position"]=2,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -28,6 +28,7 @@ local skill = {
|
|||||||
["skill_position"]=1
|
["skill_position"]=1
|
||||||
},
|
},
|
||||||
[3]={
|
[3]={
|
||||||
|
["position"]=3,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -41,6 +42,7 @@ local skill = {
|
|||||||
["skill_position"]=1
|
["skill_position"]=1
|
||||||
},
|
},
|
||||||
[4]={
|
[4]={
|
||||||
|
["position"]=4,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -54,6 +56,7 @@ local skill = {
|
|||||||
["skill_position"]=1
|
["skill_position"]=1
|
||||||
},
|
},
|
||||||
[5]={
|
[5]={
|
||||||
|
["position"]=5,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -67,8 +70,7 @@ local skill = {
|
|||||||
["skill_position"]=1
|
["skill_position"]=1
|
||||||
},
|
},
|
||||||
[6]={
|
[6]={
|
||||||
["method"]=2,
|
["position"]=1,
|
||||||
["skill_type"]=0,
|
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -82,6 +84,7 @@ local skill = {
|
|||||||
["skill_position"]=2
|
["skill_position"]=2
|
||||||
},
|
},
|
||||||
[7]={
|
[7]={
|
||||||
|
["position"]=2,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -95,6 +98,7 @@ local skill = {
|
|||||||
["skill_position"]=2
|
["skill_position"]=2
|
||||||
},
|
},
|
||||||
[8]={
|
[8]={
|
||||||
|
["position"]=3,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -108,6 +112,7 @@ local skill = {
|
|||||||
["skill_position"]=2
|
["skill_position"]=2
|
||||||
},
|
},
|
||||||
[9]={
|
[9]={
|
||||||
|
["position"]=4,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -121,6 +126,7 @@ local skill = {
|
|||||||
["skill_position"]=2
|
["skill_position"]=2
|
||||||
},
|
},
|
||||||
[10]={
|
[10]={
|
||||||
|
["position"]=5,
|
||||||
["effect_type"]=1,
|
["effect_type"]=1,
|
||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
@ -163,7 +169,7 @@ local skill = {
|
|||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
{
|
{
|
||||||
["type"]="hurt",
|
["type"]="hurt_yellow",
|
||||||
["num"]=20000,
|
["num"]=20000,
|
||||||
["ratio"]=10000,
|
["ratio"]=10000,
|
||||||
["round"]=0
|
["round"]=0
|
||||||
@ -202,7 +208,7 @@ local skill = {
|
|||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
{
|
{
|
||||||
["type"]="hurt",
|
["type"]="hurt_yellow",
|
||||||
["num"]=20000,
|
["num"]=20000,
|
||||||
["ratio"]=10000,
|
["ratio"]=10000,
|
||||||
["round"]=0
|
["round"]=0
|
||||||
@ -398,7 +404,7 @@ local skill = {
|
|||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
{
|
{
|
||||||
["type"]="hurt",
|
["type"]="hurt_blue",
|
||||||
["num"]=15000,
|
["num"]=15000,
|
||||||
["ratio"]=10000,
|
["ratio"]=10000,
|
||||||
["round"]=0
|
["round"]=0
|
||||||
@ -441,7 +447,7 @@ local skill = {
|
|||||||
["trigger"]=1,
|
["trigger"]=1,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
{
|
{
|
||||||
["type"]="hurt",
|
["type"]="hurt_blue",
|
||||||
["num"]=15000,
|
["num"]=15000,
|
||||||
["ratio"]=10000,
|
["ratio"]=10000,
|
||||||
["round"]=0
|
["round"]=0
|
||||||
|
|||||||
@ -445,7 +445,7 @@ local skill_rogue = {
|
|||||||
["type"]=5,
|
["type"]=5,
|
||||||
["effect"]={
|
["effect"]={
|
||||||
{
|
{
|
||||||
["type"]="dec_dmg_add",
|
["type"]="weakness_all_add",
|
||||||
["num"]=1000,
|
["num"]=1000,
|
||||||
["ratio"]=10000,
|
["ratio"]=10000,
|
||||||
["round"]=999
|
["round"]=999
|
||||||
|
|||||||
@ -23,6 +23,19 @@ BattleConst.UNIT_FRONT_DISTANCE = 50
|
|||||||
BattleConst.MOVE_SPEED = 500 -- 战斗单位的移动速度
|
BattleConst.MOVE_SPEED = 500 -- 战斗单位的移动速度
|
||||||
BattleConst.HURT_STATE_CRIT = 1 -- 暴击
|
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 = {
|
BattleConst.BATTLE_TYPE = {
|
||||||
STAGE = "1",
|
STAGE = "1",
|
||||||
|
|||||||
@ -98,13 +98,19 @@ function BattleController:onLinkChange()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.battleUI:refreshSkill(elementTypeMap)
|
self.battleUI:refreshSkill(elementTypeMap)
|
||||||
Logger.logHighlight("---------onLinkChange--------------")
|
|
||||||
Logger.printTable(elementTypeMap)
|
|
||||||
if mainElementType then
|
if mainElementType then
|
||||||
Logger.logHighlight("mainElementType " .. mainElementType)
|
Logger.logHighlight("mainElementType " .. mainElementType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:onRoundBegin()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleController:onEliminationBegin()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- *************各个子模块的战斗需要重写的方法 END*************
|
-- *************各个子模块的战斗需要重写的方法 END*************
|
||||||
|
|
||||||
function BattleController:ctor()
|
function BattleController:ctor()
|
||||||
@ -114,7 +120,10 @@ end
|
|||||||
function BattleController:init(params)
|
function BattleController:init(params)
|
||||||
params = params or {}
|
params = params or {}
|
||||||
self.chapterId = self:getChapterId()
|
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.atkUnits = {}
|
||||||
self.defUnits = {}
|
self.defUnits = {}
|
||||||
self.allUnits = {}
|
self.allUnits = {}
|
||||||
@ -125,7 +134,6 @@ function BattleController:init(params)
|
|||||||
BattleScheduler:init()
|
BattleScheduler:init()
|
||||||
BattleHelper:init()
|
BattleHelper:init()
|
||||||
self:prepareFight()
|
self:prepareFight()
|
||||||
self:battleStart()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:prepareFight()
|
function BattleController:prepareFight()
|
||||||
@ -144,7 +152,7 @@ function BattleController:prepareFight()
|
|||||||
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
|
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumber())
|
||||||
self:initAtkUnits(onPreloadFinished)
|
self:initAtkUnits(onPreloadFinished)
|
||||||
self:initDefUnits(onPreloadFinished)
|
self:initDefUnits(onPreloadFinished)
|
||||||
self:generateBoard()
|
self:battleStart()
|
||||||
end)
|
end)
|
||||||
self:loadOtherRes(onPreloadFinished)
|
self:loadOtherRes(onPreloadFinished)
|
||||||
end
|
end
|
||||||
@ -195,9 +203,117 @@ function BattleController:battleStart()
|
|||||||
self.tickSid = BattleScheduler:scheduleGlobal(function(dt)
|
self.tickSid = BattleScheduler:scheduleGlobal(function(dt)
|
||||||
self:_tick(dt)
|
self:_tick(dt)
|
||||||
end, 0)
|
end, 0)
|
||||||
|
self:enterNextWave()
|
||||||
end
|
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)
|
function BattleController:onTouchEvent(eventType, posId)
|
||||||
|
if self.roundStep ~= BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION then
|
||||||
|
return
|
||||||
|
end
|
||||||
local entity = self.battleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if not entity:canLink() then
|
if not entity:canLink() then
|
||||||
return
|
return
|
||||||
@ -412,9 +528,7 @@ function BattleController:onLinkOver()
|
|||||||
self.battleUI:disableUITouch()
|
self.battleUI:disableUITouch()
|
||||||
self.battleUI:eliminationAni(sequence, function()
|
self.battleUI:eliminationAni(sequence, function()
|
||||||
self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap)
|
self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap)
|
||||||
self:exeInstructions(function()
|
self:enterAtkStep()
|
||||||
self:fillBoard()
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -479,6 +593,7 @@ end
|
|||||||
function BattleController:onFillBoardOver()
|
function BattleController:onFillBoardOver()
|
||||||
self:generateSkill()
|
self:generateSkill()
|
||||||
self.battleUI:refreshSkill()
|
self.battleUI:refreshSkill()
|
||||||
|
self:enterRoundEnd()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
|
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
|
||||||
@ -548,16 +663,18 @@ end
|
|||||||
function BattleController:exeInstructions(callback)
|
function BattleController:exeInstructions(callback)
|
||||||
Logger.logHighlight("--------exeInstructions----------")
|
Logger.logHighlight("--------exeInstructions----------")
|
||||||
Logger.printTable(self.instructions)
|
Logger.printTable(self.instructions)
|
||||||
if #self.instructions <= 0 then
|
if not self.instructions or #self.instructions <= 0 then
|
||||||
callback()
|
callback()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local instruction = table.remove(self.instructions)
|
local instruction = table.remove(self.instructions)
|
||||||
local func = BattleController._doInstruction[instruction.name]
|
local func = BattleController._doInstruction[instruction.name]
|
||||||
if func then
|
if func then
|
||||||
func(self, instruction, callback)
|
func(self, instruction, function()
|
||||||
|
self:exeInstructions(callback)
|
||||||
|
end)
|
||||||
else
|
else
|
||||||
callback()
|
self:exeInstructions(callback)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -571,22 +688,26 @@ function BattleController:generateBoard()
|
|||||||
return
|
return
|
||||||
end
|
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
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.battleUI:cacheSkillAni(skillList, false, function()
|
|
||||||
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
||||||
local board = boardList[self.curBoardIndex]
|
local board = boardList[self.curBoardIndex]
|
||||||
self.battleData:refreshBoard(board)
|
self.battleData:refreshBoard(board)
|
||||||
self.battleUI:initGridCell()
|
self.battleUI:initGridCell()
|
||||||
|
self:enterRoundBegin()
|
||||||
|
end
|
||||||
|
|
||||||
if skillCount > 0 then
|
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 = {}
|
local posidList = {}
|
||||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||||
if entity:isEmptyIdle() then
|
if entity:isEmptyIdle() then
|
||||||
@ -604,9 +725,12 @@ function BattleController:generateBoard()
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.battleUI:cacheSkillAni(newSkillId, true)
|
self.battleUI:cacheSkillAni(newSkillId, true, callback)
|
||||||
|
else
|
||||||
|
if callback then
|
||||||
|
callback()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:generateSkill()
|
function BattleController:generateSkill()
|
||||||
@ -988,6 +1112,10 @@ function BattleController:_tick(dt)
|
|||||||
self:tick(dt)
|
self:tick(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:battleEnd()
|
||||||
|
self:controllBattleEnd()
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:clear()
|
function BattleController:clear()
|
||||||
if self.alreadyClear then
|
if self.alreadyClear then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -73,4 +73,8 @@ function BattleControllerStage:getNotInvolvedSkills()
|
|||||||
return self.notInvolvedSkills
|
return self.notInvolvedSkills
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleControllerStage:controllBattleEnd()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return BattleControllerStage
|
return BattleControllerStage
|
||||||
@ -186,6 +186,7 @@ function BattleUI:showBoardMask(elementType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:eliminationAni(sequence, callback)
|
function BattleUI:eliminationAni(sequence, callback)
|
||||||
|
self:showMask(true)
|
||||||
if not sequence then
|
if not sequence then
|
||||||
if callback then
|
if callback then
|
||||||
callback()
|
callback()
|
||||||
@ -193,7 +194,6 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.boardMask:setVisible(true)
|
|
||||||
self.boardMask:getTransform():SetAsLastSibling()
|
self.boardMask:getTransform():SetAsLastSibling()
|
||||||
if self.eliminationAniSeq then
|
if self.eliminationAniSeq then
|
||||||
self.eliminationAniSeq:Kill()
|
self.eliminationAniSeq:Kill()
|
||||||
@ -240,12 +240,12 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
callback()
|
callback()
|
||||||
end
|
end
|
||||||
|
|
||||||
self.boardMask:setVisible(false)
|
|
||||||
self:refreshSkill()
|
self:refreshSkill()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:fallGrid(listInfo, callback)
|
function BattleUI:fallGrid(listInfo, callback)
|
||||||
|
self:showMask(false)
|
||||||
self.fallAniCount = 0
|
self.fallAniCount = 0
|
||||||
for posId, info in pairs(listInfo) do
|
for posId, info in pairs(listInfo) do
|
||||||
self.fallAniCount = self.fallAniCount + 1
|
self.fallAniCount = self.fallAniCount + 1
|
||||||
@ -416,6 +416,13 @@ function BattleUI:doCachePopAni(skillInfo, callback)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:showMask(show)
|
||||||
|
if not self.boardMask then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.boardMask:setVisible(show)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:clear()
|
function BattleUI:clear()
|
||||||
if self.alreadyClear then
|
if self.alreadyClear then
|
||||||
return
|
return
|
||||||
|
|||||||
@ -274,6 +274,29 @@ function BattleData:changeSkillId(elementType, newId)
|
|||||||
end
|
end
|
||||||
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)
|
function BattleData:initTeam(side)
|
||||||
local data = nil
|
local data = nil
|
||||||
if side == BattleConst.SIDE_ATK then
|
if side == BattleConst.SIDE_ATK then
|
||||||
|
|||||||
@ -184,4 +184,8 @@ function BattleTeamEntity:die()
|
|||||||
self.isDead = true
|
self.isDead = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeamEntity:getIsDead()
|
||||||
|
return self.isDead
|
||||||
|
end
|
||||||
|
|
||||||
return BattleTeamEntity
|
return BattleTeamEntity
|
||||||
Loading…
x
Reference in New Issue
Block a user