diff --git a/lua/app/config/grid_type.lua b/lua/app/config/grid_type.lua index bd9e75b2..bd81981c 100644 --- a/lua/app/config/grid_type.lua +++ b/lua/app/config/grid_type.lua @@ -155,12 +155,40 @@ local grid_type = { }, ["break_count"]=1, ["break_stay_element"]=1, + ["can_fall"]=1, ["cant_link"]=1, + ["element_invalid"]=1, ["effect"]=2, ["effect_trigger"]=1 + }, + [14]={ + ["icon"]="jelly", + ["next_type"]=0, + ["break_condition"]={ + 1, + 3 + }, + ["break_count"]=1, + ["cant_link"]=1, + ["element_invalid"]=1, + ["effect"]=3, + ["effect_trigger"]=2 + }, + [15]={ + ["icon"]="jelly", + ["next_type"]=0, + ["break_condition"]={ + 1, + 3 + }, + ["break_count"]=3, + ["cant_link"]=1, + ["element_invalid"]=1, + ["effect"]=4, + ["effect_trigger"]=2 } } local config = { -data=grid_type,count=14 +data=grid_type,count=16 } return config \ No newline at end of file diff --git a/lua/app/config/hero.lua b/lua/app/config/hero.lua index d8645200..cc63f12a 100644 --- a/lua/app/config/hero.lua +++ b/lua/app/config/hero.lua @@ -3,17 +3,16 @@ local hero = { ["position"]=1, ["qlt"]=2, ["hurt_skill"]={ + 1200110, 1200111, 1200112, - 1200113, - 1200114 + 1200113 }, ["base_skill"]=1200120, - ["support_skill"]=1200110, - ["rouge_skill"]=200500, - ["rouge_skill_1"]=200501, - ["rouge_skill_2"]=200502, - ["rouge_skill_3"]=200503, + ["rouge_skill"]=1200101, + ["rouge_skill_1"]=1200102, + ["rouge_skill_2"]=1200103, + ["rouge_skill_3"]=1200104, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -52,23 +51,184 @@ local hero = { ["model_id"]="p0005", ["icon"]="5", ["item_id"]=12001, - ["unlock_chapter"]=0 + ["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 }, [22001]={ ["position"]=2, ["qlt"]=2, ["hurt_skill"]={ + 2200110, 2200111, 2200112, - 2200113, - 2200114 + 2200113 }, ["base_skill"]=2200120, - ["support_skill"]=2200110, - ["rouge_skill"]=200200, - ["rouge_skill_1"]=200201, - ["rouge_skill_2"]=200202, - ["rouge_skill_3"]=200203, + ["rouge_skill"]=2200101, + ["rouge_skill_1"]=2200102, + ["rouge_skill_2"]=2200103, + ["rouge_skill_3"]=2200104, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -107,78 +267,130 @@ local hero = { ["model_id"]="p0002", ["icon"]="2", ["item_id"]=22001, - ["unlock_chapter"]=0 + ["unlock_chapter"]=1 }, [23001]={ ["position"]=2, ["qlt"]=3, ["hurt_skill"]={ + 2300110, 2300111, 2300112, - 2300113, - 2300114 + 2300113 }, ["base_skill"]=2300120, - ["support_skill"]=2300110, - ["rouge_skill"]=200700, - ["rouge_skill_1"]=200701, - ["rouge_skill_2"]=200702, - ["rouge_skill_3"]=200703, + ["rouge_skill"]=2200101, + ["rouge_skill_1"]=2200102, + ["rouge_skill_2"]=2200103, + ["rouge_skill_3"]=2200104, ["begin_lv"]=3, ["hp"]={ - 3000000, - 3520000, - 4040000, - 4580000, + 2000000, + 2400000, + 2800000, + 3220000, + 3660000, + 4120000, + 4620000, 5160000, 5760000, 6420000, - 7120000, - 7900000, - 8760000, - 9700000, - 10740000, - 11920000, - 13220000, - 14700000 + 7140000, + 7940000, + 8840000, + 9840000, + 10980000 }, ["atk"]={ - 1500000, - 1760000, - 2020000, - 2290000, + 1000000, + 1200000, + 1400000, + 1610000, + 1830000, + 2060000, + 2310000, 2580000, 2880000, 3210000, - 3560000, - 3950000, - 4380000, - 4850000, - 5370000, - 5960000, - 6610000, - 7350000 + 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 }, ["model_id"]="p0007", ["icon"]="7", - ["item_id"]=23001, - ["unlock_chapter"]=0 + ["item_id"]=24001, + ["unlock_chapter"]=1 }, [32001]={ ["position"]=3, ["qlt"]=2, ["hurt_skill"]={ + 3200110, 3200111, 3200112, - 3200113, - 3200114 + 3200113 }, ["base_skill"]=3200120, - ["support_skill"]=3200110, - ["rouge_skill"]=200100, - ["rouge_skill_1"]=200101, - ["rouge_skill_2"]=200102, - ["rouge_skill_3"]=200103, + ["rouge_skill"]=3200101, + ["rouge_skill_1"]=3200102, + ["rouge_skill_2"]=3200103, + ["rouge_skill_3"]=3200104, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -217,78 +429,76 @@ local hero = { ["model_id"]="p0001", ["icon"]="1", ["item_id"]=32001, - ["unlock_chapter"]=0 + ["unlock_chapter"]=1 }, [33001]={ ["position"]=3, ["qlt"]=3, ["hurt_skill"]={ + 3300110, 3300111, 3300112, - 3300113, - 3300114 + 3300113 }, ["base_skill"]=3300120, - ["support_skill"]=3300110, - ["rouge_skill"]=200600, - ["rouge_skill_1"]=200601, - ["rouge_skill_2"]=200602, - ["rouge_skill_3"]=200603, + ["rouge_skill"]=3300101, + ["rouge_skill_1"]=3300102, + ["rouge_skill_2"]=3300103, + ["rouge_skill_3"]=3300104, ["begin_lv"]=3, ["hp"]={ - 3000000, - 3520000, - 4040000, - 4580000, + 2000000, + 2400000, + 2800000, + 3220000, + 3660000, + 4120000, + 4620000, 5160000, 5760000, 6420000, - 7120000, - 7900000, - 8760000, - 9700000, - 10740000, - 11920000, - 13220000, - 14700000 + 7140000, + 7940000, + 8840000, + 9840000, + 10980000 }, ["atk"]={ - 1500000, - 1760000, - 2020000, - 2290000, + 1000000, + 1200000, + 1400000, + 1610000, + 1830000, + 2060000, + 2310000, 2580000, 2880000, 3210000, - 3560000, - 3950000, - 4380000, - 4850000, - 5370000, - 5960000, - 6610000, - 7350000 + 3570000, + 3970000, + 4420000, + 4920000, + 5490000 }, ["model_id"]="p0006", ["icon"]="6", ["item_id"]=33001, - ["unlock_chapter"]=0 + ["unlock_chapter"]=1 }, [42001]={ ["position"]=4, ["qlt"]=2, ["hurt_skill"]={ + 4200110, 4200111, 4200112, - 4200113, - 4200114 + 4200113 }, ["base_skill"]=4200120, - ["support_skill"]=4200110, - ["rouge_skill"]=200300, - ["rouge_skill_1"]=200301, - ["rouge_skill_2"]=200302, - ["rouge_skill_3"]=200303, + ["rouge_skill"]=4200101, + ["rouge_skill_1"]=4200102, + ["rouge_skill_2"]=4200103, + ["rouge_skill_3"]=4200104, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -327,78 +537,76 @@ local hero = { ["model_id"]="p0003", ["icon"]="3", ["item_id"]=42001, - ["unlock_chapter"]=0 + ["unlock_chapter"]=1 }, - [43001]={ + [44001]={ ["position"]=4, - ["qlt"]=3, + ["qlt"]=4, ["hurt_skill"]={ - 4300111, - 4300112, - 4300113, - 4300114 + 4400110, + 4400111, + 4400112, + 4400113 }, - ["base_skill"]=4300120, - ["support_skill"]=4300110, - ["rouge_skill"]=200800, - ["rouge_skill_1"]=200801, - ["rouge_skill_2"]=200802, - ["rouge_skill_3"]=200803, - ["begin_lv"]=3, + ["base_skill"]=4400120, + ["rouge_skill"]=4400101, + ["rouge_skill_1"]=4400102, + ["rouge_skill_2"]=4400103, + ["rouge_skill_3"]=4400104, + ["begin_lv"]=5, ["hp"]={ - 3000000, - 3520000, - 4040000, - 4580000, + 2000000, + 2400000, + 2800000, + 3220000, + 3660000, + 4120000, + 4620000, 5160000, 5760000, 6420000, - 7120000, - 7900000, - 8760000, - 9700000, - 10740000, - 11920000, - 13220000, - 14700000 + 7140000, + 7940000, + 8840000, + 9840000, + 10980000 }, ["atk"]={ - 1500000, - 1760000, - 2020000, - 2290000, + 1000000, + 1200000, + 1400000, + 1610000, + 1830000, + 2060000, + 2310000, 2580000, 2880000, 3210000, - 3560000, - 3950000, - 4380000, - 4850000, - 5370000, - 5960000, - 6610000, - 7350000 + 3570000, + 3970000, + 4420000, + 4920000, + 5490000 }, ["model_id"]="p0008", ["icon"]="8", - ["item_id"]=43001, - ["unlock_chapter"]=0 + ["item_id"]=44001, + ["unlock_chapter"]=1 }, [52001]={ ["position"]=5, ["qlt"]=2, ["hurt_skill"]={ + 5200110, 5200111, 5200112, - 5200113, - 5200114 + 5200113 }, ["base_skill"]=5200120, - ["support_skill"]=5200110, - ["rouge_skill"]=200400, - ["rouge_skill_1"]=200401, - ["rouge_skill_2"]=200402, - ["rouge_skill_3"]=200403, + ["rouge_skill"]=5200101, + ["rouge_skill_1"]=5200102, + ["rouge_skill_2"]=5200103, + ["rouge_skill_3"]=5200104, ["begin_lv"]=1, ["hp"]={ 2000000, @@ -437,10 +645,10 @@ local hero = { ["model_id"]="p0004", ["icon"]="4", ["item_id"]=52001, - ["unlock_chapter"]=0 + ["unlock_chapter"]=1 } } local config = { -data=hero,count=8 +data=hero,count=12 } 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 8404962f..f2700b28 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -376,6 +376,7 @@ BattleConst.GRID_BREAK_CONDITION = { BattleConst.GRID_EFFECT_TYPE = { DIRECTION_ELIMINATION = 1, CROSS_SPREAD = 2, + SELECT_COMMON_SKILL = 3, } BattleConst.GRID_EFFECT_TRIGGER_TYPE = { diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 5aaf1135..2bcb6ccb 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -160,7 +160,7 @@ function BattleController:onLinkChange() end end - local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination() + local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination(true) self.battleUI:refreshSkill(elementTypeMap, count > 0) if mainElementType then @@ -477,40 +477,29 @@ function BattleController:enterElimination(needDelay) self.showSelectSkillSid = nil end - if self.battleData:useAddlvCount() then - local skillList = self:getRandomSkillList() - if needDelay then - self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function() - self.battleUI:showSelectSkillComp(skillList) - self.showSelectSkillSid = nil - end, 0.3) - else - self.battleUI:showSelectSkillComp(skillList) - end + if self:tryShowSelectSkillComp(needDelay) then + return + end - local totalTime = Time:getServerTime() - self.battleStartTime - BIReport:postShowFightSkillSelect(self.battleType, skillList, self.chapterId, totalTime, self.waveIndex) - else - self.battleUI:hideAllBoardSfxs() + self.battleUI:hideAllBoardSfxs() - -- 检查棋盘 - local find, pathList = self:findAttention() - if not find then -- 如果没找到,就要打乱棋盘 - self:shuffleBoard(function() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - end) - else - self.attentionList = pathList - -- ModuleManager.BattleManager:performWithDelayGlobal(function() - -- for _, posId in ipairs(pathList) do - -- local entity = self.battleData:getGridEntity(posId) - -- if entity and entity:getCell() then - -- entity:getCell():showAni() - -- end - -- end - -- end, 2) + -- 检查棋盘 + local find, pathList = self:findAttention() + if not find then -- 如果没找到,就要打乱棋盘 + self:shuffleBoard(function() self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - end + end) + else + self.attentionList = pathList + -- ModuleManager.BattleManager:performWithDelayGlobal(function() + -- for _, posId in ipairs(pathList) do + -- local entity = self.battleData:getGridEntity(posId) + -- if entity and entity:getCell() then + -- entity:getCell():showAni() + -- end + -- end + -- end, 2) + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION end end @@ -894,7 +883,7 @@ function BattleController:onLinkOver() self.eliminateTotalCount = self.eliminateTotalCount + 1 end -function BattleController:calculateCurElimination() +function BattleController:calculateCurElimination(onlyCheck) local sequence = self.battleData:getGridSequence() local skillId = self.battleData:getSequenceHadSkill() local skillEntity @@ -913,14 +902,14 @@ function BattleController:calculateCurElimination() 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) + self:dealGridBreak(posId, GRID_BREAK_CONDITION.LINE, time, breakedMap, sequenceMap, aniSequence, boomGridIds, onlyCheck) time = time + BattleConst.ELIMINATION_INTERVAL end 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) + randomPosList, influenceElementTypeMap = self:dealSkillElement(info.timeIdx + skillTime, breakedMap, sequenceMap, aniSequence, boomGridIds, onlyCheck) local aniUnit = aniSequence[i] aniUnit.rangeList = skillEntity:getBoardRange() aniUnit.randomPosList = randomPosList @@ -953,7 +942,7 @@ function BattleController:calculateCurElimination() return aniSequence, influenceElementTypeMap, lineCount, elementTypeMap, linkElementType, effectGridMap end -function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequenceMap, aniSequence, gridMap) +function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequenceMap, aniSequence, gridMap, onlyCheck) self:setGridBreakCondition(gridMap, posId, condition) if breakedMap[posId] or (sequenceMap[posId] and condition ~= GRID_BREAK_CONDITION.LINE) then return @@ -992,18 +981,18 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ 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) + self:dealGridBreak(id, GRID_BREAK_CONDITION.AROUND, time, breakedMap, sequenceMap, aniSequence, gridMap, onlyCheck) end end if entity:getEffectType() then - local list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self) + local list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck) 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) + self:dealGridBreak(id, GRID_BREAK_CONDITION.SKILL, time + BattleConst.GRID_BREAK_EFFECT_INTERVAL * index, breakedMap, sequenceMap, aniSequence, gridMap, onlyCheck) table.insert(aniUnit.aniPosList, id) end end @@ -1014,7 +1003,7 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ return isIdle end -function BattleController:dealSkillElement(time, breakedMap, sequenceMap, aniSequence, boomGridIds) +function BattleController:dealSkillElement(time, breakedMap, sequenceMap, aniSequence, boomGridIds, onlyCheck) local randomPosList local influenceElementTypeMap = {} for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do @@ -1029,7 +1018,7 @@ function BattleController:dealSkillElement(time, breakedMap, sequenceMap, aniSeq end influenceElementTypeMap[entity:getElementType()] = (influenceElementTypeMap[entity:getElementType()] or 0) + 1 end - self:dealGridBreak(posId, GRID_BREAK_CONDITION.SKILL, time, breakedMap, sequenceMap, aniSequence, boomGridIds) + self:dealGridBreak(posId, GRID_BREAK_CONDITION.SKILL, time, breakedMap, sequenceMap, aniSequence, boomGridIds, onlyCheck) end end @@ -1064,6 +1053,34 @@ function BattleController:setGridBreakCondition(gridMap, posId, condition) return true, false end +function BattleController:tryShowSelectSkillComp(needDelay) + local onlyCommonSkill + if self.battleData:useCommonSelectSkillCount() then + onlyCommonSkill = true + elseif self.battleData:useAddlvCount() then + onlyCommonSkill = false + end + + if onlyCommonSkill == nil then + return false + end + + local skillList = self:getRandomSkillList(nil, onlyCommonSkill) + if needDelay then + self.showSelectSkillSid = ModuleManager.BattleManager:performWithDelayGlobal(function() + self.battleUI:showSelectSkillComp(skillList, onlyCommonSkill) + self.showSelectSkillSid = nil + end, 0.3) + else + self.battleUI:showSelectSkillComp(skillList, onlyCommonSkill) + end + + local totalTime = Time:getServerTime() - self.battleStartTime + BIReport:postShowFightSkillSelect(self.battleType, skillList, self.chapterId, totalTime, self.waveIndex) + + return true +end + function BattleController:fillBoard(isRoundBeginCheck) local pathMap = {} local columnCount = {} @@ -1696,7 +1713,7 @@ function BattleController:findSkillInfluenceGrids() end end -function BattleController:getRandomSkillList(getCount) +function BattleController:getRandomSkillList(getCount, onlyCommonSkill) local fixedList = self:getFixedRogueSkill() if fixedList[1] then return table.remove(fixedList, 1) @@ -1711,43 +1728,15 @@ function BattleController:getRandomSkillList(getCount) local count = 0 local newSkillPool = {} local skillWeight = {} - for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 - if not self.battleData:isUnlockedSkillElementType(elementType) then - local skillEntity = self.battleData:getSkillEntityByElement(elementType) - if skillEntity then - local skillId = skillEntity:getUnlockId() - if skillId and not map[skillId] then - local skillCfg = cfg[skillId] - table.insert(newSkillPool, skillId) - table.insert(skillWeight, skillCfg.weight) - count = count + 1 - map[skillId] = true - end - end - end - end - if count >= 3 then -- 如果未解锁的技能大于等于3,则直接返回三个解锁技能 - for i = 1, 3 do - local index = GFunc.getRandomIndex(skillWeight) - local skillId = table.remove(newSkillPool, index) - table.remove(skillWeight, index) - count = count - 1 - table.insert(result, skillId) - if count <= 0 then - break - end - end - - return table.shuffle(result) - end - - for elementType, list in pairs(skillPool) do - if self.battleData:isUnlockedSkillElementType(elementType) then - for _, skillId in ipairs(list) do - local skillCfg = cfg[skillId] - if skillCfg and (not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times) then - if not map[skillId] then + if not onlyCommonSkill then + for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 + if not self.battleData:isUnlockedSkillElementType(elementType) then + local skillEntity = self.battleData:getSkillEntityByElement(elementType) + if skillEntity then + local skillId = skillEntity:getUnlockId() + if skillId and not map[skillId] then + local skillCfg = cfg[skillId] table.insert(newSkillPool, skillId) table.insert(skillWeight, skillCfg.weight) count = count + 1 @@ -1756,15 +1745,43 @@ function BattleController:getRandomSkillList(getCount) end end end - end - - if count > 0 then - local index = GFunc.getRandomIndex(skillWeight) - local skillId = table.remove(newSkillPool, index) - table.remove(skillWeight, index) - count = count - 1 - table.insert(result, skillId) - getCount = getCount - 1 + + if count >= 3 then -- 如果未解锁的技能大于等于3,则直接返回三个解锁技能 + for i = 1, 3 do + local index = GFunc.getRandomIndex(skillWeight) + local skillId = table.remove(newSkillPool, index) + table.remove(skillWeight, index) + count = count - 1 + table.insert(result, skillId) + end + + return table.shuffle(result) + end + + for elementType, list in pairs(skillPool) do + if self.battleData:isUnlockedSkillElementType(elementType) then + for _, skillId in ipairs(list) do + local skillCfg = cfg[skillId] + if skillCfg and (not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times) then + if not map[skillId] then + table.insert(newSkillPool, skillId) + table.insert(skillWeight, skillCfg.weight) + count = count + 1 + map[skillId] = true + end + end + end + end + end + + if count > 0 then + local index = GFunc.getRandomIndex(skillWeight) + local skillId = table.remove(newSkillPool, index) + table.remove(skillWeight, index) + count = count - 1 + table.insert(result, skillId) + getCount = getCount - 1 + end end for skillId, info in pairs(cfg) do diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua b/lua/app/module/battle/skill/battle_grid_effect_handle.lua index e8167800..ee56641e 100644 --- a/lua/app/module/battle/skill/battle_grid_effect_handle.lua +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -5,7 +5,7 @@ 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 function _directionElinination(entity, gridEntities, battleController, onlyCheck) local effectParams = entity:getEffectParams() if not effectParams then return @@ -15,7 +15,11 @@ local function _directionElinination(entity, gridEntities, battleController) return list end -local function _crossSpread(entity, gridEntities, battleController) +local function _crossSpread(entity, gridEntities, battleController, onlyCheck) + if onlyCheck then + return + end + local tempList = BattleConst.UP_DOWN_LEFT_RIGHT[entity:getPosId()] if not tempList then return @@ -32,12 +36,20 @@ local function _crossSpread(entity, gridEntities, battleController) return list end +local function _selectCommonSkill(entity, gridEntities, battleController, onlyCheck) + if onlyCheck then + return + end + battleController.battleData:addCommonSelectSkillCount() +end + BattleGridEffectHandle._gridEffectOn = { [GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination, [GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread, + [GRID_EFFECT_TYPE.SELECT_COMMON_SKILL] = _selectCommonSkill, } -function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController) +function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController, onlyCheck) local entity = gridEntities[posId] local effectType = entity:getEffectType() if not effectType then @@ -49,7 +61,7 @@ function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, b local func = BattleGridEffectHandle._gridEffectOn[effectType] if func then - return func(entity, gridEntities, battleController) + return func(entity, gridEntities, battleController, onlyCheck) end end diff --git a/lua/app/ui/battle/battle_skill_select_comp.lua b/lua/app/ui/battle/battle_skill_select_comp.lua index cf562d53..6d143a9a 100644 --- a/lua/app/ui/battle/battle_skill_select_comp.lua +++ b/lua/app/ui/battle/battle_skill_select_comp.lua @@ -9,8 +9,9 @@ local SKILL_ICON_POS = { {x =-240, y= -165} } -function BattleSkillSelectComp:refresh(skillList) +function BattleSkillSelectComp:refresh(skillList, onlyCommonSkill) self.skillList = skillList + self.onlyCommonSkill = onlyCommonSkill self:_playPop() self:_display() self:_addListeners() @@ -40,7 +41,7 @@ function BattleSkillSelectComp:_addListeners() end SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_SKILL_REFRESH, function() - self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList() + self.skillList = ModuleManager.BattleManager.battleController:getRandomSkillList(nil, self.onlyCommonSkill) self:refreshRogueSkill() end) end) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index a4219a13..862a9781 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -1861,11 +1861,11 @@ function BattleUI:initSelectSkillNode() end end -function BattleUI:showSelectSkillComp(skillList) +function BattleUI:showSelectSkillComp(skillList, isCommon) if not self.selectSkillComp then return end - self.selectSkillComp:refresh(skillList) + self.selectSkillComp:refresh(skillList, isCommon) end function BattleUI:hideAllBoardSfxs() diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index bcc6c4bb..37f274c0 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -22,6 +22,7 @@ function BattleData:init() self.curBattleExp = 0 self.needBattleExp = self:getLvNeedExp() self.addLvCount = 0 + self.commonSelectSkillCount = 0 self.timeScale = BattleConst.TIME_SCALE.LEVEL_1 self.lockElementMap = {} self.data.timeSpeed = 1 @@ -518,6 +519,21 @@ function BattleData:useAddlvCount() return true end +function BattleData:addCommonSelectSkillCount(count) + self.commonSelectSkillCount = self.commonSelectSkillCount + (count or 1) + Logger.logHighlight("self.commonSelectSkillCount " .. self.commonSelectSkillCount) +end + +function BattleData:useCommonSelectSkillCount() + Logger.logHighlight("useCommonSelectSkillCount " .. self.commonSelectSkillCount) + if self.commonSelectSkillCount <= 0 then + self.commonSelectSkillCount = 0 + return false + end + self.commonSelectSkillCount = self.commonSelectSkillCount - 1 + return true +end + function BattleData:initTeam(side) local data = nil if side == BattleConst.SIDE_ATK then