Commit 17d8d8552e159746bd76c9fbbef2280c295efe45
1 parent
19bab31c
冒险 时间 limit 改为全局
Showing
3 changed files
with
29 additions
and
1 deletions
Show diff stats
src/adv/Adv.lua
| @@ -95,6 +95,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt | @@ -95,6 +95,7 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt | ||
| 95 | 95 | ||
| 96 | if isEnter then -- 把 支援效果初始化为易用用的形式 | 96 | if isEnter then -- 把 支援效果初始化为易用用的形式 |
| 97 | self:initSupport(support or {}) | 97 | self:initSupport(support or {}) |
| 98 | + self.owner:setProperty("advLimit", {}) -- 清掉 Limit | ||
| 98 | end | 99 | end |
| 99 | 100 | ||
| 100 | -- 随机出地图 | 101 | -- 随机出地图 |
src/adv/AdvMap.lua
| @@ -243,6 +243,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) | @@ -243,6 +243,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) | ||
| 243 | local haveBoss = false | 243 | local haveBoss = false |
| 244 | local haveLChoose = false | 244 | local haveLChoose = false |
| 245 | 245 | ||
| 246 | + local eventLimit = self.adv.owner:getProperty("advLimit") | ||
| 246 | 247 | ||
| 247 | local function randomEvent(roomId, blockId, eventType) | 248 | local function randomEvent(roomId, blockId, eventType) |
| 248 | if mapInfo.rooms[roomId]["event"][blockId] then return end --已经有事件了 不覆盖 | 249 | if mapInfo.rooms[roomId]["event"][blockId] then return end --已经有事件了 不覆盖 |
| @@ -259,6 +260,14 @@ createMap = function(self, mapId, isEnter, isNewRelay) | @@ -259,6 +260,14 @@ createMap = function(self, mapId, isEnter, isNewRelay) | ||
| 259 | if not eventLib[etype] or not next(eventLib[etype]) or not eventLib[etype][especial] or not next(eventLib[etype][especial]) then return false end | 260 | if not eventLib[etype] or not next(eventLib[etype]) or not eventLib[etype][especial] or not next(eventLib[etype][especial]) then return false end |
| 260 | event.id = math.randWeight(eventLib[etype][especial], "showup") | 261 | event.id = math.randWeight(eventLib[etype][especial], "showup") |
| 261 | if not event.id then return false end | 262 | if not event.id then return false end |
| 263 | + | ||
| 264 | + -- 不是 0 才会记录 | ||
| 265 | + if eventLib[etype][especial][event.id].dlimit ~= 0 then | ||
| 266 | + eventLimit[etype] = eventLimit[etype] or 0 | ||
| 267 | + eventLimit[etype][event.id] = (eventLimit[etype][event.id] or 0) + 1 | ||
| 268 | + end | ||
| 269 | + | ||
| 270 | + -- 消除 | ||
| 262 | if eventLib[etype][especial][event.id].limit > 1 then | 271 | if eventLib[etype][especial][event.id].limit > 1 then |
| 263 | eventLib[etype][especial][event.id].limit = eventLib[etype][especial][event.id].limit - 1 | 272 | eventLib[etype][especial][event.id].limit = eventLib[etype][especial][event.id].limit - 1 |
| 264 | elseif eventLib[etype][especial][event.id].limit == 1 then | 273 | elseif eventLib[etype][especial][event.id].limit == 1 then |
| @@ -495,6 +504,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) | @@ -495,6 +504,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) | ||
| 495 | event.item = mapCsvData.clear:toArray(true, "=") --掉落钥匙 | 504 | event.item = mapCsvData.clear:toArray(true, "=") --掉落钥匙 |
| 496 | end | 505 | end |
| 497 | end | 506 | end |
| 507 | + self.adv.owner:setProperty("advLimit", eventLimit) | ||
| 498 | return mapInfo | 508 | return mapInfo |
| 499 | end | 509 | end |
| 500 | 510 | ||
| @@ -519,6 +529,8 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | @@ -519,6 +529,8 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | ||
| 519 | 529 | ||
| 520 | local advEventOpenStatus = self.adv.owner:advEventOpenStatus() | 530 | local advEventOpenStatus = self.adv.owner:advEventOpenStatus() |
| 521 | 531 | ||
| 532 | + local eventLimit = self.adv.owner:getProperty("advLimit") | ||
| 533 | + | ||
| 522 | for lib, eventType in pairs(libsToType) do | 534 | for lib, eventType in pairs(libsToType) do |
| 523 | -- init eventLib | 535 | -- init eventLib |
| 524 | if type(eventType) == "table" then | 536 | if type(eventType) == "table" then |
| @@ -540,10 +552,24 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | @@ -540,10 +552,24 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 | ||
| 540 | add = false | 552 | add = false |
| 541 | end | 553 | end |
| 542 | end | 554 | end |
| 555 | + | ||
| 556 | + -- data.limit 改为 整个冒险全程 | ||
| 557 | + local limit = data.limit | ||
| 558 | + if data.limit ~= 0 then | ||
| 559 | + limit = data.limit - ((eventLimit[etype] or {})[id] or 0) | ||
| 560 | + if limit <= 0 then | ||
| 561 | + add = false | ||
| 562 | + end | ||
| 563 | + end | ||
| 564 | + | ||
| 565 | + if add and (etype == AdvEventType.LinkChoose or etype == AdvEventType.Choose) then --只能有一次 | ||
| 566 | + limit = 1 | ||
| 567 | + end | ||
| 568 | + | ||
| 543 | if add then | 569 | if add then |
| 544 | if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then | 570 | if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then |
| 545 | eventLib[etype][data.BlockEventType] = eventLib[etype][data.BlockEventType] or {} | 571 | eventLib[etype][data.BlockEventType] = eventLib[etype][data.BlockEventType] or {} |
| 546 | - eventLib[etype][data.BlockEventType][id] = {showup = data.showup, limit = data.limit} | 572 | + eventLib[etype][data.BlockEventType][id] = {showup = data.showup, limit = limit, dlimit = data.limit} |
| 547 | end | 573 | end |
| 548 | end | 574 | end |
| 549 | end | 575 | end |
src/models/Role.lua
| @@ -83,6 +83,7 @@ Role.schema = { | @@ -83,6 +83,7 @@ Role.schema = { | ||
| 83 | advEAchiev = {"table", {}}, -- 冒险无尽冒险手册 | 83 | advEAchiev = {"table", {}}, -- 冒险无尽冒险手册 |
| 84 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 | 84 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 |
| 85 | advSup = {"table", {}}, -- 冒险支援效果 待选项 | 85 | advSup = {"table", {}}, -- 冒险支援效果 待选项 |
| 86 | + advLimit = {"table", {}}, -- 冒险事件每次的limit | ||
| 86 | 87 | ||
| 87 | --挂机相关 | 88 | --挂机相关 |
| 88 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 89 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |