diff --git a/lua/app/config/grid_type.lua b/lua/app/config/grid_type.lua index 86c70470..bd9e75b2 100644 --- a/lua/app/config/grid_type.lua +++ b/lua/app/config/grid_type.lua @@ -54,12 +54,12 @@ local grid_type = { ["break_sfx"]="sfx_piece_za_b02" }, [6]={ - ["icon"]="ice", + ["icon"]="lock", ["can_fall"]=1, ["cant_link"]=1 }, [7]={ - ["icon"]="stone_1", + ["icon"]="stone_3", ["next_type"]=3, ["break_condition"]={ 1, @@ -71,7 +71,7 @@ local grid_type = { ["break_sfx"]="sfx_piece_za_b01" }, [8]={ - ["icon"]="stone_1", + ["icon"]="rocket_up", ["next_type"]=0, ["break_condition"]={ 1, @@ -80,13 +80,14 @@ local grid_type = { ["break_count"]=1, ["cant_link"]=1, ["element_invalid"]=1, - ["break_effect"]=1, - ["break_effect_parms"]={ + ["effect"]=1, + ["effect_params"]={ 1 - } + }, + ["effect_trigger"]=2 }, [9]={ - ["icon"]="stone_1", + ["icon"]="rocket_down", ["next_type"]=0, ["break_condition"]={ 1, @@ -95,13 +96,14 @@ local grid_type = { ["break_count"]=1, ["cant_link"]=1, ["element_invalid"]=1, - ["break_effect"]=1, - ["break_effect_parms"]={ + ["effect"]=1, + ["effect_params"]={ 2 - } + }, + ["effect_trigger"]=2 }, [10]={ - ["icon"]="stone_1", + ["icon"]="rocket_left", ["next_type"]=0, ["break_condition"]={ 1, @@ -110,13 +112,14 @@ local grid_type = { ["break_count"]=1, ["cant_link"]=1, ["element_invalid"]=1, - ["break_effect"]=1, - ["break_effect_parms"]={ + ["effect"]=1, + ["effect_params"]={ 3 - } + }, + ["effect_trigger"]=2 }, [11]={ - ["icon"]="stone_1", + ["icon"]="rocket_right", ["next_type"]=0, ["break_condition"]={ 1, @@ -125,13 +128,14 @@ local grid_type = { ["break_count"]=1, ["cant_link"]=1, ["element_invalid"]=1, - ["break_effect"]=1, - ["break_effect_parms"]={ + ["effect"]=1, + ["effect_params"]={ 4 - } + }, + ["effect_trigger"]=2 }, [12]={ - ["icon"]="ice", + ["icon"]="leaf", ["next_type"]=0, ["break_condition"]={ 1, @@ -143,16 +147,17 @@ local grid_type = { ["cant_link"]=1 }, [13]={ - ["icon"]="stone_1", + ["icon"]="jelly", ["next_type"]=0, ["break_condition"]={ 1, 3 }, ["break_count"]=1, + ["break_stay_element"]=1, ["cant_link"]=1, - ["element_invalid"]=1, - ["break_effect"]=2 + ["effect"]=2, + ["effect_trigger"]=1 } } local config = { diff --git a/lua/app/config/hero.lua b/lua/app/config/hero.lua index cc63f12a..d8645200 100644 --- a/lua/app/config/hero.lua +++ b/lua/app/config/hero.lua @@ -3,16 +3,17 @@ local hero = { ["position"]=1, ["qlt"]=2, ["hurt_skill"]={ - 1200110, 1200111, 1200112, - 1200113 + 1200113, + 1200114 }, ["base_skill"]=1200120, - ["rouge_skill"]=1200101, - ["rouge_skill_1"]=1200102, - ["rouge_skill_2"]=1200103, - ["rouge_skill_3"]=1200104, + ["support_skill"]=1200110, + ["rouge_skill"]=200500, + ["rouge_skill_1"]=200501, + ["rouge_skill_2"]=200502, + ["rouge_skill_3"]=200503, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -51,184 +52,23 @@ local hero = { ["model_id"]="p0005", ["icon"]="5", ["item_id"]=12001, - ["unlock_chapter"]=1 - }, - [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 + ["unlock_chapter"]=0 }, [22001]={ ["position"]=2, ["qlt"]=2, ["hurt_skill"]={ - 2200110, 2200111, 2200112, - 2200113 + 2200113, + 2200114 }, ["base_skill"]=2200120, - ["rouge_skill"]=2200101, - ["rouge_skill_1"]=2200102, - ["rouge_skill_2"]=2200103, - ["rouge_skill_3"]=2200104, + ["support_skill"]=2200110, + ["rouge_skill"]=200200, + ["rouge_skill_1"]=200201, + ["rouge_skill_2"]=200202, + ["rouge_skill_3"]=200203, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -267,130 +107,78 @@ local hero = { ["model_id"]="p0002", ["icon"]="2", ["item_id"]=22001, - ["unlock_chapter"]=1 + ["unlock_chapter"]=0 }, [23001]={ ["position"]=2, ["qlt"]=3, ["hurt_skill"]={ - 2300110, 2300111, 2300112, - 2300113 + 2300113, + 2300114 }, ["base_skill"]=2300120, - ["rouge_skill"]=2200101, - ["rouge_skill_1"]=2200102, - ["rouge_skill_2"]=2200103, - ["rouge_skill_3"]=2200104, + ["support_skill"]=2300110, + ["rouge_skill"]=200700, + ["rouge_skill_1"]=200701, + ["rouge_skill_2"]=200702, + ["rouge_skill_3"]=200703, ["begin_lv"]=3, ["hp"]={ - 2000000, - 2400000, - 2800000, - 3220000, - 3660000, - 4120000, - 4620000, + 3000000, + 3520000, + 4040000, + 4580000, 5160000, 5760000, 6420000, - 7140000, - 7940000, - 8840000, - 9840000, - 10980000 + 7120000, + 7900000, + 8760000, + 9700000, + 10740000, + 11920000, + 13220000, + 14700000 }, ["atk"]={ - 1000000, - 1200000, - 1400000, - 1610000, - 1830000, - 2060000, - 2310000, + 1500000, + 1760000, + 2020000, + 2290000, 2580000, 2880000, 3210000, - 3570000, - 3970000, - 4420000, - 4920000, - 5490000 - }, - ["model_id"]="p0010", - ["icon"]="5", - ["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 + 3560000, + 3950000, + 4380000, + 4850000, + 5370000, + 5960000, + 6610000, + 7350000 }, ["model_id"]="p0007", ["icon"]="7", - ["item_id"]=24001, - ["unlock_chapter"]=1 + ["item_id"]=23001, + ["unlock_chapter"]=0 }, [32001]={ ["position"]=3, ["qlt"]=2, ["hurt_skill"]={ - 3200110, 3200111, 3200112, - 3200113 + 3200113, + 3200114 }, ["base_skill"]=3200120, - ["rouge_skill"]=3200101, - ["rouge_skill_1"]=3200102, - ["rouge_skill_2"]=3200103, - ["rouge_skill_3"]=3200104, + ["support_skill"]=3200110, + ["rouge_skill"]=200100, + ["rouge_skill_1"]=200101, + ["rouge_skill_2"]=200102, + ["rouge_skill_3"]=200103, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -429,76 +217,78 @@ local hero = { ["model_id"]="p0001", ["icon"]="1", ["item_id"]=32001, - ["unlock_chapter"]=1 + ["unlock_chapter"]=0 }, [33001]={ ["position"]=3, ["qlt"]=3, ["hurt_skill"]={ - 3300110, 3300111, 3300112, - 3300113 + 3300113, + 3300114 }, ["base_skill"]=3300120, - ["rouge_skill"]=3300101, - ["rouge_skill_1"]=3300102, - ["rouge_skill_2"]=3300103, - ["rouge_skill_3"]=3300104, + ["support_skill"]=3300110, + ["rouge_skill"]=200600, + ["rouge_skill_1"]=200601, + ["rouge_skill_2"]=200602, + ["rouge_skill_3"]=200603, ["begin_lv"]=3, ["hp"]={ - 2000000, - 2400000, - 2800000, - 3220000, - 3660000, - 4120000, - 4620000, + 3000000, + 3520000, + 4040000, + 4580000, 5160000, 5760000, 6420000, - 7140000, - 7940000, - 8840000, - 9840000, - 10980000 + 7120000, + 7900000, + 8760000, + 9700000, + 10740000, + 11920000, + 13220000, + 14700000 }, ["atk"]={ - 1000000, - 1200000, - 1400000, - 1610000, - 1830000, - 2060000, - 2310000, + 1500000, + 1760000, + 2020000, + 2290000, 2580000, 2880000, 3210000, - 3570000, - 3970000, - 4420000, - 4920000, - 5490000 + 3560000, + 3950000, + 4380000, + 4850000, + 5370000, + 5960000, + 6610000, + 7350000 }, ["model_id"]="p0006", ["icon"]="6", ["item_id"]=33001, - ["unlock_chapter"]=1 + ["unlock_chapter"]=0 }, [42001]={ ["position"]=4, ["qlt"]=2, ["hurt_skill"]={ - 4200110, 4200111, 4200112, - 4200113 + 4200113, + 4200114 }, ["base_skill"]=4200120, - ["rouge_skill"]=4200101, - ["rouge_skill_1"]=4200102, - ["rouge_skill_2"]=4200103, - ["rouge_skill_3"]=4200104, + ["support_skill"]=4200110, + ["rouge_skill"]=200300, + ["rouge_skill_1"]=200301, + ["rouge_skill_2"]=200302, + ["rouge_skill_3"]=200303, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -537,76 +327,78 @@ local hero = { ["model_id"]="p0003", ["icon"]="3", ["item_id"]=42001, - ["unlock_chapter"]=1 + ["unlock_chapter"]=0 }, - [44001]={ + [43001]={ ["position"]=4, - ["qlt"]=4, + ["qlt"]=3, ["hurt_skill"]={ - 4400110, - 4400111, - 4400112, - 4400113 + 4300111, + 4300112, + 4300113, + 4300114 }, - ["base_skill"]=4400120, - ["rouge_skill"]=4400101, - ["rouge_skill_1"]=4400102, - ["rouge_skill_2"]=4400103, - ["rouge_skill_3"]=4400104, - ["begin_lv"]=5, + ["base_skill"]=4300120, + ["support_skill"]=4300110, + ["rouge_skill"]=200800, + ["rouge_skill_1"]=200801, + ["rouge_skill_2"]=200802, + ["rouge_skill_3"]=200803, + ["begin_lv"]=3, ["hp"]={ - 2000000, - 2400000, - 2800000, - 3220000, - 3660000, - 4120000, - 4620000, + 3000000, + 3520000, + 4040000, + 4580000, 5160000, 5760000, 6420000, - 7140000, - 7940000, - 8840000, - 9840000, - 10980000 + 7120000, + 7900000, + 8760000, + 9700000, + 10740000, + 11920000, + 13220000, + 14700000 }, ["atk"]={ - 1000000, - 1200000, - 1400000, - 1610000, - 1830000, - 2060000, - 2310000, + 1500000, + 1760000, + 2020000, + 2290000, 2580000, 2880000, 3210000, - 3570000, - 3970000, - 4420000, - 4920000, - 5490000 + 3560000, + 3950000, + 4380000, + 4850000, + 5370000, + 5960000, + 6610000, + 7350000 }, ["model_id"]="p0008", ["icon"]="8", - ["item_id"]=44001, - ["unlock_chapter"]=1 + ["item_id"]=43001, + ["unlock_chapter"]=0 }, [52001]={ ["position"]=5, ["qlt"]=2, ["hurt_skill"]={ - 5200110, 5200111, 5200112, - 5200113 + 5200113, + 5200114 }, ["base_skill"]=5200120, - ["rouge_skill"]=5200101, - ["rouge_skill_1"]=5200102, - ["rouge_skill_2"]=5200103, - ["rouge_skill_3"]=5200104, + ["support_skill"]=5200110, + ["rouge_skill"]=200400, + ["rouge_skill_1"]=200401, + ["rouge_skill_2"]=200402, + ["rouge_skill_3"]=200403, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -645,10 +437,10 @@ local hero = { ["model_id"]="p0004", ["icon"]="4", ["item_id"]=52001, - ["unlock_chapter"]=1 + ["unlock_chapter"]=0 } } local config = { -data=hero,count=12 +data=hero,count=8 } return config \ No newline at end of file diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 9db3ddd0..8404962f 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -47,6 +47,9 @@ BattleConst.RECOVER_HP_INTERVAL = 0.2 BattleConst.RECOVER_HP_PERCENT = 333 BattleConst.EFFECT_NUMBER_DELAY = 0.2 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 = { WAIT_BEGIN = 0, -- 等待开始 @@ -361,14 +364,25 @@ BattleConst.GRID_TYPE = { VINES = 4, ICE = 5, LOCK = 6, + JELLY = 13, } BattleConst.GRID_BREAK_CONDITION = { - ACOUND = 1, + AROUND = 1, LINE = 2, 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 = { NONE = 0, diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 5eed3db4..cc4328c2 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -271,6 +271,34 @@ function BattleManager:getPosCenterAndDir(pos1, pos2) return centerPos, zEuler 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 一些公共相关的方法 ----------------------------- function BattleManager:bindBattleUnitAttribute(hashCode, side) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 741f4c4f..5aaf1135 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -8,6 +8,7 @@ local BattleController = class("BattleController") 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_GRID_EFFECT_HANDLE = require "app/module/battle/skill/battle_grid_effect_handle" local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle" local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT @@ -144,8 +145,6 @@ function BattleController:onLinkChange() entity:getCell():showAni() end end - - self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.LINE) end for posId, cell in pairs(needFalsePosMap) do @@ -158,24 +157,10 @@ function BattleController:onLinkChange() if entity:getCell() then entity:getCell():showCircle(true) end - self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.SKILL) end end - local elementTypeMap = {} - 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 + local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination() self.battleUI:refreshSkill(elementTypeMap, count > 0) if mainElementType then @@ -464,6 +449,19 @@ end function BattleController:enterRoundBegin() 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() end @@ -878,35 +876,147 @@ function BattleController:onLinkOver() local skillId = self.battleData:getSequenceHadSkill() local skillEntity - local linkElementType - local influenceElementType if skillId then skillEntity = self.battleData:getSkillEntityBySkillId(skillId) 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 lineCount = 0 + local sequenceMap = {} + for idx, info in ipairs(sequence) do + sequenceMap[info.posId] = idx + end - local skillPosId - local randomPosList - for _, info in ipairs(sequence) do - local entity = self.battleData:getGridEntity(info.posId) - if entity:getSkillId() then - skillPosId = info.posId - else - linkElementType = entity:getElementType() - end - self:setGridBreakCondition(boomGridIds, info.posId, GRID_BREAK_CONDITION.LINE) + local time = 0 + local skillTime = BattleConst.SKILL_ELIMINATION_TIME + local aniSequence = {} + for idx, info in ipairs(sequence) do + local posId = info.posId + self:dealGridBreak(posId, GRID_BREAK_CONDITION.LINE, time, breakedMap, sequenceMap, aniSequence, boomGridIds) + time = time + BattleConst.ELIMINATION_INTERVAL + end - local outline = BattleConst.UP_DOWN_LEFT_RIGHT[info.posId] - for _, aroundPosId in ipairs(outline) do - self:setGridBreakCondition(boomGridIds, aroundPosId, GRID_BREAK_CONDITION.ACOUND) + local randomPosList, influenceElementTypeMap + for i, info in ipairs(aniSequence) do + 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 - 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 local entity = self.battleData:getGridEntity(posId) if not entity:getIsIdle() then @@ -917,96 +1027,41 @@ function BattleController:onLinkOver() end table.insert(randomPosList, posId) end + influenceElementTypeMap[entity:getElementType()] = (influenceElementTypeMap[entity:getElementType()] or 0) + 1 end - self:setGridBreakCondition(boomGridIds, posId, GRID_BREAK_CONDITION.SKILL) + self:dealGridBreak(posId, GRID_BREAK_CONDITION.SKILL, time, breakedMap, sequenceMap, aniSequence, boomGridIds) end end - local gridBreakSfxInfo - for posId, boomTypes in pairs(boomGridIds) do - 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 + return randomPosList, influenceElementTypeMap +end - if not entity:getSkillId() then - if boomTypes[GRID_BREAK_CONDITION.SKILL] then - local elementType = entity:getElementType() - if not influenceElementType then - influenceElementType = {} - end - influenceElementType[elementType] = true - end - - if boomTypes[GRID_BREAK_CONDITION.LINE] then - lineCount = lineCount + 1 - end - 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 +function BattleController:getEliminattionAniInfo(posId, timeIdx) + return { + posId = posId, + noAni = nil, + aniPosList = nil, + breakSfxName = nil, + timeIdx = timeIdx, + conditions = nil, + isSkill = false, + isIdle = false, + callback = nil, + overCallback = nil, + } end function BattleController:setGridBreakCondition(gridMap, posId, condition) if not gridMap[posId] then gridMap[posId] = {} gridMap[posId][condition] = true - return true + return true, true end if gridMap[posId][condition] then return false end gridMap[posId][condition] = true - return true + return true, false end function BattleController:fillBoard(isRoundBeginCheck) diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua b/lua/app/module/battle/skill/battle_grid_effect_handle.lua new file mode 100644 index 00000000..e8167800 --- /dev/null +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -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 \ No newline at end of file diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua.meta b/lua/app/module/battle/skill/battle_grid_effect_handle.lua.meta new file mode 100644 index 00000000..10f98460 --- /dev/null +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 8a7948a2aa6fe264086e695e9670b6f9 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 1646bad7..a4219a13 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -821,9 +821,9 @@ function BattleUI:refreshBoard() end end -function BattleUI:eliminationAni(sequence, callback) +function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) self:showMask(true) - if not sequence then + if not aniSequence then if callback then callback() end @@ -847,36 +847,92 @@ function BattleUI:eliminationAni(sequence, callback) self.posIdMap = {} end - for index, info in ipairs(sequence) do + local breakSfxNameIndexMap = {} + for index, info in ipairs(aniSequence) do if not self.posIdMap[info.posId] then local pos = ModuleManager.BattleManager:getPosInfo(info.posId) self.posIdMap[info.posId] = true local entity = DataManager.BattleData:getGridEntity(info.posId) + local time = info.timeIdx if entity and entity:getCell() then entity:getCell():refresh(entity) - local baseObject = entity:getCell():getBaseObject() - baseObject:getTransform():SetAsLastSibling() - if info.noAni then - baseObject:setAnchoredPositionX(DEFAULT_X) - else - if entity:getSkillId() then - entity:getCell():hideSkillSfx() - end - self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1)) - self.eliminationAniSeq:InsertCallback(index * 0.01 + 0.2, function() - self:getSfxSmoke(index, function(obj) - obj:setAnchoredPosition(pos.x, pos.y) + + if info.callback then + self.eliminationAniSeq:InsertCallback(time, function() + if info.callback then + info.callback() + end + end) + end + + if info.breakSfxName then + breakSfxNameIndexMap[info.breakSfxName] = (breakSfxNameIndexMap[info.breakSfxName] or 0) + 1 + 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() end) end) - self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3)) - self.eliminationAniSeq:Insert(index * 0.01 + 0.2, baseObject:getTransform():DOScale(0.5, 0.3)) + end + + 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 + 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() for posId, _ in pairs(self.posIdMap) do local entity = DataManager.BattleData:getGridEntity(posId) diff --git a/lua/app/ui/battle/cell/grid_cell.lua b/lua/app/ui/battle/cell/grid_cell.lua index 0a8528cd..045a8ac0 100644 --- a/lua/app/ui/battle/cell/grid_cell.lua +++ b/lua/app/ui/battle/cell/grid_cell.lua @@ -11,7 +11,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId) local atlas, icon = ModuleManager.BattleManager:getElementIcon(elementType) elementIcon:setSprite(atlas, icon) end - elementIcon:setVisible(true) + elementIcon:setVisible(not gridEntity:isElmentTypeInvalid()) local showMask = false if curElement and (curElement ~= elementType or not gridEntity:canLink()) then diff --git a/lua/app/userdata/battle/battle_grid_entity.lua b/lua/app/userdata/battle/battle_grid_entity.lua index 5f4ebffa..1a40c8c3 100644 --- a/lua/app/userdata/battle/battle_grid_entity.lua +++ b/lua/app/userdata/battle/battle_grid_entity.lua @@ -90,7 +90,7 @@ function BattleGridEntity:isElmentTypeInvalid() end ---- 返回值1为true, 返回值2为是否为idle状态;返回值1为false时,没有返回值2 -function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck) +function BattleGridEntity:tryBreakGrid(condition, onlyCheck) if self:getIsIdle() then if not onlyCheck then self:setGridType(BattleConst.GRID_TYPE.EMPTY) @@ -98,15 +98,9 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck) return false end local nextGridType = self:getNextGridType() + local isIdle = false if nextGridType then - local canbreak = false - for boomType, _ in pairs(boomTypes) do - if self:canBreakByThisCondition(boomType) then - canbreak = true - break - end - end - if not canbreak then + if not self:canBreakByThisCondition(condition) then return false end @@ -120,7 +114,7 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck) local breakStayElement = self:getBreakStayElement() self:setGridType(nextGridType) if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then - self:setIsIdle(true) + isIdle = true end else if self:getBreakCount() + 1 < self:getCfgBreakCount() then @@ -129,36 +123,29 @@ function BattleGridEntity:tryBreakGrid(boomTypes, onlyCheck) local breakStayElement = self:getBreakStayElement() if nextGridType == BattleConst.GRID_TYPE.EMPTY and not breakStayElement then - return true, true - else - return true, false + isIdle = true end end else if self:getSkillId() then - if boomTypes[BattleConst.GRID_BREAK_CONDITION.LINE] then -- 技能破碎逻辑为,链接消除 - if not onlyCheck then - self:setIsIdle(true) - end + if condition == BattleConst.GRID_BREAK_CONDITION.LINE then -- 技能破碎逻辑为,链接消除 + isIdle = true else return false end else - if self:isEmptyIdle() and (boomTypes[BattleConst.GRID_BREAK_CONDITION.LINE] or boomTypes[BattleConst.GRID_BREAK_CONDITION.SKILL]) then -- 空类型/带技能破碎逻辑为,链接消除 置为闲置即消除 - if not onlyCheck then - self:setIsIdle(true) - end + if self:isEmptyIdle() and (condition == BattleConst.GRID_BREAK_CONDITION.LINE or condition == BattleConst.GRID_BREAK_CONDITION.SKILL) then -- 空类型/带技能破碎逻辑为,链接消除 置为闲置即消除 + isIdle = true else -- 不可破碎类型 return false end end end if not onlyCheck then + self:setIsIdle(isIdle) self:setDirty() - return true, self:getIsIdle() - else - return true, true end + return true, isIdle end function BattleGridEntity:getPos() @@ -387,4 +374,16 @@ function BattleGridEntity:addBreakCount(count) self.breakCount = self.breakCount + count 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 \ No newline at end of file