Commit 17d8d8552e159746bd76c9fbbef2280c295efe45
1 parent
19bab31c
冒险 时间 limit 改为全局
Showing
3 changed files
with
29 additions
and
1 deletions
Show diff stats
src/adv/Adv.lua
src/adv/AdvMap.lua
... | ... | @@ -243,6 +243,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
243 | 243 | local haveBoss = false |
244 | 244 | local haveLChoose = false |
245 | 245 | |
246 | + local eventLimit = self.adv.owner:getProperty("advLimit") | |
246 | 247 | |
247 | 248 | local function randomEvent(roomId, blockId, eventType) |
248 | 249 | if mapInfo.rooms[roomId]["event"][blockId] then return end --已经有事件了 不覆盖 |
... | ... | @@ -259,6 +260,14 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
259 | 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 | 261 | event.id = math.randWeight(eventLib[etype][especial], "showup") |
261 | 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 | 271 | if eventLib[etype][especial][event.id].limit > 1 then |
263 | 272 | eventLib[etype][especial][event.id].limit = eventLib[etype][especial][event.id].limit - 1 |
264 | 273 | elseif eventLib[etype][especial][event.id].limit == 1 then |
... | ... | @@ -495,6 +504,7 @@ createMap = function(self, mapId, isEnter, isNewRelay) |
495 | 504 | event.item = mapCsvData.clear:toArray(true, "=") --掉落钥匙 |
496 | 505 | end |
497 | 506 | end |
507 | + self.adv.owner:setProperty("advLimit", eventLimit) | |
498 | 508 | return mapInfo |
499 | 509 | end |
500 | 510 | |
... | ... | @@ -519,6 +529,8 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 |
519 | 529 | |
520 | 530 | local advEventOpenStatus = self.adv.owner:advEventOpenStatus() |
521 | 531 | |
532 | + local eventLimit = self.adv.owner:getProperty("advLimit") | |
533 | + | |
522 | 534 | for lib, eventType in pairs(libsToType) do |
523 | 535 | -- init eventLib |
524 | 536 | if type(eventType) == "table" then |
... | ... | @@ -540,10 +552,24 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 |
540 | 552 | add = false |
541 | 553 | end |
542 | 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 | 569 | if add then |
544 | 570 | if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then |
545 | 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 | 573 | end |
548 | 574 | end |
549 | 575 | end | ... | ... |
src/models/Role.lua
... | ... | @@ -83,6 +83,7 @@ Role.schema = { |
83 | 83 | advEAchiev = {"table", {}}, -- 冒险无尽冒险手册 |
84 | 84 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 |
85 | 85 | advSup = {"table", {}}, -- 冒险支援效果 待选项 |
86 | + advLimit = {"table", {}}, -- 冒险事件每次的limit | |
86 | 87 | |
87 | 88 | --挂机相关 |
88 | 89 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | ... | ... |