diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 068546c..845ab0e 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -2127,6 +2127,32 @@ function Adv:doActive(activeId, target) self.battle.player:addBaseAttr(attr, value, vtype) return true end + -- 13=将目标移动至地图随机点,可以移动至未翻开的空格 + doActiveEffect[13] = function(_) + for _, target in ipairs(targers) do + end + return true + end + -- 14=获得drop,在有坐标时需要道具飞入背包的展现。 + doActiveEffect[14] = function(_, dropId) + local gift = nil + local dropData = csvdb["event_dropCsv"][dropId] + if dropData then + local item = dropData["range"]:randWeight(true) + if item[1] ~= 0 then + gift = {} + gift[item[1]] = (gift[item[1]] or 0) + item[2] + end + end + local roomId, blockId + if not target or not target.roomId or not target.blockId then + roomId, blockId = target.roomId, target.blockId + end + if gift then + self:award(gift, {log = {desc = "doActive", int1 = activeId}}, {roomId = roomId, blockId = blockId}) + end + return true + end for _, effect in ipairs(activeData.effect:toArray()) do local cur = effect:toArray(true, "=") diff --git a/src/adv/AdvMap.lua b/src/adv/AdvMap.lua index ac59c7e..2c33a19 100644 --- a/src/adv/AdvMap.lua +++ b/src/adv/AdvMap.lua @@ -97,23 +97,28 @@ function Map:checkOver() end end +function Map:randEmptyBlock() + local pool = {} + for _, room_ in pairs(self.rooms) do + for _, block_ in pairs(room_.blocks) do + if block_.isOpen and not block_.event then + table.insert(pool, {room_, block_}) + end + end + end + if not next(pool) then return end + local idx = math.randomInt(1, #pool) + return pool[idx][1], pool[idx][2] +end + --随机一个空的位置生成怪, 如果没有就没有 function Map:addNewMonsterRand(monsterId, where) local room, block if where then room, block = where[1], where[2] else - local pool = {} - for _, room_ in pairs(self.rooms) do - for _, block_ in pairs(room_.blocks) do - if block_.isOpen and not block_.event then - table.insert(pool, {room_, block_}) - end - end - end - if not next(pool) then return end - local idx = math.randomInt(1, #pool) - room, block = pool[idx][1], pool[idx][2] + room, block = self:randEmptyBlock() + if not room then return end end if not monsterId then -- libgit2 0.21.2