Commit c8210d562035141fd8b972cba8ac2cea7cec8f54

Authored by zhouhaihai
1 parent badeee4e

boss 房有入口

Showing 3 changed files with 31 additions and 22 deletions   Show diff stats
@@ -1235,10 +1235,7 @@ function Adv:doActive(activeId, target) @@ -1235,10 +1235,7 @@ function Adv:doActive(activeId, target)
1235 -- 8:翻开范围内的方格 1235 -- 8:翻开范围内的方格
1236 doActiveEffect[8] = function(_) 1236 doActiveEffect[8] = function(_)
1237 for _ , target in ipairs(targers) do 1237 for _ , target in ipairs(targers) do
1238 - if not target.isOpen then  
1239 - target:open()  
1240 - self:backBlockChange(target.room.roomId, target.blockId)  
1241 - end 1238 + self:getCurMap():openBlock(target.room.roomId, target.blockId, true)
1242 end 1239 end
1243 return true 1240 return true
1244 end 1241 end
src/adv/AdvMap.lua
@@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where) @@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where)
100 end 100 end
101 101
102 -- 随机翻开 num 个 以开放的房间的 地块 102 -- 随机翻开 num 个 以开放的房间的 地块
103 -function Map:openBlockRand(num, isPlayer) 103 +function Map:openBlockRand(num, isPlayer, ignoreBack)
104 local pool = {} 104 local pool = {}
105 for _, room in pairs(self.rooms) do 105 for _, room in pairs(self.rooms) do
106 if room.isShow and not room.isPath then 106 if room.isShow and not room.isPath then
@@ -113,12 +113,12 @@ function Map:openBlockRand(num, isPlayer) @@ -113,12 +113,12 @@ function Map:openBlockRand(num, isPlayer)
113 end 113 end
114 if #pool <= num then 114 if #pool <= num then
115 for _, temp in ipairs(pool) do 115 for _, temp in ipairs(pool) do
116 - self:openBlock(temp[1], temp[2], isPlayer) 116 + self:openBlock(temp[1], temp[2], isPlayer, ignoreBack)
117 end 117 end
118 else 118 else
119 for i = 1, num do 119 for i = 1, num do
120 local idx = math.randomInt(1, #pool) 120 local idx = math.randomInt(1, #pool)
121 - self:openBlock(pool[idx][1], pool[idx][2], isPlayer) 121 + self:openBlock(pool[idx][1], pool[idx][2], isPlayer, ignoreBack)
122 table.remove(pool, idx) 122 table.remove(pool, idx)
123 end 123 end
124 end 124 end
@@ -131,34 +131,39 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) @@ -131,34 +131,39 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack)
131 if not room then return end 131 if not room then return end
132 local block = room.blocks[blockId] 132 local block = room.blocks[blockId]
133 if not block then return end 133 if not block then return end
134 - room:openBlock(block)  
135 - if isPlayer then  
136 - self.adv.battle.player:triggerPassive(Passive.OPEN_BLOCK)  
137 - end  
138 - if not ignoreBack then  
139 - self.adv:backBlockChange(roomId, blockId) 134 + local status = room:openBlock(block)
  135 +
  136 + if status then
  137 + if isPlayer then
  138 + self.adv.battle.player:triggerPassive(Passive.OPEN_BLOCK)
  139 + self.map.adv:scoreChange(AdvScoreType.Block)
  140 + end
  141 +
  142 + if not ignoreBack then
  143 + self.adv:backBlockChange(roomId, blockId)
  144 + end
