mystery_box
This commit is contained in:
parent
3409aa046d
commit
30fcf69843
@ -671,8 +671,8 @@ local chapter = {
|
|||||||
},
|
},
|
||||||
["mystery_box"]={
|
["mystery_box"]={
|
||||||
0,
|
0,
|
||||||
5000,
|
10000,
|
||||||
5000,
|
10000,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
["mystery_box_reward"]={
|
["mystery_box_reward"]={
|
||||||
@ -2360,7 +2360,7 @@ local chapter = {
|
|||||||
["mystery_box"]={
|
["mystery_box"]={
|
||||||
5000,
|
5000,
|
||||||
0,
|
0,
|
||||||
0,
|
10000,
|
||||||
5000
|
5000
|
||||||
},
|
},
|
||||||
["mystery_box_reward"]={
|
["mystery_box_reward"]={
|
||||||
|
|||||||
@ -1931,4 +1931,13 @@ function GFunc.formatPlayerFormationInfo(info)
|
|||||||
return formation
|
return formation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GFunc.randomDrop(dropList)
|
||||||
|
local weightArr = {}
|
||||||
|
for i, v in ipairs(dropList) do
|
||||||
|
weightArr[i] = v.weight
|
||||||
|
end
|
||||||
|
local idx = GFunc.getRandomIndex(weightArr)
|
||||||
|
return dropList[idx]
|
||||||
|
end
|
||||||
|
|
||||||
return GFunc
|
return GFunc
|
||||||
@ -390,10 +390,18 @@ function BattleBaseController:getInitBoard()
|
|||||||
|
|
||||||
local config = self:getChapterConfig()[self.chapterId]
|
local config = self:getChapterConfig()[self.chapterId]
|
||||||
local boardCfg = self:getBoardConfig()
|
local boardCfg = self:getBoardConfig()
|
||||||
for _, boardId in ipairs(config.board) do
|
for idx, boardId in ipairs(config.board) do
|
||||||
local cfg = boardCfg[boardId]
|
local cfg = boardCfg[boardId]
|
||||||
if cfg then
|
if cfg then
|
||||||
table.insert(self.boradList, {board = GFunc.getTable(cfg.board), mysteryBoard = GFunc.getTable(cfg.mystery_box_board), gridEdge = GFunc.getTable(cfg.grid_edge)})
|
local tab = {
|
||||||
|
board = GFunc.getTable(cfg.board),
|
||||||
|
mysteryBoard = GFunc.getTable(cfg.mystery_box_board),
|
||||||
|
gridEdge = GFunc.getTable(cfg.grid_edge)
|
||||||
|
}
|
||||||
|
if config.mystery_box and config.mystery_box[idx] and math.random(1, BattleConst.DEFAULT_FACTOR) <= config.mystery_box[idx] then
|
||||||
|
self.mysteryBoxIndexMap[idx] = GFunc.randomDrop(config.mystery_box_reward)
|
||||||
|
end
|
||||||
|
table.insert(self.boradList, tab)
|
||||||
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,21 +21,29 @@ function BattleControllerStage:getInitBoard()
|
|||||||
|
|
||||||
local config = self:getChapterConfig()[self.chapterId]
|
local config = self:getChapterConfig()[self.chapterId]
|
||||||
local boardCfg = self:getBoardConfig()
|
local boardCfg = self:getBoardConfig()
|
||||||
for _, boardId in ipairs(config.board) do
|
for idx, boardId in ipairs(config.board) do
|
||||||
local cfg = boardCfg[boardId]
|
local cfg = boardCfg[boardId]
|
||||||
if cfg then
|
if cfg then
|
||||||
table.insert(self.boradList, {board = GFunc.getTable(cfg.board), mysteryBoard = GFunc.getTable(cfg.mystery_box_board), gridEdge = GFunc.getTable(cfg.grid_edge)})
|
local tab = {
|
||||||
|
board = GFunc.getTable(cfg.board),
|
||||||
|
mysteryBoard = GFunc.getTable(cfg.mystery_box_board),
|
||||||
|
gridEdge = GFunc.getTable(cfg.grid_edge)
|
||||||
|
}
|
||||||
|
if config.mystery_box and config.mystery_box_reward and config.mystery_box[idx] and math.random(1, GConst.BattleConst.DEFAULT_FACTOR) <= config.mystery_box[idx] then
|
||||||
|
self.mysteryBoxIndexMap[idx] = GFunc.randomDrop(config.mystery_box_reward)
|
||||||
|
end
|
||||||
|
table.insert(self.boradList, tab)
|
||||||
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.mystery_box and config.mystery_box_reward then
|
-- if config.mystery_box and config.mystery_box_reward then
|
||||||
for i, index in ipairs(config.mystery_box) do
|
-- for i, index in ipairs(config.mystery_box) do
|
||||||
if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then
|
-- if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, i) then
|
||||||
self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i]
|
-- self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i]
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
|
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user