diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 92269e4..5e6f4fb 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -452,11 +452,10 @@ function _M.wearArtifactRpc(agent, data) local adv = role:getAdvData() if math.illegalNum(slot, 1, 5) then return 1 end - if not adv:isHaveArtifact(id) then return 2 end - if adv:isWaitChooseArtifact() then return 3 end + if adv:isWaitChooseArtifact() then return 2 end local status = adv:wearArtifact(slot, id) - if not status then return 4 end + if not status then return 3 end adv:saveDB() SendPacket(actionCodes.Adv_wearArtifactRpc, '') diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 95a2681..183e5be 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -457,6 +457,12 @@ function Adv:wearArtifact(slot, id) local advAFGet = self.owner:getProperty("advAFGet") local advAFWear = self.owner:getProperty("advAFWear") + if id == -1 then + if not advAFWear[slot] then return end + else + if not advAFGet[id] then return end + end + local curWear = {} for _, _id in pairs(advAFWear) do curWear[_id] = 1 @@ -484,23 +490,28 @@ function Adv:wearArtifact(slot, id) curWear[advAFWear[slot]] = nil end - curWear[id] = 1 - local newData = csvdb["adv_artifactCsv"][id][advAFGet[id]] - self:addArtifactEffect(newData.effect) - if newData.comboId ~= 0 then - local comboData = csvdb["adv_artifact_comboCsv"][newData.comboId] - if comboData then - local isHaveCombo = true - for _, _id in ipairs(comboData.artifactid:toArray(true)) do - if not curWear[_id] then - isHaveCombo = false - break + if id ~= -1 then + curWear[id] = 1 + local newData = csvdb["adv_artifactCsv"][id][advAFGet[id]] + self:addArtifactEffect(newData.effect) + + if newData.comboId ~= 0 then + local comboData = csvdb["adv_artifact_comboCsv"][newData.comboId] + if comboData then + local isHaveCombo = true + for _, _id in ipairs(comboData.artifactid:toArray(true)) do + if not curWear[_id] then + isHaveCombo = false + break + end + end + if isHaveCombo then + self:addArtifactEffect(comboData.effect) end - end - if isHaveCombo then - self:addArtifactEffect(comboData.effect) end end + else + id = nil end self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) diff --git a/src/adv/AdvMap.lua b/src/adv/AdvMap.lua index 94ee183..1103a51 100644 --- a/src/adv/AdvMap.lua +++ b/src/adv/AdvMap.lua @@ -271,7 +271,11 @@ createMap = function(self, mapId, isEnter, isNewRelay) --入口 randomFunc[AdvEventType.In] = function()end --出口 - randomFunc[AdvEventType.Out] = function() end + randomFunc[AdvEventType.Out] = function() + if not self.adv:isEndless() and isNewRelay then + return false + end + end --中继点出口 randomFunc[AdvEventType.Exit] = function() if not self.adv.isRelay or isEnter then return false end -- libgit2 0.21.2