Merge branch 'battle' into dev

# Conflicts:
#	lua/app/config/grid_type.lua
#	lua/app/config/hero.lua
This commit is contained in:
xiekaidong 2023-05-16 19:13:37 +08:00
commit e23a631a7d
10 changed files with 542 additions and 527 deletions

View File

@ -54,12 +54,12 @@ local grid_type = {
["break_sfx"]="sfx_piece_za_b02" ["break_sfx"]="sfx_piece_za_b02"
}, },
[6]={ [6]={
["icon"]="ice", ["icon"]="lock",
["can_fall"]=1, ["can_fall"]=1,
["cant_link"]=1 ["cant_link"]=1
}, },
[7]={ [7]={
["icon"]="stone_1", ["icon"]="stone_3",
["next_type"]=3, ["next_type"]=3,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -71,7 +71,7 @@ local grid_type = {
["break_sfx"]="sfx_piece_za_b01" ["break_sfx"]="sfx_piece_za_b01"
}, },
[8]={ [8]={
["icon"]="stone_1", ["icon"]="rocket_up",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -80,13 +80,14 @@ local grid_type = {
["break_count"]=1, ["break_count"]=1,
["cant_link"]=1, ["cant_link"]=1,
["element_invalid"]=1, ["element_invalid"]=1,
["break_effect"]=1, ["effect"]=1,
["break_effect_parms"]={ ["effect_params"]={
1 1
} },
["effect_trigger"]=2
}, },
[9]={ [9]={
["icon"]="stone_1", ["icon"]="rocket_down",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -95,13 +96,14 @@ local grid_type = {
["break_count"]=1, ["break_count"]=1,
["cant_link"]=1, ["cant_link"]=1,
["element_invalid"]=1, ["element_invalid"]=1,
["break_effect"]=1, ["effect"]=1,
["break_effect_parms"]={ ["effect_params"]={
2 2
} },
["effect_trigger"]=2
}, },
[10]={ [10]={
["icon"]="stone_1", ["icon"]="rocket_left",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -110,13 +112,14 @@ local grid_type = {
["break_count"]=1, ["break_count"]=1,
["cant_link"]=1, ["cant_link"]=1,
["element_invalid"]=1, ["element_invalid"]=1,
["break_effect"]=1, ["effect"]=1,
["break_effect_parms"]={ ["effect_params"]={
3 3
} },
["effect_trigger"]=2
}, },
[11]={ [11]={
["icon"]="stone_1", ["icon"]="rocket_right",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -125,13 +128,14 @@ local grid_type = {
["break_count"]=1, ["break_count"]=1,
["cant_link"]=1, ["cant_link"]=1,
["element_invalid"]=1, ["element_invalid"]=1,
["break_effect"]=1, ["effect"]=1,
["break_effect_parms"]={ ["effect_params"]={
4 4
} },
["effect_trigger"]=2
}, },
[12]={ [12]={
["icon"]="ice", ["icon"]="leaf",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
@ -143,16 +147,17 @@ local grid_type = {
["cant_link"]=1 ["cant_link"]=1
}, },
[13]={ [13]={
["icon"]="stone_1", ["icon"]="jelly",
["next_type"]=0, ["next_type"]=0,
["break_condition"]={ ["break_condition"]={
1, 1,
3 3
}, },
["break_count"]=1, ["break_count"]=1,
["break_stay_element"]=1,
["cant_link"]=1, ["cant_link"]=1,
["element_invalid"]=1, ["effect"]=2,
["break_effect"]=2 ["effect_trigger"]=1
} }
} }
local config = { local config = {

View File

@ -3,16 +3,17 @@ local hero = {
["position"]=1, ["position"]=1,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]={ ["hurt_skill"]={
1200110,
1200111, 1200111,
1200112, 1200112,
1200113 1200113,
1200114
}, },
["base_skill"]=1200120, ["base_skill"]=1200120,
["rouge_skill"]=1200101, ["support_skill"]=1200110,
["rouge_skill_1"]=1200102, ["rouge_skill"]=200500,
["rouge_skill_2"]=1200103, ["rouge_skill_1"]=200501,
["rouge_skill_3"]=1200104, ["rouge_skill_2"]=200502,
["rouge_skill_3"]=200503,
["begin_lv"]=1, ["begin_lv"]=1,
["hp"]={ ["hp"]={
2000000, 2000000,
@ -51,184 +52,23 @@ local hero = {
["model_id"]="p0005", ["model_id"]="p0005",
["icon"]="5", ["icon"]="5",
["item_id"]=12001, ["item_id"]=12001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
},
[13001]={
["position"]=1,
["qlt"]=3,
["hurt_skill"]={
1300110,
1300111,
1300112,
1300113
},
["base_skill"]=1300120,
["rouge_skill"]=1200101,
["rouge_skill_1"]=1200102,
["rouge_skill_2"]=1200103,
["rouge_skill_3"]=1200104,
["begin_lv"]=3,
["hp"]={
2000000,
2400000,
2800000,
3220000,
3660000,
4120000,
4620000,
5160000,
5760000,
6420000,
7140000,
7940000,
8840000,
9840000,
10980000
},
["atk"]={
1000000,
1200000,
1400000,
1610000,
1830000,
2060000,
2310000,
2580000,
2880000,
3210000,
3570000,
3970000,
4420000,
4920000,
5490000
},
["model_id"]="p0014",
["icon"]="5",
["item_id"]=13001,
["unlock_chapter"]=1
},
[13002]={
["position"]=1,
["qlt"]=3,
["hurt_skill"]={
1300210,
1300211,
1300212,
1300213
},
["base_skill"]=1300220,
["rouge_skill"]=1200101,
["rouge_skill_1"]=1200102,
["rouge_skill_2"]=1200103,
["rouge_skill_3"]=1200104,
["begin_lv"]=3,
["hp"]={
2000000,
2400000,
2800000,
3220000,
3660000,
4120000,
4620000,
5160000,
5760000,
6420000,
7140000,
7940000,
8840000,
9840000,
10980000
},
["atk"]={
1000000,
1200000,
1400000,
1610000,
1830000,
2060000,
2310000,
2580000,
2880000,
3210000,
3570000,
3970000,
4420000,
4920000,
5490000
},
["model_id"]="p0009",
["icon"]="5",
["item_id"]=13002,
["unlock_chapter"]=1
},
[24001]={
["position"]=1,
["qlt"]=4,
["hurt_skill"]={
2400110,
2400111,
2400112,
2400113
},
["base_skill"]=2400120,
["rouge_skill"]=1200101,
["rouge_skill_1"]=1200102,
["rouge_skill_2"]=1200103,
["rouge_skill_3"]=1200104,
["begin_lv"]=5,
["hp"]={
2000000,
2400000,
2800000,
3220000,
3660000,
4120000,
4620000,
5160000,
5760000,
6420000,
7140000,
7940000,
8840000,
9840000,
10980000
},
["atk"]={
1000000,
1200000,
1400000,
1610000,
1830000,
2060000,
2310000,
2580000,
2880000,
3210000,
3570000,
3970000,
4420000,
4920000,
5490000
},
["model_id"]="p0011",
["icon"]="5",
["item_id"]=24001,
["unlock_chapter"]=1
}, },
[22001]={ [22001]={
["position"]=2, ["position"]=2,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]={ ["hurt_skill"]={
2200110,
2200111, 2200111,
2200112, 2200112,
2200113 2200113,
2200114
}, },
["base_skill"]=2200120, ["base_skill"]=2200120,
["rouge_skill"]=2200101, ["support_skill"]=2200110,
["rouge_skill_1"]=2200102, ["rouge_skill"]=200200,
["rouge_skill_2"]=2200103, ["rouge_skill_1"]=200201,
["rouge_skill_3"]=2200104, ["rouge_skill_2"]=200202,
["rouge_skill_3"]=200203,
["begin_lv"]=1, ["begin_lv"]=1,
["hp"]={ ["hp"]={
2000000, 2000000,
@ -267,130 +107,78 @@ local hero = {
["model_id"]="p0002", ["model_id"]="p0002",
["icon"]="2", ["icon"]="2",
["item_id"]=22001, ["item_id"]=22001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[23001]={ [23001]={
["position"]=2, ["position"]=2,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]={ ["hurt_skill"]={
2300110,
2300111, 2300111,
2300112, 2300112,
2300113 2300113,
2300114
}, },
["base_skill"]=2300120, ["base_skill"]=2300120,
["rouge_skill"]=2200101, ["support_skill"]=2300110,
["rouge_skill_1"]=2200102, ["rouge_skill"]=200700,
["rouge_skill_2"]=2200103, ["rouge_skill_1"]=200701,
["rouge_skill_3"]=2200104, ["rouge_skill_2"]=200702,
["rouge_skill_3"]=200703,
["begin_lv"]=3, ["begin_lv"]=3,
["hp"]={ ["hp"]={
2000000, 3000000,
2400000, 3520000,
2800000, 4040000,
3220000, 4580000,
3660000,
4120000,
4620000,
5160000, 5160000,
5760000, 5760000,
6420000, 6420000,
7140000, 7120000,
7940000, 7900000,
8840000, 8760000,
9840000, 9700000,
10980000 10740000,
11920000,
13220000,
14700000
}, },
["atk"]={ ["atk"]={
1000000, 1500000,
1200000, 1760000,
1400000, 2020000,
1610000, 2290000,
1830000,
2060000,
2310000,
2580000, 2580000,
2880000, 2880000,
3210000, 3210000,
3570000, 3560000,
3970000, 3950000,
4420000, 4380000,
4920000, 4850000,
5490000 5370000,
}, 5960000,
["model_id"]="p0010", 6610000,
["icon"]="5", 7350000
["item_id"]=23001,
["unlock_chapter"]=1
},
[24001]={
["position"]=2,
["qlt"]=4,
["hurt_skill"]={
2400110,
2400111,
2400112,
2400113
},
["base_skill"]=2400120,
["rouge_skill"]=2400101,
["rouge_skill_1"]=2400102,
["rouge_skill_2"]=2400103,
["rouge_skill_3"]=2400104,
["begin_lv"]=5,
["hp"]={
2000000,
2400000,
2800000,
3220000,
3660000,
4120000,
4620000,
5160000,
5760000,
6420000,
7140000,
7940000,
8840000,
9840000,
10980000
},
["atk"]={
1000000,
1200000,
1400000,
1610000,
1830000,
2060000,
2310000,
2580000,
2880000,
3210000,
3570000,
3970000,
4420000,
4920000,
5490000
}, },
["model_id"]="p0007", ["model_id"]="p0007",
["icon"]="7", ["icon"]="7",
["item_id"]=24001, ["item_id"]=23001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[32001]={ [32001]={
["position"]=3, ["position"]=3,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]={ ["hurt_skill"]={
3200110,
3200111, 3200111,
3200112, 3200112,
3200113 3200113,
3200114
}, },
["base_skill"]=3200120, ["base_skill"]=3200120,
["rouge_skill"]=3200101, ["support_skill"]=3200110,
["rouge_skill_1"]=3200102, ["rouge_skill"]=200100,
["rouge_skill_2"]=3200103, ["rouge_skill_1"]=200101,
["rouge_skill_3"]=3200104, ["rouge_skill_2"]=200102,
["rouge_skill_3"]=200103,
["begin_lv"]=1, ["begin_lv"]=1,
["hp"]={ ["hp"]={
2000000, 2000000,
@ -429,76 +217,78 @@ local hero = {
["model_id"]="p0001", ["model_id"]="p0001",
["icon"]="1", ["icon"]="1",
["item_id"]=32001, ["item_id"]=32001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[33001]={ [33001]={
["position"]=3, ["position"]=3,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]={ ["hurt_skill"]={
3300110,
3300111, 3300111,
3300112, 3300112,
3300113 3300113,
3300114
}, },
["base_skill"]=3300120, ["base_skill"]=3300120,
["rouge_skill"]=3300101, ["support_skill"]=3300110,
["rouge_skill_1"]=3300102, ["rouge_skill"]=200600,
["rouge_skill_2"]=3300103, ["rouge_skill_1"]=200601,
["rouge_skill_3"]=3300104, ["rouge_skill_2"]=200602,
["rouge_skill_3"]=200603,
["begin_lv"]=3, ["begin_lv"]=3,
["hp"]={ ["hp"]={
2000000, 3000000,
2400000, 3520000,
2800000, 4040000,
3220000, 4580000,
3660000,
4120000,
4620000,
5160000, 5160000,
5760000, 5760000,
6420000, 6420000,
7140000, 7120000,
7940000, 7900000,
8840000, 8760000,
9840000, 9700000,
10980000 10740000,
11920000,
13220000,
14700000
}, },
["atk"]={ ["atk"]={
1000000, 1500000,
1200000, 1760000,
1400000, 2020000,
1610000, 2290000,
1830000,
2060000,
2310000,
2580000, 2580000,
2880000, 2880000,
3210000, 3210000,
3570000, 3560000,
3970000, 3950000,
4420000, 4380000,
4920000, 4850000,
5490000 5370000,
5960000,
6610000,
7350000
}, },
["model_id"]="p0006", ["model_id"]="p0006",
["icon"]="6", ["icon"]="6",
["item_id"]=33001, ["item_id"]=33001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[42001]={ [42001]={
["position"]=4, ["position"]=4,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]={ ["hurt_skill"]={
4200110,
4200111, 4200111,
4200112, 4200112,
4200113 4200113,
4200114
}, },
["base_skill"]=4200120, ["base_skill"]=4200120,
["rouge_skill"]=4200101, ["support_skill"]=4200110,
["rouge_skill_1"]=4200102, ["rouge_skill"]=200300,
["rouge_skill_2"]=4200103, ["rouge_skill_1"]=200301,
["rouge_skill_3"]=4200104, ["rouge_skill_2"]=200302,
["rouge_skill_3"]=200303,
["begin_lv"]=1, ["begin_lv"]=1,
["hp"]={ ["hp"]={
2000000, 2000000,
@ -537,76 +327,78 @@ local hero = {
["model_id"]="p0003", ["model_id"]="p0003",
["icon"]="3", ["icon"]="3",
["item_id"]=42001, ["item_id"]=42001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[44001]={ [43001]={
["position"]=4, ["position"]=4,
["qlt"]=4, ["qlt"]=3,
["hurt_skill"]={ ["hurt_skill"]={
4400110, 4300111,
4400111, 4300112,
4400112, 4300113,
4400113 4300114
}, },
["base_skill"]=4400120, ["base_skill"]=4300120,
["rouge_skill"]=4400101, ["support_skill"]=4300110,
["rouge_skill_1"]=4400102, ["rouge_skill"]=200800,
["rouge_skill_2"]=4400103, ["rouge_skill_1"]=200801,
["rouge_skill_3"]=4400104, ["rouge_skill_2"]=200802,
["begin_lv"]=5, ["rouge_skill_3"]=200803,
["begin_lv"]=3,
["hp"]={ ["hp"]={
2000000, 3000000,
2400000, 3520000,
2800000, 4040000,
3220000, 4580000,
3660000,
4120000,
4620000,
5160000, 5160000,
5760000, 5760000,
6420000, 6420000,
7140000, 7120000,
7940000, 7900000,
8840000, 8760000,
9840000, 9700000,
10980000 10740000,
11920000,
13220000,
14700000
}, },
["atk"]={ ["atk"]={
1000000, 1500000,
1200000, 1760000,
1400000, 2020000,
1610000, 2290000,
1830000,
2060000,
2310000,
2580000, 2580000,
2880000, 2880000,
3210000, 3210000,
3570000, 3560000,
3970000, 3950000,
4420000, 4380000,
4920000, 4850000,
5490000 5370000,
5960000,
6610000,
7350000
}, },
["model_id"]="p0008", ["model_id"]="p0008",
["icon"]="8", ["icon"]="8",
["item_id"]=44001, ["item_id"]=43001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
}, },
[52001]={ [52001]={
["position"]=5, ["position"]=5,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]={ ["hurt_skill"]={
5200110,
5200111, 5200111,
5200112, 5200112,
5200113 5200113,
5200114
}, },
["base_skill"]=5200120, ["base_skill"]=5200120,
["rouge_skill"]=5200101, ["support_skill"]=5200110,
["rouge_skill_1"]=5200102, ["rouge_skill"]=200400,
["rouge_skill_2"]=5200103, ["rouge_skill_1"]=200401,
["rouge_skill_3"]=5200104, ["rouge_skill_2"]=200402,
["rouge_skill_3"]=200403,
["begin_lv"]=1, ["begin_lv"]=1,
["hp"]={ ["hp"]={
2000000, 2000000,
@ -645,10 +437,10 @@ local hero = {
["model_id"]="p0004", ["model_id"]="p0004",
["icon"]="4", ["icon"]="4",
["item_id"]=52001, ["item_id"]=52001,
["unlock_chapter"]=1 ["unlock_chapter"]=0
} }
} }
local config = { local config = {
data=hero,count=12 data=hero,count=8
} }
return config return config

View File

@ -47,6 +47,9 @@ BattleConst.RECOVER_HP_INTERVAL = 0.2
BattleConst.RECOVER_HP_PERCENT = 333 BattleConst.RECOVER_HP_PERCENT = 333
BattleConst.EFFECT_NUMBER_DELAY = 0.2 BattleConst.EFFECT_NUMBER_DELAY = 0.2
BattleConst.MAX_CACHE_SKILL_COUNT = 3 BattleConst.MAX_CACHE_SKILL_COUNT = 3
BattleConst.SKILL_ELIMINATION_TIME = 0.5
BattleConst.ELIMINATION_INTERVAL = 0.01
BattleConst.GRID_BREAK_EFFECT_INTERVAL = 0.1
BattleConst.BATTLE_ROUND_STEP = { BattleConst.BATTLE_ROUND_STEP = {
WAIT_BEGIN = 0, -- 等待开始 WAIT_BEGIN = 0, -- 等待开始
@ -361,14 +364,25 @@ BattleConst.GRID_TYPE = {
VINES = 4, VINES = 4,
ICE = 5, ICE = 5,
LOCK = 6, LOCK = 6,
JELLY = 13,
} }
BattleConst.GRID_BREAK_CONDITION = { BattleConst.GRID_BREAK_CONDITION = {
ACOUND = 1, AROUND = 1,
LINE = 2, LINE = 2,
SKILL = 3, SKILL = 3,
} }
BattleConst.GRID_EFFECT_TYPE = {
DIRECTION_ELIMINATION = 1,
CROSS_SPREAD = 2,
}
BattleConst.GRID_EFFECT_TRIGGER_TYPE = {
ON_ROUND_BEGIN = 1,
ON_GRID_BREAK = 2,
}
---- 元素类型 ---- 元素类型
BattleConst.ELEMENT_TYPE = { BattleConst.ELEMENT_TYPE = {
NONE = 0, NONE = 0,

View File

@ -271,6 +271,34 @@ function BattleManager:getPosCenterAndDir(pos1, pos2)
return centerPos, zEuler return centerPos, zEuler
end end
function BattleManager:getPosIdsByDirection(posId, direction)
local rc = self:getPosRC(posId)
local list = {}
if direction == BattleConst.BOARD_RANGE_TYPE.UP then
for r = rc.r, 1, -1 do
local id = self:getPosId(r, rc.c)
table.insert(list, id)
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then
for r = rc.r, BattleConst.ROW_COUNT do
local id = self:getPosId(r, rc.c)
table.insert(list, id)
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT then
for c = rc.c, 1, -1 do
local id = self:getPosId(rc.r, c)
table.insert(list, id)
end
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT then
for c = rc.c, BattleConst.COLUMN_COUNT do
local id = self:getPosId(rc.r, c)
table.insert(list, id)
end
end
return list
end
----------------------- end 一些公共相关的方法 ----------------------------- ----------------------- end 一些公共相关的方法 -----------------------------
function BattleManager:bindBattleUnitAttribute(hashCode, side) function BattleManager:bindBattleUnitAttribute(hashCode, side)

View File

@ -8,6 +8,7 @@ local BattleController = class("BattleController")
local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle" local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle"
local BATTLE_ROGUE_SKILL_HANDLE = require "app/module/battle/skill/battle_rogue_skill_handle" local BATTLE_ROGUE_SKILL_HANDLE = require "app/module/battle/skill/battle_rogue_skill_handle"
local BATTLE_GRID_EFFECT_HANDLE = require "app/module/battle/skill/battle_grid_effect_handle"
local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle" local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle"
local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
@ -144,8 +145,6 @@ function BattleController:onLinkChange()
entity:getCell():showAni() entity:getCell():showAni()
end end
end end
self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.LINE)
end end
for posId, cell in pairs(needFalsePosMap) do for posId, cell in pairs(needFalsePosMap) do
@ -158,24 +157,10 @@ function BattleController:onLinkChange()
if entity:getCell() then if entity:getCell() then
entity:getCell():showCircle(true) entity:getCell():showCircle(true)
end end
self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.SKILL)
end end
end end
local elementTypeMap = {} local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination()
for posId, boomTypes in pairs(boomGridIds) do
local entity = self.battleData:getGridEntity(posId)
if entity then
local elementTypeInvalid = entity:isElmentTypeInvalid()
local breaked, isIdle = entity:tryBreakGrid(boomTypes, true)
if isIdle then
if not entity:getSkillId() and not elementTypeInvalid then
local elementType = entity:getElementType()
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
end
end
end
end
self.battleUI:refreshSkill(elementTypeMap, count > 0) self.battleUI:refreshSkill(elementTypeMap, count > 0)
if mainElementType then if mainElementType then
@ -464,6 +449,19 @@ end
function BattleController:enterRoundBegin() function BattleController:enterRoundBegin()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN
local gridEntities = self.battleData:getGridEnties()
local effectGrid = {}
for posId, entity in pairs(gridEntities) do
if entity:getEffectType() then
table.insert(effectGrid, posId)
end
end
for _, posId in ipairs(effectGrid) do
BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_ROUND_BEGIN, self)
end
self:enterEliminationBegin() self:enterEliminationBegin()
end end
@ -878,35 +876,147 @@ function BattleController:onLinkOver()
local skillId = self.battleData:getSequenceHadSkill() local skillId = self.battleData:getSequenceHadSkill()
local skillEntity local skillEntity
local linkElementType
local influenceElementType
if skillId then if skillId then
skillEntity = self.battleData:getSkillEntityBySkillId(skillId) skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
end end
local elementTypeMap = {} local aniSequence, influenceElementTypeMap, lineCount, elementTypeMap, linkElementType, effectGridMap = self:calculateCurElimination()
self.battleData:addSkillEnergy(elementTypeMap)
self.battleData:clearGridSequence()
self.battleUI:disableUITouch()
self.battleUI:eliminationAni(aniSequence, effectGridMap, function()
self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap)
self:enterRefreshBoard()
end)
self.eliminateCount = self.eliminateCount + 1
self.eliminateTotalCount = self.eliminateTotalCount + 1
end
function BattleController:calculateCurElimination()
local sequence = self.battleData:getGridSequence()
local skillId = self.battleData:getSequenceHadSkill()
local skillEntity
if skillId then
skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
end
local breakedMap = {}
local boomGridIds = {} local boomGridIds = {}
local lineCount = 0 local sequenceMap = {}
for idx, info in ipairs(sequence) do
sequenceMap[info.posId] = idx
end
local skillPosId local time = 0
local randomPosList local skillTime = BattleConst.SKILL_ELIMINATION_TIME
for _, info in ipairs(sequence) do local aniSequence = {}
local entity = self.battleData:getGridEntity(info.posId) for idx, info in ipairs(sequence) do
if entity:getSkillId() then local posId = info.posId
skillPosId = info.posId self:dealGridBreak(posId, GRID_BREAK_CONDITION.LINE, time, breakedMap, sequenceMap, aniSequence, boomGridIds)
else time = time + BattleConst.ELIMINATION_INTERVAL
linkElementType = entity:getElementType() end
end
self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.LINE)
local outline = BattleConst.UP_DOWN_LEFT_RIGHT[info.posId] local randomPosList, influenceElementTypeMap
for _, aroundPosId in ipairs(outline) do for i, info in ipairs(aniSequence) do
self:setGridBreakCondition(boomGridIds, aroundPosId, GRID_BREAK_CONDITION.ACOUND) if info.isSkill then
randomPosList, influenceElementTypeMap = self:dealSkillElement(info.timeIdx + skillTime, breakedMap, sequenceMap, aniSequence, boomGridIds)
local aniUnit = aniSequence[i]
aniUnit.rangeList = skillEntity:getBoardRange()
aniUnit.randomPosList = randomPosList
break
end end
end end
sequence = {} local lineCount = 0
local elementTypeMap = {}
local linkElementType
local gridEntities = self.battleData:getGridEnties()
local effectGridMap = {}
for _, info in ipairs(aniSequence) do
local entity = gridEntities[info.posId]
local elementType = entity:getElementType()
if not info.noAni and info.isIdle then
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
if boomGridIds[info.posId] and boomGridIds[info.posId][GRID_BREAK_CONDITION.LINE] then
lineCount = lineCount + 1
if not info.isSkill then
linkElementType = elementType
end
end
end
if entity:getEffectType() and info.isIdle then
effectGridMap[info.posId] = true
end
end
return aniSequence, influenceElementTypeMap, lineCount, elementTypeMap, linkElementType, effectGridMap
end
function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequenceMap, aniSequence, gridMap)
self:setGridBreakCondition(gridMap, posId, condition)
if breakedMap[posId] or (sequenceMap[posId] and condition ~= GRID_BREAK_CONDITION.LINE) then
return
end
local gridEntities = self.battleData:getGridEnties()
local entity = gridEntities[posId]
local breaked, isIdle = entity:tryBreakGrid(condition, true)
local aniUnit = self:getEliminattionAniInfo(posId, time)
aniUnit.noAni = entity:isElmentTypeInvalid()
aniUnit.isIdle = isIdle
if entity:getSkillId() then
aniUnit.isSkill = true
end
if breaked then
breakedMap[posId] = true
aniUnit.breakSfxName = entity:getBreakSfx()
aniUnit.callback = function()
entity:tryBreakGrid(condition)
end
table.insert(aniSequence, aniUnit)
else
if entity:canBreakByThisCondition(condition) then
breakedMap[posId] = true
aniUnit.callback = function()
entity:tryBreakGrid(condition)
end
table.insert(aniSequence, aniUnit)
end
end
if isIdle then
if condition == GRID_BREAK_CONDITION.LINE then
local outline = BattleConst.UP_DOWN_LEFT_RIGHT[posId]
for _, id in ipairs(outline) do
self:dealGridBreak(id, GRID_BREAK_CONDITION.AROUND, time, breakedMap, sequenceMap, aniSequence, gridMap)
end
end
if entity:getEffectType() then
local list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self)
if list then
aniUnit.aniPosList = {}
aniUnit.overCallback = aniUnit.callback
aniUnit.callback = nil
for index, id in ipairs(list) do
if id ~= posId then
self:dealGridBreak(id, GRID_BREAK_CONDITION.SKILL, time + BattleConst.GRID_BREAK_EFFECT_INTERVAL * index, breakedMap, sequenceMap, aniSequence, gridMap)
table.insert(aniUnit.aniPosList, id)
end
end
end
end
end
return isIdle
end
function BattleController:dealSkillElement(time, breakedMap, sequenceMap, aniSequence, boomGridIds)
local randomPosList
local influenceElementTypeMap = {}
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
local entity = self.battleData:getGridEntity(posId) local entity = self.battleData:getGridEntity(posId)
if not entity:getIsIdle() then if not entity:getIsIdle() then
@ -917,96 +1027,41 @@ function BattleController:onLinkOver()
end end
table.insert(randomPosList, posId) table.insert(randomPosList, posId)
end end
influenceElementTypeMap[entity:getElementType()] = (influenceElementTypeMap[entity:getElementType()] or 0) + 1
end end
self:setGridBreakCondition(boomGridIds, posId, GRID_BREAK_CONDITION.SKILL) self:dealGridBreak(posId, GRID_BREAK_CONDITION.SKILL, time, breakedMap, sequenceMap, aniSequence, boomGridIds)
end end
end end
local gridBreakSfxInfo return randomPosList, influenceElementTypeMap
for posId, boomTypes in pairs(boomGridIds) do end
local entity = self.battleData:getGridEntity(posId)
if entity then
local breakSfxName = entity:getBreakSfx()
local elementTypeInvalid = entity:isElmentTypeInvalid()
local breaked, isIdle = entity:tryBreakGrid(boomTypes)
if breaked then
if breakSfxName then
if not gridBreakSfxInfo then
gridBreakSfxInfo = {}
end
if not gridBreakSfxInfo[breakSfxName] then
gridBreakSfxInfo[breakSfxName] = {}
end
table.insert(gridBreakSfxInfo[breakSfxName], posId)
end
end
if isIdle then
table.insert(sequence, {posId = posId, noAni = elementTypeInvalid})
if not entity:getSkillId() and not elementTypeInvalid then
local elementType = entity:getElementType()
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
end
if not entity:getSkillId() then function BattleController:getEliminattionAniInfo(posId, timeIdx)
if boomTypes[GRID_BREAK_CONDITION.SKILL] then return {
local elementType = entity:getElementType() posId = posId,
if not influenceElementType then noAni = nil,
influenceElementType = {} aniPosList = nil,
end breakSfxName = nil,
influenceElementType[elementType] = true timeIdx = timeIdx,
end conditions = nil,
isSkill = false,
if boomTypes[GRID_BREAK_CONDITION.LINE] then isIdle = false,
lineCount = lineCount + 1 callback = nil,
end overCallback = nil,
end }
end
end
end
---- 播放碎裂特效
if gridBreakSfxInfo then
for breakSfxName, list in pairs(gridBreakSfxInfo) do
for index, posId in ipairs(list) do
self.battleUI:getSfxGridBreak(breakSfxName, index, function(obj)
local pos = ModuleManager.BattleManager:getPosInfo(posId)
obj:setLocalScale(38, 38, 38)
obj:setLocalPosition(pos.x, pos.y, 0)
obj:play()
end)
end
end
end
if skillPosId then
local rangeList = skillEntity:getBoardRange()
self.battleUI:playSkillLineSfx(skillPosId, rangeList, randomPosList)
end
self.battleData:addSkillEnergy(elementTypeMap)
self.battleData:clearGridSequence()
self.battleUI:disableUITouch()
self.battleUI:eliminationAni(sequence, function()
self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementType, elementTypeMap)
self:enterRefreshBoard()
end)
self.eliminateCount = self.eliminateCount + 1
self.eliminateTotalCount = self.eliminateTotalCount + 1
end end
function BattleController:setGridBreakCondition(gridMap, posId, condition) function BattleController:setGridBreakCondition(gridMap, posId, condition)
if not gridMap[posId] then if not gridMap[posId] then
gridMap[posId] = {} gridMap[posId] = {}
gridMap[posId][condition] = true gridMap[posId][condition] = true
return true return true, true
end end
if gridMap[posId][condition] then if gridMap[posId][condition] then
return false return false
end end
gridMap[posId][condition] = true gridMap[posId][condition] = true
return true return true, false
end end
function BattleController:fillBoard(isRoundBeginCheck) function BattleController:fillBoard(isRoundBeginCheck)

View File

@ -0,0 +1,56 @@
local BattleConst = require "app/module/battle/battle_const"
local BattleGridEffectHandle = {}
local GRID_EFFECT_TYPE = BattleConst.GRID_EFFECT_TYPE
local GRID_BREAK_CONDITION = BattleConst.GRID_BREAK_CONDITION
local function _directionElinination(entity, gridEntities, battleController)
local effectParams = entity:getEffectParams()
if not effectParams then
return
end
local direction = effectParams[1]
local list = ModuleManager.BattleManager:getPosIdsByDirection(entity:getPosId(), direction)
return list
end
local function _crossSpread(entity, gridEntities, battleController)
local tempList = BattleConst.UP_DOWN_LEFT_RIGHT[entity:getPosId()]
if not tempList then
return
end
for _, posId in ipairs(tempList) do
local gridEntity = gridEntities[posId]
if gridEntity:isEmptyIdle() then
battleController.battleData:setGridType(posId, BattleConst.GRID_TYPE.JELLY)
end
end
local list = GFunc.getTable(tempList)
return list
end
BattleGridEffectHandle._gridEffectOn = {
[GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination,
[GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread,
}
function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController)
local entity = gridEntities[posId]
local effectType = entity:getEffectType()
if not effectType then
return
end
if entity:getEffectTrigger() ~= triggerType then
return
end
local func = BattleGridEffectHandle._gridEffectOn[effectType]
if func then
return func(entity, gridEntities, battleController)
end
end
return BattleGridEffectHandle

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 8a7948a2aa6fe264086e695e9670b6f9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -821,9 +821,9 @@ function BattleUI:refreshBoard()
end end
end end
function BattleUI:eliminationAni(sequence, callback) function BattleUI:eliminationAni(aniSequence, effectGridMap, callback)
self:showMask(true) self:showMask(true)
if not sequence then if not aniSequence then
if callback then if callback then
callback() callback()
end end
@ -847,36 +847,92 @@ function BattleUI:eliminationAni(sequence, callback)
self.posIdMap = {} self.posIdMap = {}
end end
for index, info in ipairs(sequence) do local breakSfxNameIndexMap = {}
for index, info in ipairs(aniSequence) do
if not self.posIdMap[info.posId] then if not self.posIdMap[info.posId] then
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
self.posIdMap[info.posId] = true self.posIdMap[info.posId] = true
local entity = DataManager.BattleData:getGridEntity(info.posId) local entity = DataManager.BattleData:getGridEntity(info.posId)
local time = info.timeIdx
if entity and entity:getCell() then if entity and entity:getCell() then
entity:getCell():refresh(entity) entity:getCell():refresh(entity)
local baseObject = entity:getCell():getBaseObject()
baseObject:getTransform():SetAsLastSibling() if info.callback then
if info.noAni then self.eliminationAniSeq:InsertCallback(time, function()
baseObject:setAnchoredPositionX(DEFAULT_X) if info.callback then
else info.callback()
if entity:getSkillId() then end
entity:getCell():hideSkillSfx() end)
end end
self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1))
self.eliminationAniSeq:InsertCallback(index * 0.01 + 0.2, function() if info.breakSfxName then
self:getSfxSmoke(index, function(obj) breakSfxNameIndexMap[info.breakSfxName] = (breakSfxNameIndexMap[info.breakSfxName] or 0) + 1
obj:setAnchoredPosition(pos.x, pos.y) self.eliminationAniSeq:InsertCallback(time, function()
self:getSfxGridBreak(info.breakSfxName, breakSfxNameIndexMap[info.breakSfxName], function(obj)
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
obj:setLocalScale(38, 38, 38)
obj:setLocalPosition(pos.x, pos.y, 0)
obj:play() obj:play()
end) end)
end) end)
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3)) end
self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOScale(0.5, 0.3))
if info.isIdle then
if entity:getSkillId() then
entity:getCell():hideSkillSfx()
end
local baseObject = entity:getCell():getBaseObject()
baseObject:getTransform():SetAsLastSibling()
if info.aniPosList then
local posList = {}
local count = 0
for _, posId in ipairs(info.aniPosList) do
table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId))
count = count + 1
end
local anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL
self.eliminationAniSeq:Insert(time, baseObject:getTransform():DOLocalPath(posList, anitime):SetEase(CS.DG.Tweening.Ease.Linear))
if info.overCallback then
self.eliminationAniSeq:InsertCallback(time + anitime, function()
if info.noAni then
baseObject:setAnchoredPositionX(DEFAULT_X)
end
info.overCallback()
end)
end
else
if info.noAni then
baseObject:setAnchoredPositionX(DEFAULT_X)
else
if info.rangeList then
self.eliminationAniSeq:InsertCallback(time, function()
self:playSkillLineSfx(info.posId, info.rangeList, info.randomPosList)
end)
end
self.eliminationAniSeq:Insert(time, baseObject:getTransform():DOScale(1.3, 0.1))
self.eliminationAniSeq:InsertCallback(time + 0.2, function()
self:getSfxSmoke(index, function(obj)
obj:setAnchoredPosition(pos.x, pos.y)
obj:play()
end)
end)
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3))
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOScale(0.5, 0.3))
end
end
end end
end end
end end
end end
for posId, _ in pairs(effectGridMap) do
local entity = DataManager.BattleData:getGridEntity(posId)
local baseObject = entity:getCell():getBaseObject()
baseObject:getTransform():SetAsLastSibling()
end
self.eliminationAniSeq:AppendCallback(function() self.eliminationAniSeq:AppendCallback(function()
for posId, _ in pairs(self.posIdMap) do for posId, _ in pairs(self.posIdMap) do
local entity = DataManager.BattleData:getGridEntity(posId) local entity = DataManager.BattleData:getGridEntity(posId)

View File

@ -11,7 +11,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType) local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType)
elementIcon:setSprite(atlas, icon) elementIcon:setSprite(atlas, icon)
end end
elementIcon:setVisible(true) elementIcon:setVisible(not gridEntity:isElmentTypeInvalid())
local showMask = false local showMask = false
if curElement and (curElement ~= elementType or not gridEntity:canLink()) then if curElement and (curElement ~= elementType or not gridEntity:canLink()) then

View File

@ -90,7 +90,7 @@ function BattleGridEntity:isElmentTypeInvalid()
end end
---- 返回值1为true 返回值2为是否为idle状态返回值1为false时没有返回值2 ---- 返回值1为true 返回值2为是否为idle状态返回值1为false时没有返回值2
function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck) function BattleGridEntity:tryBreakGrid(condition, onlyCheck)
if self:getIsIdle() then if self:getIsIdle() then
if not onlyCheck then if not onlyCheck then
self:setGridType(BattleConst.GRID_TYPE.EMPTY) self:setGridType(BattleConst.GRID_TYPE.EMPTY)
@ -98,15 +98,9 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck)
return false return false
end end
local nextGridType = self:getNextGridType() local nextGridType = self:getNextGridType()
local isIdle = false
if nextGridType then if nextGridType then
local canbreak = false if not self:canBreakByThisCondition(condition) then
for boomType, _ in pairs(boomTypes) do
if self:canBreakByThisCondition(boomType) then
canbreak = true
break
end
end
if not canbreak then
return false return false
end end
@ -120,7 +114,7 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck)
local breakStayElement = self:getBreakStayElement() local breakStayElement = self:getBreakStayElement()
self:setGridType(nextGridType) self:setGridType(nextGridType)
if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then
self:setIsIdle(true) isIdle = true
end end
else else
if self:getBreakCount() + 1 < self:getCfgBreakCount() then if self:getBreakCount() + 1 < self:getCfgBreakCount() then
@ -129,36 +123,29 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck)
local breakStayElement = self:getBreakStayElement() local breakStayElement = self:getBreakStayElement()
if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then
return true, true isIdle = true
else
return true, false
end end
end end
else else
if self:getSkillId() then if self:getSkillId() then
if boomTypes[BattleConst.GRID_BREAK_CONDITION.LINE] then -- 技能破碎逻辑为,链接消除 if condition == BattleConst.GRID_BREAK_CONDITION.LINE then -- 技能破碎逻辑为,链接消除
if not onlyCheck then isIdle = true
self:setIsIdle(true)
end
else else
return false return false
end end
else else
if self:isEmptyIdle() and (boomTypes[BattleConst.GRID_BREAK_CONDITION.LINE] or boomTypes[BattleConst.GRID_BREAK_CONDITION.SKILL]) then -- 空类型/带技能破碎逻辑为,链接消除 置为闲置即消除 if self:isEmptyIdle() and (condition == BattleConst.GRID_BREAK_CONDITION.LINE or condition == BattleConst.GRID_BREAK_CONDITION.SKILL) then -- 空类型/带技能破碎逻辑为,链接消除 置为闲置即消除
if not onlyCheck then isIdle = true
self:setIsIdle(true)
end
else -- 不可破碎类型 else -- 不可破碎类型
return false return false
end end
end end
end end
if not onlyCheck then if not onlyCheck then
self:setIsIdle(isIdle)
self:setDirty() self:setDirty()
return true, self:getIsIdle()
else
return true, true
end end
return true, isIdle
end end
function BattleGridEntity:getPos() function BattleGridEntity:getPos()
@ -387,4 +374,16 @@ function BattleGridEntity:addBreakCount(count)
self.breakCount = self.breakCount + count self.breakCount = self.breakCount + count
end end
function BattleGridEntity:getEffectType()
return self:getGridTypeConfig().effect
end
function BattleGridEntity:getEffectParams()
return self:getGridTypeConfig().effect_params
end
function BattleGridEntity:getEffectTrigger()
return self:getGridTypeConfig().effect_trigger
end
return BattleGridEntity return BattleGridEntity