Commit c8210d562035141fd8b972cba8ac2cea7cec8f54

Authored by zhouhaihai
1 parent badeee4e

boss 房有入口

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