Commit 372f35154176f9a01d7bccd8647cd4770d1477b0

Authored by 熊润斐
2 parents a4360ed1 263f2579

Merge branch 'tr/bugfix' into tr/publish/qa-dev

Showing 2 changed files with 42 additions and 11 deletions   Show diff stats
src/adv/Adv.lua
... ... @@ -2127,6 +2127,32 @@ function Adv:doActive(activeId, target)
2127 2127 self.battle.player:addBaseAttr(attr, value, vtype)
2128 2128 return true
2129 2129 end
  2130 + -- 13=将目标移动至地图随机点,可以移动至未翻开的空格
  2131 + doActiveEffect[13] = function(_)
  2132 + for _, target in ipairs(targers) do
  2133 + end
  2134 + return true
  2135 + end
  2136 + -- 14=获得drop,在有坐标时需要道具飞入背包的展现。
  2137 + doActiveEffect[14] = function(_, dropId)
  2138 + local gift = nil
  2139 + local dropData = csvdb["event_dropCsv"][dropId]
  2140 + if dropData then
  2141 + local item = dropData["range"]:randWeight(true)
  2142 + if item[1] ~= 0 then
  2143 + gift = {}
  2144 + gift[item[1]] = (gift[item[1]] or 0) + item[2]
  2145 + end
  2146 + end
  2147 + local roomId, blockId
  2148 + if not target or not target.roomId or not target.blockId then
  2149 + roomId, blockId = target.roomId, target.blockId
  2150 + end
  2151 + if gift then
  2152 + self:award(gift, {log = {desc = "doActive", int1 = activeId}}, {roomId = roomId, blockId = blockId})
  2153 + end
  2154 + return true
  2155 + end
2130 2156  
2131 2157 for _, effect in ipairs(activeData.effect:toArray()) do
2132 2158 local cur = effect:toArray(true, "=")
... ...
src/adv/AdvMap.lua
... ... @@ -97,23 +97,28 @@ function Map:checkOver()
97 97 end
98 98 end
99 99  
  100 +function Map:randEmptyBlock()
  101 + local pool = {}
  102 + for _, room_ in pairs(self.rooms) do
  103 + for _, block_ in pairs(room_.blocks) do
  104 + if block_.isOpen and not block_.event then
  105 + table.insert(pool, {room_, block_})
  106 + end
  107 + end
  108 + end
  109 + if not next(pool) then return end
  110 + local idx = math.randomInt(1, #pool)
  111 + return pool[idx][1], pool[idx][2]
  112 +end
  113 +
100 114 --随机一个空的位置生成怪, 如果没有就没有
101 115 function Map:addNewMonsterRand(monsterId, where)
102 116 local room, block
103 117 if where then
104 118 room, block = where[1], where[2]
105 119 else
106   - local pool = {}
107   - for _, room_ in pairs(self.rooms) do
108   - for _, block_ in pairs(room_.blocks) do
109   - if block_.isOpen and not block_.event then
110   - table.insert(pool, {room_, block_})
111   - end
112   - end
113   - end
114   - if not next(pool) then return end
115   - local idx = math.randomInt(1, #pool)
116   - room, block = pool[idx][1], pool[idx][2]
  120 + room, block = self:randEmptyBlock()
  121 + if not room then return end
117 122 end
118 123  
119 124 if not monsterId then
... ...