This commit is contained in:
puxuan 2025-06-03 15:15:01 +08:00
parent 722639abab
commit 5cfdb4c8d8
6 changed files with 181 additions and 188 deletions

View File

@ -331,39 +331,39 @@ function BattleUnitComp:beforeAttack(actionState)
end end
end end
function BattleUnitComp:useAssistingSkill(count, delay, callback) -- function BattleUnitComp:useAssistingSkill(count, delay, callback)
local skill = self.unitEntity:getAssistingSkill() -- local skill = self.unitEntity:getAssistingSkill()
if skill == nil then -- if skill == nil then
callback() -- callback()
return -- return
end -- end
local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()] -- local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()]
self.assistingDmgAddition = count - 1 -- self.assistingDmgAddition = count - 1
if self.assistingDmgAddition <= 0 then -- if self.assistingDmgAddition <= 0 then
self.assistingDmgAddition = 0 -- self.assistingDmgAddition = 0
self.assistingDmgAddCount = 0 -- self.assistingDmgAddCount = 0
else -- else
self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, self.assistingDmgAddition*DEFAULT_FACTOR, true) -- self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, self.assistingDmgAddition*DEFAULT_FACTOR, true)
end -- end
self.actionOverCallback = callback -- self.actionOverCallback = callback
if delay > 0 then -- if delay > 0 then
self.waitTime = delay -- self.waitTime = delay
self.waitingState = UNIT_STATE.ASSISTING_ATTACK -- self.waitingState = UNIT_STATE.ASSISTING_ATTACK
if not self:changeState(UNIT_STATE.WAIT) then -- if not self:changeState(UNIT_STATE.WAIT) then
if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then -- if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then
self.actionOverCallback = nil -- self.actionOverCallback = nil
self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) -- self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false)
callback() -- callback()
end -- end
end -- end
else -- else
if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then -- if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then
self.actionOverCallback = nil -- self.actionOverCallback = nil
self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) -- self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false)
callback() -- callback()
end -- end
end -- end
end -- end
function BattleUnitComp:useSkill(index, count, callback) function BattleUnitComp:useSkill(index, count, callback)
self.unitEntity:addActiveSkillReleaseCount(1) self.unitEntity:addActiveSkillReleaseCount(1)

View File

