This commit is contained in:
puxuan 2025-06-17 20:28:43 +08:00
parent d8709cbc32
commit 6beb44b672
4 changed files with 89 additions and 98 deletions

View File

@ -709,7 +709,6 @@ function BattleBaseController:prepareFight()
self:initDefUnits(onPreloadFinished) self:initDefUnits(onPreloadFinished)
self.battleUI:refreshChessBoard(self:getChessBoardBgName()) self.battleUI:refreshChessBoard(self:getChessBoardBgName())
self.battleUI:loadBg(self:getScene()) self.battleUI:loadBg(self:getScene())
self.battleData:initAllRogueSkills()
end) end)
BattleHelper:setBaseOrder(self.battleUI:getUIOrder()) BattleHelper:setBaseOrder(self.battleUI:getUIOrder())
BattleHelper:setBattleData(self.battleData) BattleHelper:setBattleData(self.battleData)
@ -2293,70 +2292,70 @@ function BattleBaseController:getRandomSkillList(getCount, onlyCommonSkill, excl
self.randomSkillNewSkillPool = table.clearOrCreate(self.randomSkillNewSkillPool) self.randomSkillNewSkillPool = table.clearOrCreate(self.randomSkillNewSkillPool)
self.randomSkillSkillWeight = table.clearOrCreate(self.randomSkillSkillWeight) self.randomSkillSkillWeight = table.clearOrCreate(self.randomSkillSkillWeight)
local cfg = ConfigManager:getConfig("skill_rogue") local cfg = ConfigManager:getConfig("skill_rogue")
-- local skillPool = self:getSkillPool() local skillPool = self:getSkillPool()
local count = 0 local count = 0
-- if not onlyCommonSkill then if not onlyCommonSkill then
-- for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能 for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
-- if not self:isUnlockedSkillElementType(elementType) then if not self:isUnlockedSkillElementType(elementType) then
-- local skillEntity = self:getSkillEntityByElement(elementType) local skillEntity = self:getSkillEntityByElement(elementType)
-- if skillEntity then if skillEntity then
-- local skillId = skillEntity:getUnlockId() local skillId = skillEntity:getUnlockId()
-- if skillId and not self.randomSkillMap[skillId] then if skillId and not self.randomSkillMap[skillId] then
-- local skillCfg = cfg[skillId] local skillCfg = cfg[skillId]
-- table.insert(self.randomSkillNewSkillPool, skillId) table.insert(self.randomSkillNewSkillPool, skillId)
-- table.insert(self.randomSkillSkillWeight, skillCfg.weight) table.insert(self.randomSkillSkillWeight, skillCfg.weight)
-- count = count + 1 count = count + 1
-- self.randomSkillMap[skillId] = true self.randomSkillMap[skillId] = true
-- end end
-- end end
-- end end
-- end end
-- if count >= 3 then -- 如果未解锁的技能大于等于3则直接返回三个解锁技能
-- for i = 1, 3 do
-- local index = GFunc.getRandomIndex(self.randomSkillSkillWeight)
-- local skillId = table.remove(self.randomSkillNewSkillPool, index)
-- table.remove(self.randomSkillSkillWeight, index)
-- count = count - 1
-- table.insert(self.randomSkillList, skillId)
-- end
-- return table.shuffle(self.randomSkillList)
-- end
-- if excludeMap then if count >= 3 then -- 如果未解锁的技能大于等于3则直接返回三个解锁技能
-- for skillId, _ in pairs(excludeMap) do for i = 1, 3 do
-- self.randomSkillMap[skillId] = true local index = GFunc.getRandomIndex(self.randomSkillSkillWeight)
-- end local skillId = table.remove(self.randomSkillNewSkillPool, index)
-- end table.remove(self.randomSkillSkillWeight, index)
count = count - 1
-- for elementType, list in pairs(skillPool) do table.insert(self.randomSkillList, skillId)
-- if self:isUnlockedSkillElementType(elementType) then end
-- for _, skillId in ipairs(list) do
-- local skillCfg = cfg[skillId]
-- if skillCfg and (not skillCfg.limit_times or self:getSkillCount(skillId) < skillCfg.limit_times) then
-- if not self.randomSkillMap[skillId] and (not skillCfg.unlock or self:getSkillCount(skillCfg.unlock) > 0) then return table.shuffle(self.randomSkillList)
-- table.insert(self.randomSkillNewSkillPool, skillId) end
-- table.insert(self.randomSkillSkillWeight, skillCfg.weight)
-- count = count + 1 if excludeMap then
-- self.randomSkillMap[skillId] = true for skillId, _ in pairs(excludeMap) do
-- end self.randomSkillMap[skillId] = true
-- end end
-- end end
-- end
-- end for elementType, list in pairs(skillPool) do
if self:isUnlockedSkillElementType(elementType) then
-- if count > 0 then for _, skillId in ipairs(list) do
-- local index = GFunc.getRandomIndex(self.randomSkillSkillWeight) local skillCfg = cfg[skillId]
-- local skillId = table.remove(self.randomSkillNewSkillPool, index) if skillCfg and (not skillCfg.limit_times or self:getSkillCount(skillId) < skillCfg.limit_times) then
-- table.remove(self.randomSkillSkillWeight, index)
-- count = count - 1 if not self.randomSkillMap[skillId] and (not skillCfg.unlock or self:getSkillCount(skillCfg.unlock) > 0) then
-- table.insert(self.randomSkillList, skillId) table.insert(self.randomSkillNewSkillPool, skillId)
-- getCount = getCount - 1 table.insert(self.randomSkillSkillWeight, skillCfg.weight)
-- end count = count + 1
-- end self.randomSkillMap[skillId] = true
end
end
end
end
end
if count > 0 then
local index = GFunc.getRandomIndex(self.randomSkillSkillWeight)
local skillId = table.remove(self.randomSkillNewSkillPool, index)
table.remove(self.randomSkillSkillWeight, index)
count = count - 1
table.insert(self.randomSkillList, skillId)
getCount = getCount - 1
end
end
for skillId, info in pairs(cfg) do for skillId, info in pairs(cfg) do
if not self:getNotInvolvedSkills()[skillId] then if not self:getNotInvolvedSkills()[skillId] then

View File

@ -148,16 +148,18 @@ function BattleBaseData:setTimeSpeed(timeSpeed, timeScale)
self.data.timeSpeed = timeSpeed self.data.timeSpeed = timeSpeed
end end
function BattleBaseData:initAllRogueSkills()
self.atkTeam:initRougeSkills()
self.defTeam:initRougeSkills()
end
function BattleBaseData:initRogueSkills(side, formation) function BattleBaseData:initRogueSkills(side, formation)
self.skillPool = self.skillPool or {} if not self.skillPool then
self.skillMap = self.skillMap or {} self.skillPool = {}
self.skillPool[side] = self.skillPool[side] or {} self.skillMap = {}
self.skillMap[side] = self.skillMap[side] or {} end
if not self.skillPool[side] then
self.skillPool[side] = {}
end
if not self.skillMap[side] then
self.skillMap[side] = {}
end
if not formation then if not formation then
return return
end end
@ -165,19 +167,18 @@ function BattleBaseData:initRogueSkills(side, formation)
for matchType, heroEntity in pairs(formation) do for matchType, heroEntity in pairs(formation) do
local skillId = heroEntity:getBaseSkill() local skillId = heroEntity:getBaseSkill()
local cfg = SKILL_CFG[skillId] local cfg = SKILL_CFG[skillId]
local skillLv = heroEntity:getRogueSkillLv() self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side)
self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side, skillLv) self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList())
-- self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList()) self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId())
-- self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId()) for _, id in ipairs(heroEntity:getActiveRogueSkills()) do
-- for _, id in ipairs(heroEntity:getActiveRogueSkills()) do if not skillmap[id] then
-- if not skillmap[id] then if not self.skillPool[side][cfg.position] then
-- if not self.skillPool[side][cfg.position] then self.skillPool[side][cfg.position] = {}
-- self.skillPool[side][cfg.position] = {} end
-- end table.insert(self.skillPool[side][cfg.position], id)
-- table.insert(self.skillPool[side][cfg.position], id) skillmap[id] = true
-- skillmap[id] = true end
-- end end
-- end
end end
end end
@ -793,7 +794,7 @@ function BattleBaseData:initHeroData(formation)
modelId = heroEntity:getModelId(), modelId = heroEntity:getModelId(),
matchType = matchType, matchType = matchType,
normalSkills = heroEntity:getHurtSkill(), normalSkills = heroEntity:getHurtSkill(),
rougeSkills = heroEntity:getActiveRogueSkills(), -- assistingSkill = heroEntity:getAssistingSkill(),
body = 2, -- 英雄默认是中体型 body = 2, -- 英雄默认是中体型
skin = heroEntity:getSkinId(), skin = heroEntity:getSkinId(),
attr = { attr = {
@ -894,6 +895,7 @@ function BattleBaseData:addMonster(monsterId, newTeam, battleController)
normalSkillCount = monsterInfo.atk_times or 0, normalSkillCount = monsterInfo.atk_times or 0,
activeSkills = monsterInfo.skill, activeSkills = monsterInfo.skill,
passiveSkills = monsterInfo.passive_skill, passiveSkills = monsterInfo.passive_skill,
assistingSkill = nil,
isBoss = monsterInfo.is_boss, isBoss = monsterInfo.is_boss,
exp = monsterInfo.monster_exp or 0, exp = monsterInfo.monster_exp or 0,
body = monsterInfo.body, body = monsterInfo.body,

View File

@ -1,7 +1,7 @@
local BattleBoardSkillEntity = class("BattleBoardSkillEntity", BaseData) local BattleBoardSkillEntity = class("BattleBoardSkillEntity", BaseData)
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
function BattleBoardSkillEntity:ctor(skillId, side, skillLv) function BattleBoardSkillEntity:ctor(skillId, side)
self:refreshSkillId(skillId) self:refreshSkillId(skillId)
self.side = side self.side = side
self.curEnergy = 0 self.curEnergy = 0
@ -18,7 +18,7 @@ function BattleBoardSkillEntity:ctor(skillId, side, skillLv)
self.originSkillId = skillId self.originSkillId = skillId
self.upSkillIdMap = {} self.upSkillIdMap = {}
self.getUpSkillKind = skillLv self.getUpSkillKind = 0
end end
function BattleBoardSkillEntity:refreshSkillId(skillId) function BattleBoardSkillEntity:refreshSkillId(skillId)

View File

@ -408,16 +408,13 @@ end
function HeroEntity:getRogueSkillList() function HeroEntity:getRogueSkillList()
if not self.rogueSkillList then if not self.rogueSkillList then
self.rogueSkillList = {} self.rogueSkillList = {}
self.skillLv = 0
local count = 1 local count = 1
while true do while true do
local ids = self.config["rouge_skill_" .. count] local ids = self.config["rouge_skill_" .. count]
if ids then if ids then
for i = #ids, 1, -1 do for i = #ids, 1, -1 do
if self.data.lv >= ids[i][1] or i == 1 then -- if self.data.lv >= ids[i][1] or i == 1 then
if self.data.lv >= ids[i][1] then if self.data.lv >= ids[i][1]then
self.skillLv = self.skillLv + i
end
table.insert(self.rogueSkillList, ids[i]) table.insert(self.rogueSkillList, ids[i])
break break
end end
@ -432,13 +429,6 @@ function HeroEntity:getRogueSkillList()
return self.rogueSkillList return self.rogueSkillList
end end
function HeroEntity:getRogueSkillLv()
if not self.skillLv then
self:getRogueSkillList()
end
return self.skillLv
end
function HeroEntity:getNextRougeLvUp(idx) function HeroEntity:getNextRougeLvUp(idx)
local ids = self.config["rouge_skill_" .. idx] local ids = self.config["rouge_skill_" .. idx]
if ids then if ids then