Commit f2648427ae9867da4d35e7b3b1a78d1b1e3876d0

Authored by zhouhaihai
1 parent edf2ee12

修改中继营地解锁条件

Showing 2 changed files with 20 additions and 13 deletions   Show diff stats
src/actions/AdvAction.lua
@@ -137,7 +137,8 @@ function _M.startAdvRpc( agent, data ) @@ -137,7 +137,8 @@ function _M.startAdvRpc( agent, data )
137 local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true) 137 local relayData = role:getAdvData():isHaveRelay(layer, chapterId, true)
138 if not relayData then return 6 end -- 不是中继层 138 if not relayData then return 6 end -- 不是中继层
139 if layer ~= 1 then 139 if layer ~= 1 then
140 - if (advPass[chapterId] or 0) < relayData.floor then return 21 end 140 + local advRelay = role:getProperty("advRelay")
  141 + if not (advRelay[chapterId] or {})[layer] then return 21 end -- 没有开放
141 end 142 end
142 if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力 143 if not role:checkAdvCount(relayData.supply) then return 2 end -- 是否有体力
143 -- 关卡开放判断 144 -- 关卡开放判断
@@ -191,7 +192,7 @@ function _M.startHangRpc(agent, data) @@ -191,7 +192,7 @@ function _M.startHangRpc(agent, data)
191 local format = msg.format --编队 192 local format = msg.format --编队
192 local index = msg.index or 1--时间索引id 193 local index = msg.index or 1--时间索引id
193 194
194 - local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] 195 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId]
195 if not chapterData then return 1 end 196 if not chapterData then return 1 end
196 local campSiteData = chapterData[campId] 197 local campSiteData = chapterData[campId]
197 if not campSiteData then return 1 end 198 if not campSiteData then return 1 end
@@ -213,7 +214,7 @@ function _M.startHangRpc(agent, data) @@ -213,7 +214,7 @@ function _M.startHangRpc(agent, data)
213 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理 214 if AdvCommon.isEndless(chapterId) then return 5 end -- 无尽没有代理
214 215
215 local advRelay = role:getProperty("advRelay") 216 local advRelay = role:getProperty("advRelay")
216 - if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 217 + if not (advRelay[chapterId] or {})[campSiteData.floor] then return 6 end -- 没有开放
217 218
218 219
219 if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 220 if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力
@@ -140,12 +140,8 @@ function Adv:initByChapter(params) @@ -140,12 +140,8 @@ function Adv:initByChapter(params)
140 local chapter = self:isEndless() and -1 or self.chapterId 140 local chapter = self:isEndless() and -1 or self.chapterId
141 if not (advRelay[chapter] or {})[self.level] then 141 if not (advRelay[chapter] or {})[self.level] then
142 isNewRelay = true 142 isNewRelay = true
143 - advRelay[chapter] = advRelay[chapter] or {}  
144 - advRelay[chapter][self.level] = 1  
145 - self.owner:updateProperty({field = "advRelay", value = advRelay})  
146 end 143 end
147 end 144 end
148 -  
149 self.maps = {} 145 self.maps = {}
150 self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) 146 self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay)
151 147
@@ -153,8 +149,6 @@ function Adv:initByChapter(params) @@ -153,8 +149,6 @@ function Adv:initByChapter(params)
153 149
154 self:initLayerTask() 150 self:initLayerTask()
155 151
156 -  
157 -  
158 self:checkTask(Adv.TaskType.Arrive) 152 self:checkTask(Adv.TaskType.Arrive)
159 self:checkAdvUnlock(1, self.level) 153 self:checkAdvUnlock(1, self.level)
160 154
@@ -168,6 +162,20 @@ function Adv:initByChapter(params) @@ -168,6 +162,20 @@ function Adv:initByChapter(params)
168 end 162 end
169 end 163 end
170 164
  165 +function Adv:passAdvRelay()
  166 + local advRelay = self.owner:getProperty("advRelay")
  167 + local chapter = self:isEndless() and -1 or self.chapterId
  168 + if not (advRelay[chapter] or {})[self.level] then
  169 + advRelay[chapter] = advRelay[chapter] or {}
  170 + advRelay[chapter][self.level] = 1
  171 + self.owner:updateProperty({field = "advRelay", value = advRelay})
  172 + local relayData = self:isHaveRelay()
  173 + if relayData and relayData.award ~= "" then
  174 + self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})})
  175 + end
  176 + end
  177 +end
  178 +
171 function Adv:clear() 179 function Adv:clear()
172 self.chapterId = nil 180 self.chapterId = nil
173 self.level = nil 181 self.level = nil
@@ -1124,6 +1132,7 @@ local function clickOut(self, room, block, params, isExit) @@ -1124,6 +1132,7 @@ local function clickOut(self, room, block, params, isExit)
1124 end 1132 end
1125 1133
1126 if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 1134 if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束
  1135 + self:passAdvRelay()
1127 self:over(true) 1136 self:over(true)
1128 else 1137 else
1129 self.battle.player:triggerPassive(Passive.DOWN_LAYER) 1138 self.battle.player:triggerPassive(Passive.DOWN_LAYER)
@@ -1676,10 +1685,7 @@ function Adv:clickBlock(roomId, blockId, params) @@ -1676,10 +1685,7 @@ function Adv:clickBlock(roomId, blockId, params)
1676 if self.isRelay or checkAroundBlocks() then --开放 1685 if self.isRelay or checkAroundBlocks() then --开放
1677 self:getCurMap():openBlock(roomId, blockId, true, true) 1686 self:getCurMap():openBlock(roomId, blockId, true, true)
1678 if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励 1687 if self.isRelay and self:getCurMap():isAllOpen() then -- 发放翻开的奖励
1679 - local relayData = self:isHaveRelay()  
1680 - if relayData and relayData.award ~= "" then  
1681 - self:pushBackEvent(AdvBackEventType.RelayReward, {items = self:award(relayData.award:toNumMap(), {log = {desc = "relayReward"}})})  
1682 - end 1688 + self:passAdvRelay()
1683 end 1689 end
1684 status = true 1690 status = true
1685 end 1691 end