@ -2262,70 +2262,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则直接返回三个解锁技能 -- if count >= 3 then -- 如果未解锁的技能大于等于3则直接返回三个解锁技能
for i = 1, 3 do -- for i = 1, 3 do
local index = GFunc.getRandomIndex(self.randomSkillSkillWeight) -- local index = GFunc.getRandomIndex(self.randomSkillSkillWeight)
local skillId = table.remove(self.randomSkillNewSkillPool, index) -- local skillId = table.remove(self.randomSkillNewSkillPool, index)
table.remove(self.randomSkillSkillWeight, index) -- table.remove(self.randomSkillSkillWeight, index)
count = count - 1 -- count = count - 1
table.insert(self.randomSkillList, skillId) -- table.insert(self.randomSkillList, skillId)
end -- end
return table.shuffle(self.randomSkillList) -- return table.shuffle(self.randomSkillList)
end -- end
if excludeMap then -- if excludeMap then
for skillId, _ in pairs(excludeMap) do -- for skillId, _ in pairs(excludeMap) do
self.randomSkillMap[skillId] = true -- self.randomSkillMap[skillId] = true
end -- end
end -- end
for elementType, list in pairs(skillPool) do -- for elementType, list in pairs(skillPool) do
if self:isUnlockedSkillElementType(elementType) then -- if self:isUnlockedSkillElementType(elementType) then
for _, skillId in ipairs(list) do -- for _, skillId in ipairs(list) do
local skillCfg = cfg[skillId] -- local skillCfg = cfg[skillId]
if skillCfg and (not skillCfg.limit_times or self:getSkillCount(skillId) < skillCfg.limit_times) then -- 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 -- if not self.randomSkillMap[skillId] and (not skillCfg.unlock or self:getSkillCount(skillCfg.unlock) > 0) then
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
end -- end
if count > 0 then -- if count > 0 then
local index = GFunc.getRandomIndex(self.randomSkillSkillWeight) -- local index = GFunc.getRandomIndex(self.randomSkillSkillWeight)
local skillId = table.remove(self.randomSkillNewSkillPool, index) -- local skillId = table.remove(self.randomSkillNewSkillPool, index)
table.remove(self.randomSkillSkillWeight, index) -- table.remove(self.randomSkillSkillWeight, index)
count = count - 1 -- count = count - 1
table.insert(self.randomSkillList, skillId) -- table.insert(self.randomSkillList, skillId)
getCount = getCount - 1 -- getCount = getCount - 1
end -- end
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
@ -2378,7 +2378,7 @@ function BattleBaseController:onSelectSkill(skillId, value, pos, side)
BIReport:postFightSkillSelect(self.battleType, self.battleData, {skillId}, self.chapterId, self.totalDurationTime, self:getWaveIndex()) BIReport:postFightSkillSelect(self.battleType, self.battleData, {skillId}, self.chapterId, self.totalDurationTime, self:getWaveIndex())
local elementType = ModuleManager.HeroManager:getSkillRoguePosition(skillId) local elementType = ModuleManager.HeroManager:getSkillRoguePosition(skillId)
if elementType then if elementType and pos then
if self.battleUI then if self.battleUI then
self.battleUI:gotOneSkillAni(skillId, elementType, function() self.battleUI:gotOneSkillAni(skillId, elementType, function()
self:selectSKillNextToStep() self:selectSKillNextToStep()
@ -3254,13 +3254,13 @@ local function _addCurRoundAttr(self, side, instruction, callback)
callback() callback()
end end
local function _assisting(self, side, instruction, callback) -- local function _assisting(self, side, instruction, callback)
local actionTeam = self.atkTeam -- local actionTeam = self.atkTeam
if side == SIDE_DEF then -- if side == SIDE_DEF then
actionTeam = self.defTeam -- actionTeam = self.defTeam
end -- end
actionTeam:useAssistingSkill(instruction.assistingList, #self.instructions == 0, callback) -- actionTeam:useAssistingSkill(instruction.assistingList, #self.instructions == 0, callback)
end -- end
local function _generalAttack(self, side, instruction, callback) local function _generalAttack(self, side, instruction, callback)
local actionTeam = self.atkTeam local actionTeam = self.atkTeam
@ -3280,7 +3280,7 @@ end
BattleBaseController._doInstruction = { BattleBaseController._doInstruction = {
[BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR] = _addCurRoundAttr, [BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR] = _addCurRoundAttr,
[BattleConst.INSTRUCTION_NAME.ASSISTING] = _assisting, -- [BattleConst.INSTRUCTION_NAME.ASSISTING] = _assisting,
[BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK] = _generalAttack, [BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK] = _generalAttack,
[BattleConst.INSTRUCTION_NAME.PLAY_SKILL] = _playSkill, [BattleConst.INSTRUCTION_NAME.PLAY_SKILL] = _playSkill,
} }

View File

@ -109,38 +109,38 @@ function BattleTeam:useSkill(matchType, count, isFinalAction, effectType, action
end end
end end
function BattleTeam:useAssistingSkill(assistingList, isFinalAction, callback) -- function BattleTeam:useAssistingSkill(assistingList, isFinalAction, callback)
self.isFinalAction = isFinalAction -- self.isFinalAction = isFinalAction
if self.mainUnit == nil then -- if self.mainUnit == nil then
return callback() -- return callback()
end -- end
if self.mainUnit:getIsLimit() then -- if self.mainUnit:getIsLimit() then
return callback() -- return callback()
end -- end
local count = #assistingList -- local count = #assistingList
if count <= 0 then -- if count <= 0 then
return callback() -- return callback()
end -- end
self:setCentralizedAttack(true) -- self:setCentralizedAttack(true)
local function finish() -- local function finish()
count = count - 1 -- count = count - 1
if count == 0 then -- if count == 0 then
self:setCentralizedAttack(false) -- self:setCentralizedAttack(false)
callback() -- callback()
end -- end
end -- end
local delay = 0 -- local delay = 0
for _, v in ipairs(assistingList) do -- for _, v in ipairs(assistingList) do
local unit = self.unitMap[v.skillMatch] -- local unit = self.unitMap[v.skillMatch]
if unit then -- if unit then
unit:resetBeforeAttack() -- unit:resetBeforeAttack()
unit:useAssistingSkill(v.count, delay, finish) -- unit:useAssistingSkill(v.count, delay, finish)
delay = delay + BattleHelper:getSupportInterval() -- delay = delay + BattleHelper:getSupportInterval()
else -- else
finish() -- finish()
end -- end
end -- end
end -- end
function BattleTeam:mainUnitUseAllSkills(actionState, callback) function BattleTeam:mainUnitUseAllSkills(actionState, callback)
self.isFinalAction = true self.isFinalAction = true

View File

@ -54,8 +54,8 @@ function BattleBaseData:init(params, snapInfo)
BattleSkillEntity.sid = 0 BattleSkillEntity.sid = 0
self.atkTeam = self:initTeam(SIDE_ATK, params.atkFormation) self.atkTeam = self:initTeam(SIDE_ATK, params.atkFormation)
self.defTeam = self:initTeam(SIDE_DEF, params.defFormation) self.defTeam = self:initTeam(SIDE_DEF, params.defFormation)
self:initRogueSkills(SIDE_ATK, params.atkFormation) -- self:initRogueSkills(SIDE_ATK, params.atkFormation)
self:initRogueSkills(SIDE_DEF, params.defFormation) -- self:initRogueSkills(SIDE_DEF, params.defFormation)
self.atkFormation = params.atkFormation or {} self.atkFormation = params.atkFormation or {}
self.defFormation = params.defFormation or {} self.defFormation = params.defFormation or {}
self:setMaxBattleLv(nil) self:setMaxBattleLv(nil)
@ -148,39 +148,32 @@ function BattleBaseData:setTimeSpeed(timeSpeed, timeScale)
self.data.timeSpeed = timeSpeed self.data.timeSpeed = timeSpeed
end end
function BattleBaseData:initRogueSkills(side, formation) -- function BattleBaseData:initRogueSkills(side, formation)
if not self.skillPool then -- self.skillPool = self.skillPool or {}
self.skillPool = {} -- self.skillMap = self.skillMap or {}
self.skillMap = {} -- self.skillPool[side] = self.skillPool[side] or {}
end -- self.skillMap[side] = self.skillMap[side] or {}
if not self.skillPool[side] then -- if not formation then
self.skillPool[side] = {} -- return
end -- end
if not self.skillMap[side] then -- local skillmap = {}
self.skillMap[side] = {} -- for matchType, heroEntity in pairs(formation) do
end -- local skillId = heroEntity:getBaseSkill()
-- local cfg = SKILL_CFG[skillId]
if not formation then -- self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side)
return -- self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList())
end -- self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId())
local skillmap = {} -- for _, id in ipairs(heroEntity:getActiveRogueSkills()) do
for matchType, heroEntity in pairs(formation) do -- if not skillmap[id] then
local skillId = heroEntity:getBaseSkill() -- if not self.skillPool[side][cfg.position] then
local cfg = SKILL_CFG[skillId] -- self.skillPool[side][cfg.position] = {}
self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side) -- end
self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList()) -- table.insert(self.skillPool[side][cfg.position], id)
self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId()) -- skillmap[id] = true
for _, id in ipairs(heroEntity:getActiveRogueSkills()) do -- end
if not skillmap[id] then -- end
if not self.skillPool[side][cfg.position] then -- end
self.skillPool[side][cfg.position] = {} -- end
end
table.insert(self.skillPool[side][cfg.position], id)
skillmap[id] = true
end
end
end
end
function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot) function BattleBaseData:refreshBoard(board, boardEdge, blockIcon, snapshot)
local r = 1 local r = 1
@ -794,7 +787,7 @@ function BattleBaseData:initHeroData(formation)
modelId = heroEntity:getModelId(), modelId = heroEntity:getModelId(),
matchType = matchType, matchType = matchType,
normalSkills = heroEntity:getHurtSkill(), normalSkills = heroEntity:getHurtSkill(),
assistingSkill = heroEntity:getAssistingSkill(), rougeSkills = heroEntity:getActiveRogueSkills(),
body = 2, -- 英雄默认是中体型 body = 2, -- 英雄默认是中体型
skin = heroEntity:getSkinId(), skin = heroEntity:getSkinId(),
attr = { attr = {
@ -895,7 +888,6 @@ 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

@ -35,9 +35,6 @@ function BattleUnitEntity:initSkill()
self.normalSkillCount = self.unitData.normalSkillCount or 0 self.normalSkillCount = self.unitData.normalSkillCount or 0
end end
self.normalSkill = nil self.normalSkill = nil
if self.unitData.assistingSkill then
self.assistingSkill = BattleSkillEntity:create(self.unitData.assistingSkill, GConst.BattleConst.SKILL_TYPE_ASSISTING, self)
end
if self.unitData.activeSkills then if self.unitData.activeSkills then
for k, v in ipairs(self.unitData.activeSkills) do for k, v in ipairs(self.unitData.activeSkills) do
local skillShow local skillShow
@ -55,6 +52,12 @@ function BattleUnitEntity:initSkill()
table.insert(self.passiveSkills, skill) table.insert(self.passiveSkills, skill)
end end
end end
if self.unitData.rougeSkills then
for i,v in ipairs(self.unitData.rougeSkills) do
ModuleManager.BattleManager:onSelectSkill(v)
end
end
end end
function BattleUnitEntity:getIsBoss() function BattleUnitEntity:getIsBoss()
@ -159,10 +162,6 @@ function BattleUnitEntity:getNormalSkill(reRandom)
return self.normalSkill return self.normalSkill
end end
function BattleUnitEntity:getAssistingSkill()
return self.assistingSkill
end
function BattleUnitEntity:getActiveSkillCount() function BattleUnitEntity:getActiveSkillCount()
return #self.activeSkills return #self.activeSkills
end end

View File

@ -341,10 +341,6 @@ function HeroEntity:getBaseSkill()
return self.config.base_skill return self.config.base_skill
end end
function HeroEntity:getAssistingSkill()
return self.config.support_skill
end
function HeroEntity:getHurtSkill() function HeroEntity:getHurtSkill()
return self.config.hurt_skill return self.config.hurt_skill
end end
@ -386,7 +382,7 @@ function HeroEntity:getMatchType()
end end
function HeroEntity:getStarUpCostId() function HeroEntity:getStarUpCostId()
return self.config.entry return self.config.star_id
end end
function HeroEntity:getStarAttrCfg() function HeroEntity:getStarAttrCfg()
@ -445,15 +441,21 @@ end
function HeroEntity:getActiveRogueSkills() function HeroEntity:getActiveRogueSkills()
local list = {} local list = {}
-- for i = 1, self:getActiveRogueCount() do local count = 1
-- local id = self:getRogueSkillList()[i] while true do
-- if id then local ids = self.config["rouge_skill_" .. count]
-- table.insert(list, id) if ids then
-- else for i = #ids, 1, -1 do
-- break if self.data.lv >= ids[i][1] then
-- end table.insert(list, ids[i][2])
-- end break
end
end
else
break
end
count = count + 1
end
return list return list
end end
-- endregion -- endregion