140 end 145 end
141 end 146 end
142 147
143 -function Map:openBlockBySize(roomId, blockId, size, isPlayer) 148 +function Map:openBlocksBySize(roomId, blockId, size, isPlayer, ignoreBack)
144 local blocks = self:getBlocksBySize(roomId, blockId, size) 149 local blocks = self:getBlocksBySize(roomId, blockId, size)
145 for _, block in pairs(blocks) do 150 for _, block in pairs(blocks) do
146 - self:openBlock(block.room.roomId, block.blockId, isPlayer) 151 + self:openBlock(block.room.roomId, block.blockId, isPlayer, ignoreBack)
147 end 152 end
148 end 153 end
149 154
150 -function Map:openBlocksByRoom(roomId, isPlayer) 155 +function Map:openBlocksByRoom(roomId, isPlayer, ignoreBack)
151 local room = self.rooms[roomId] 156 local room = self.rooms[roomId]
152 - if not room then return end 157 + if not room then return end
153 158
154 for blockId, block in pairs(room.blocks) do 159 for blockId, block in pairs(room.blocks) do
155 - self:openBlock(roomId, blockId, isPlayer) 160 + self:openBlock(roomId, blockId, isPlayer, ignoreBack)
156 end 161 end
157 end 162 end
158 163
159 -function Map:openAllBlocks(isPlayer) 164 +function Map:openAllBlocks(isPlayer, ignoreBack)
160 for roomId, room in pairs(self.rooms) do 165 for roomId, room in pairs(self.rooms) do
161 - self:openBlocksByRoom(room.roomId, isPlayer) 166 + self:openBlocksByRoom(room.roomId, isPlayer, ignoreBack)
162 end 167 end
163 end 168 end
164 169
src/adv/AdvRoom.lua
@@ -18,6 +18,7 @@ function Room:ctor(map, roomId, csvData, info, isPath) @@ -18,6 +18,7 @@ function Room:ctor(map, roomId, csvData, info, isPath)
18 end 18 end
19 19
20 function Room:loadBlocks(csvData, info) 20 function Room:loadBlocks(csvData, info)
  21 + local isFirstOpen = false
21 for blockId, _ in pairs(csvData["blocks"]) do 22 for blockId, _ in pairs(csvData["blocks"]) do
22 self.blocks[blockId] = Block.new(self, blockId, info.event[blockId], info.open == 1 or info.open[blockId], info.trap[blockId]) 23 self.blocks[blockId] = Block.new(self, blockId, info.event[blockId], info.open == 1 or info.open[blockId], info.trap[blockId])
23 if self.map.adv.isRelay then -- 中继层全部开放 24 if self.map.adv.isRelay then -- 中继层全部开放
@@ -33,11 +34,18 @@ function Room:loadBlocks(csvData, info) @@ -33,11 +34,18 @@ function Room:loadBlocks(csvData, info)
33 if self.blocks[blockId]:getEventType() == AdvEventType.In or self.blocks[blockId]:getEventType() == AdvEventType.InOut then -- 开放 34 if self.blocks[blockId]:getEventType() == AdvEventType.In or self.blocks[blockId]:getEventType() == AdvEventType.InOut then -- 开放
34 self.isShow = true 35 self.isShow = true
35 self.blocks[blockId].isOpen = true 36 self.blocks[blockId].isOpen = true
  37 + isFirstOpen = true
36 --入口房间只会在这里首次展示开放 --触发固有技 38 --入口房间只会在这里首次展示开放 --触发固有技
37 self.map.adv:triggerPassive(Passive.ROOM_SHOW, {roomId = self.roomId}) 39 self.map.adv:triggerPassive(Passive.ROOM_SHOW, {roomId = self.roomId})
38 end 40 end
39 end 41 end
40 end 42 end
  43 + -- boss 房间 开启一下所有的地块
  44 + if self.isBossRoom and self.isShow and isFirstOpen then
  45 + for _, block in pairs(self.blocks) do
  46 + self:openBlock(block)
  47 + end
  48 + end
41 end 49 end
42 50
43 function Room:getDB() 51 function Room:getDB()
@@ -68,13 +76,12 @@ function Room:openBlock(block) @@ -68,13 +76,12 @@ function Room:openBlock(block)
68 block:open() 76 block:open()
69 end 77 end
70 78
71 - self.map.adv:scoreChange(AdvScoreType.Block)  
72 -  
73 if not self.isShow then 79 if not self.isShow then
74 self.isShow = true 80 self.isShow = true
75 --首次展示房间 81 --首次展示房间
76 self.map.adv:triggerPassive(Passive.ROOM_SHOW, {roomId = self.roomId}) 82 self.map.adv:triggerPassive(Passive.ROOM_SHOW, {roomId = self.roomId})
77 end 83 end
  84 + return true
78 end 85 end
79 86
80 87