From 78dcacb62fbadbe66f434dfa94c619a0a31a694d Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Sat, 6 Jun 2020 15:51:15 +0800 Subject: [PATCH] 夹层 后处理 没做 --- src/adv/Adv.lua | 2 +- src/adv/AdvBattle.lua | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 123a0b3..3c056ef 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -1395,7 +1395,7 @@ local function clickLayer(self, room, block, params) table.insert(self.mapStack, mapIdx) self.maps[mapIdx] = AdvMap.new(self, mapIdx, mapId) - self.battle:initMapEnemys(mapIdx) + self.battle:initMapEnemys(mapIdx, true) self.maps[mapIdx]:initBattleAfter() self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId) end diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 01873d5..baa8056 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -18,16 +18,22 @@ function Battle:ctor(adv) end end -function Battle:initAfter() - self.player:initAfter(self.adv.owner:getProperty("advTeam").player) +function Battle:initAfter(mapIdx) + if not mapIdx then + self.player:initAfter(self.adv.owner:getProperty("advTeam").player) + end for idx, mapEnemys in pairs(self.enemys) do - for _, enemy in ipairs(mapEnemys) do - enemy:initAfter(self.adv:getBlock(enemy.roomId, enemy.blockId, idx).event.enemy) + if not mapIdx or idx == mapIdx then + for _, enemy in ipairs(mapEnemys) do + enemy:initAfter(self.adv:getBlock(enemy.roomId, enemy.blockId, idx).event.enemy) + end end end for idx, mapBuilds in pairs(self.builds) do - for _, build in ipairs(mapBuilds) do - build:initAfter(self.adv:getBlock(build.roomId, build.blockId, idx).event.build) + if not mapIdx or idx == mapIdx then + for _, build in ipairs(mapBuilds) do + build:initAfter(self.adv:getBlock(build.roomId, build.blockId, idx).event.build) + end end end end @@ -111,8 +117,8 @@ function Battle:initEnemys() end end - -function Battle:initMapEnemys(mapIdx) +-- after 是否是 后创建的夹层 +function Battle:initMapEnemys(mapIdx, after) self.enemys[mapIdx] = {} self.builds[mapIdx] = {} local map = self.adv.maps[mapIdx] @@ -123,6 +129,9 @@ function Battle:initMapEnemys(mapIdx) end end end + if after then + self:initAfter(mapIdx) + end if self.cachePassiveEvent[mapIdx] then for _, passiveC in ipairs(self.cachePassiveEvent or {}) do for _, enemy in ipairs(self.enemys[mapIdx]) do -- libgit2 0.21.2