diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index dea03a3..ab1cec6 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -161,8 +161,13 @@ function _M.startAdvRpc( agent, data ) end end end - - role:getAdvData():initByChapter(chapterId, layer, false, false, layer ~= 1, true, support) + role:getAdvData():initByChapter({ + chapterId = chapterId, + level = layer, + isRelay = layer ~= 1, + isEnter = true, + support = support, + }) role:checkTaskEnter("AdvStart", {id = chapterId}) role:checkTaskEnter("AdvStartSelf", {id = chapterId}) role:getAdvData():popBackEvents() -- 清一下事件 diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 7c18aaa..0428159 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -353,7 +353,7 @@ function _M.adv(role, pms) local layer = tonum(pms.pm2) local advCsv = csvdb["adv_chapterCsv"][chapterId] - if not advCsv then return end + if not advCsv then return "不存在的章节" end if math.floor(chapterId / 100) ~= 2 then layer = math.min(layer, advCsv.limitlevel) end @@ -368,30 +368,29 @@ function _M.adv(role, pms) return "成功" end -table.insert(helpDes, {"冒险到达指定层", "advt", "章节id", "层数"}) +table.insert(helpDes, {"冒险到达指定层", "advt", "章节id", "层数", "地图id(选)"}) function _M.advt(role, pms) local chapterId = tonum(pms.pm1) local layer = tonum(pms.pm2) + local mapId = tonum(pms.pm3) local advCsv = csvdb["adv_chapterCsv"][chapterId] if not advCsv then return "不存在的章节" end + local status = _M.adv(role, {pm1 = chapterId, pm2 = layer - 1}) + if status ~= "成功" then return status end + local advData = role:getAdvData() - if not advData.chapterId then - return "先随便开启一关" - end - if not advData:isEndless() then - layer = math.min(layer, advCsv.limitlevel) + if advData:isRunning() then + advData:forceOver() end - - _M.adv(role, {pm1 = chapterId, pm2 = layer - 1}) - - - advData.chapterId = chapterId - advData.level = layer - advData:saveDB() + advData:initByChapter({ + chapterId = chapterId, + level = layer, + isEnter = true, + debugMapId = mapId, + }) role:log("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) - return "成功" end diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index cdfb720..123a0b3 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -74,7 +74,16 @@ function Adv:isHaveRelay(level, chapterId) end -- 随机新的地图 -function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnter, support) +function Adv:initByChapter(params) + local chapterId = params.chapterId + local level = params.level + local isToNext = params.isToNext + local notNotify = params.notNotify + local isRelay = params.isRelay + local isEnter = params.isEnter + local support = params.support + local debugMapId = params.debugMapId + if not self.chapterId then -- 开始新的章节 self.chapterId = chapterId self:checkAchievement(Adv.AchievType.StartBattle, 1) @@ -100,16 +109,22 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt -- 随机出地图 local mapId, relayData - if isRelay then - relayData = self:isHaveRelay(level, chapterId) - if relayData then - mapId = relayData.map + + if debugMapId and csvdb["mapCsv"][debugMapId] then + mapId = debugMapId + end + if not mapId then + if isRelay then + relayData = self:isHaveRelay(level, chapterId) + if relayData then + mapId = relayData.map + else + isRelay = false + mapId = self:randomMapId(chapterId, level) + end else - isRelay = false mapId = self:randomMapId(chapterId, level) end - else - mapId = self:randomMapId(chapterId, level) end self.isRelay = isRelay @@ -977,10 +992,21 @@ local function clickOut(self, room, block, params, isExit) self.owner:getProperty("advTeam").player = self.battle.player:getDB() -- 临时缓存住 battle 的player if isHaveRelay and not self.isRelay then - self:initByChapter(self.chapterId, self.level, true, true, true, false) + self:initByChapter({ + chapterId = self.chapterId, + level = self.level, + isToNext = true, + notNotify = true, + isRelay = true, + }) else self:log({desc = "pass"}) - self:initByChapter(self.chapterId, self.level + 1, true, true, false, false) + self:initByChapter({ + chapterId = self.chapterId, + level = self.level + 1, + isToNext = true, + notNotify = true, + }) end self:backNext() --下一关 end diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 09b0e7f..01873d5 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -65,7 +65,9 @@ function Battle:initPlayer() player.level = 1 if self.adv.level ~= 1 then local relayData = self.adv:isHaveRelay() - player.level = relayData.level + if relayData then + player.level = relayData.level + end end player.exp = 0 player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100) @@ -249,16 +251,29 @@ end --回合 function Battle:afterRound() local mapIdx = self.adv:getCurMapIdx() - self.player:afterRound() + table.sort(self.enemys[mapIdx], function(e1, e2) return e1.id < e2.id end) + + self.player:afterRound("passive") for _, enemy in ipairs(self.enemys[mapIdx]) do - enemy:afterRound() + enemy:afterRound("passive") end for _, build in ipairs(self.builds[mapIdx]) do - build:afterRound() + build:afterRound("passive") + end + + self.player:afterRound("buff") + for _, enemy in ipairs(self.enemys[mapIdx]) do + enemy:afterRound("buff") end + for _, build in ipairs(self.builds[mapIdx]) do + build:afterRound("buff") + end + + + self.player:clearRound() for _, enemy in ipairs(self.enemys[mapIdx]) do enemy:clearRound() diff --git a/src/adv/AdvBuff.lua b/src/adv/AdvBuff.lua index 45854e5..565ebac 100644 --- a/src/adv/AdvBuff.lua +++ b/src/adv/AdvBuff.lua @@ -23,7 +23,7 @@ Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技 Buff.EXP_ADD = 20 -- 增加exp(每回合) Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击 Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记 - +Buff.SHOW_MONSTER_POS = 23 -- 蓝臂章训练场 感知 Buff.EXP_UP = 24 -- 杀敌经验提高 Buff.DISABLE_BUFF = 25 -- 禁用固有技 Buff.ATTR_CHANGE_COND = 26 --属性变化(状态)有条件 diff --git a/src/adv/AdvPlayer.lua b/src/adv/AdvPlayer.lua index b778efb..c1f4525 100644 --- a/src/adv/AdvPlayer.lua +++ b/src/adv/AdvPlayer.lua @@ -50,12 +50,15 @@ function BaseObject:reset(data) self:initAfter(data) end -function BaseObject:afterRound() - for _, passive in ipairs(self.passives) do - passive:afterRound(self) - end - for _, buff in ipairs(self.buffs) do - buff:afterRound() +function BaseObject:afterRound(roundType) + if roundType == "passive" then + for _, passive in ipairs(self.passives) do + passive:afterRound(self) + end + elseif roundType == "buff" then + for _, buff in ipairs(self.buffs) do + buff:afterRound() + end end end -- libgit2 0.21.2