Commit 78dcacb62fbadbe66f434dfa94c619a0a31a694d
1 parent
35e2e3c4
夹层 后处理 没做
Showing
2 changed files
with
18 additions
and
9 deletions
Show diff stats
src/adv/Adv.lua
@@ -1395,7 +1395,7 @@ local function clickLayer(self, room, block, params) | @@ -1395,7 +1395,7 @@ local function clickLayer(self, room, block, params) | ||
1395 | table.insert(self.mapStack, mapIdx) | 1395 | table.insert(self.mapStack, mapIdx) |
1396 | 1396 | ||
1397 | self.maps[mapIdx] = AdvMap.new(self, mapIdx, mapId) | 1397 | self.maps[mapIdx] = AdvMap.new(self, mapIdx, mapId) |
1398 | - self.battle:initMapEnemys(mapIdx) | 1398 | + self.battle:initMapEnemys(mapIdx, true) |
1399 | self.maps[mapIdx]:initBattleAfter() | 1399 | self.maps[mapIdx]:initBattleAfter() |
1400 | self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId) | 1400 | self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId) |
1401 | end | 1401 | end |
src/adv/AdvBattle.lua
@@ -18,16 +18,22 @@ function Battle:ctor(adv) | @@ -18,16 +18,22 @@ function Battle:ctor(adv) | ||
18 | end | 18 | end |
19 | end | 19 | end |
20 | 20 | ||
21 | -function Battle:initAfter() | ||
22 | - self.player:initAfter(self.adv.owner:getProperty("advTeam").player) | 21 | +function Battle:initAfter(mapIdx) |
22 | + if not mapIdx then | ||
23 | + self.player:initAfter(self.adv.owner:getProperty("advTeam").player) | ||
24 | + end | ||
23 | for idx, mapEnemys in pairs(self.enemys) do | 25 | for idx, mapEnemys in pairs(self.enemys) do |
24 | - for _, enemy in ipairs(mapEnemys) do | ||
25 | - enemy:initAfter(self.adv:getBlock(enemy.roomId, enemy.blockId, idx).event.enemy) | 26 | + if not mapIdx or idx == mapIdx then |
27 | + for _, enemy in ipairs(mapEnemys) do | ||
28 | + enemy:initAfter(self.adv:getBlock(enemy.roomId, enemy.blockId, idx).event.enemy) | ||
29 | + end | ||
26 | end | 30 | end |
27 | end | 31 | end |
28 | for idx, mapBuilds in pairs(self.builds) do | 32 | for idx, mapBuilds in pairs(self.builds) do |
29 | - for _, build in ipairs(mapBuilds) do | ||
30 | - build:initAfter(self.adv:getBlock(build.roomId, build.blockId, idx).event.build) | 33 | + if not mapIdx or idx == mapIdx then |
34 | + for _, build in ipairs(mapBuilds) do | ||
35 | + build:initAfter(self.adv:getBlock(build.roomId, build.blockId, idx).event.build) | ||
36 | + end | ||
31 | end | 37 | end |
32 | end | 38 | end |
33 | end | 39 | end |
@@ -111,8 +117,8 @@ function Battle:initEnemys() | @@ -111,8 +117,8 @@ function Battle:initEnemys() | ||
111 | end | 117 | end |
112 | end | 118 | end |
113 | 119 | ||
114 | - | ||
115 | -function Battle:initMapEnemys(mapIdx) | 120 | +-- after 是否是 后创建的夹层 |
121 | +function Battle:initMapEnemys(mapIdx, after) | ||
116 | self.enemys[mapIdx] = {} | 122 | self.enemys[mapIdx] = {} |
117 | self.builds[mapIdx] = {} | 123 | self.builds[mapIdx] = {} |
118 | local map = self.adv.maps[mapIdx] | 124 | local map = self.adv.maps[mapIdx] |
@@ -123,6 +129,9 @@ function Battle:initMapEnemys(mapIdx) | @@ -123,6 +129,9 @@ function Battle:initMapEnemys(mapIdx) | ||
123 | end | 129 | end |
124 | end | 130 | end |
125 | end | 131 | end |
132 | + if after then | ||
133 | + self:initAfter(mapIdx) | ||
134 | + end | ||
126 | if self.cachePassiveEvent[mapIdx] then | 135 | if self.cachePassiveEvent[mapIdx] then |
127 | for _, passiveC in ipairs(self.cachePassiveEvent or {}) do | 136 | for _, passiveC in ipairs(self.cachePassiveEvent or {}) do |
128 | for _, enemy in ipairs(self.enemys[mapIdx]) do | 137 | for _, enemy in ipairs(self.enemys[mapIdx]) do |