技能回收最多3个
This commit is contained in:
parent
40179a3e67
commit
c0fea24029
@ -46,6 +46,7 @@ BattleConst.RECOVER_HP_COUNT = 3
|
||||
BattleConst.RECOVER_HP_INTERVAL = 0.2
|
||||
BattleConst.RECOVER_HP_PERCENT = 333
|
||||
BattleConst.EFFECT_NUMBER_DELAY = 0.2
|
||||
BattleConst.MAX_CACHE_SKILL_COUNT = 3
|
||||
|
||||
BattleConst.BATTLE_ROUND_STEP = {
|
||||
WAIT_BEGIN = 0, -- 等待开始
|
||||
|
||||
@ -46,6 +46,7 @@ function BattleUI:_display()
|
||||
self.boardCacheNode = uiMap["battle_ui.bg_2.board_cache_node"]
|
||||
self.boardCacheNode:setVisible(false)
|
||||
self.boardCacheBox = uiMap["battle_ui.bg_2.board_cache_node.skill_box"]
|
||||
self.boardCacheBox:setAnchoredPositionX(DEFAULT_X)
|
||||
self.battleRoot = uiMap["battle_ui.battle_root"]
|
||||
self:initBg()
|
||||
self:initSkill()
|
||||
|
||||
@ -418,9 +418,29 @@ end
|
||||
function BattleData:cacheBoardSkill()
|
||||
self.cacheSkillList = {}
|
||||
self.cacheSkillCount = 0
|
||||
local list
|
||||
local count = 0
|
||||
for posId, entity in pairs(self:getGridEnties()) do
|
||||
if entity:getSkillId() then
|
||||
table.insert(self.cacheSkillList, {skillId = entity:getSkillId(), posId = posId})
|
||||
if not list then
|
||||
list = {}
|
||||
end
|
||||
table.insert(list, {skillId = entity:getSkillId(), posId = posId})
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
if list then
|
||||
if count > BattleConst.MAX_CACHE_SKILL_COUNT then
|
||||
count = BattleConst.MAX_CACHE_SKILL_COUNT
|
||||
end
|
||||
|
||||
for i = 1, count do
|
||||
if not list[1] then
|
||||
break
|
||||
end
|
||||
local info = table.remove(list, math.random(1, #list))
|
||||
table.insert(self.cacheSkillList, info)
|
||||
self.cacheSkillCount = self.cacheSkillCount + 1
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user