Commit e1b26027f2079cdbf4af03839cc088dd981ca614
1 parent
e085da41
增加移除项目排除功能
Showing
2 changed files
with
11 additions
and
5 deletions
Show diff stats
src/adv/AdvMap.lua
@@ -188,14 +188,16 @@ function Map:eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, coun | @@ -188,14 +188,16 @@ function Map:eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, coun | ||
188 | return change | 188 | return change |
189 | end | 189 | end |
190 | 190 | ||
191 | -function Map:clearEventById(eventType, eventId, count) | 191 | +function Map:clearEventById(eventType, eventId, count, exclude) |
192 | count = count or 0 | 192 | count = count or 0 |
193 | eventId = eventId or 0 | 193 | eventId = eventId or 0 |
194 | + exclude = exclude or {} | ||
194 | 195 | ||
195 | local pool = {} | 196 | local pool = {} |
196 | - for _, room_ in pairs(self.rooms) do | ||
197 | - for _, block_ in pairs(room_.blocks) do | ||
198 | - if block_.isOpen and block_:getEventType() == eventType and (eventId == 0 or block_.event.id == eventId) then | 197 | + for roomId, room_ in pairs(self.rooms) do |
198 | + exclude[roomId] = exclude[roomId] or {} | ||
199 | + for blockId, block_ in pairs(room_.blocks) do | ||
200 | + if not exclude[roomId][blockId] and block_.isOpen and block_:getEventType() == eventType and (eventId == 0 or block_.event.id == eventId) then | ||
199 | table.insert(pool, {room_, block_}) | 201 | table.insert(pool, {room_, block_}) |
200 | end | 202 | end |
201 | end | 203 | end |
src/adv/AdvPassive.lua
@@ -497,7 +497,11 @@ end | @@ -497,7 +497,11 @@ end | ||
497 | 497 | ||
498 | -- 移除指定项目 | 498 | -- 移除指定项目 |
499 | function Passive:effect13(eventType, triggerPms, eventId, count) | 499 | function Passive:effect13(eventType, triggerPms, eventId, count) |
500 | - local change = self.owner.battle.adv:getCurMap():clearEventById(eventType, eventId, count) | 500 | + local exclude = {} |
501 | + if self.owner:is("Enemy") then | ||
502 | + exclude[self.owner.roomId] = {[self.owner.blockId] = 1} | ||
503 | + end | ||
504 | + local change = self.owner.battle.adv:getCurMap():clearEventById(eventType, eventId, count, exclude) | ||
501 | for _, one in ipairs(change) do | 505 | for _, one in ipairs(change) do |
502 | self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId) | 506 | self.owner.battle.adv:backBlockChange(one[1].roomId, one[2].blockId) |
503 | end | 507 | end |