Commit 8ca1144f7ce0f4a05f6f9311845979eacd5bed51

Authored by liuzujun
2 parents 2bc706ab e59430d5

Merge branch 'develop' of 120.26.43.151:wasteland/server into develop

@@ -214,6 +214,7 @@ AdvBackEventType = { @@ -214,6 +214,7 @@ AdvBackEventType = {
214 Level = 25, -- 升级 214 Level = 25, -- 升级
215 LinkChooseOver = 26, -- 连锁事件结束 215 LinkChooseOver = 26, -- 连锁事件结束
216 BuffEffect = 27, -- buff 效果 216 BuffEffect = 27, -- buff 效果
  217 + PassiveEffect = 28, -- 被动 效果
217 } 218 }
218 219
219 AdvScoreType = { 220 AdvScoreType = {
@@ -1388,19 +1388,31 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) @@ -1388,19 +1388,31 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1388 [14] = function() -- 指定地块召唤 指定类型的id 1388 [14] = function() -- 指定地块召唤 指定类型的id
1389 local change = self:getCurMap():layEventToStage(effect[2], effect[3], effect[4], effect[5]) 1389 local change = self:getCurMap():layEventToStage(effect[2], effect[3], effect[4], effect[5])
1390 for _, one in ipairs(change) do 1390 for _, one in ipairs(change) do
1391 - self:backBlockChange(one[1].roomId, one[2].blockId) 1391 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1392 + clearBlock = false
  1393 + else
  1394 + self:backBlockChange(one[1].roomId, one[2].blockId)
  1395 + end
1392 end 1396 end
1393 end, 1397 end,
1394 [15] = function() -- 移除指定事件 1398 [15] = function() -- 移除指定事件
1395 local change = self:getCurMap():clearEventById(effect[2], effect[3], effect[4]) 1399 local change = self:getCurMap():clearEventById(effect[2], effect[3], effect[4])
1396 for _, one in ipairs(change) do 1400 for _, one in ipairs(change) do
1397 - self:backBlockChange(one[1].roomId, one[2].blockId) 1401 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1402 + clearBlock = false
  1403 + else
  1404 + self:backBlockChange(one[1].roomId, one[2].blockId)
  1405 + end
1398 end 1406 end
1399 end, 1407 end,
1400 [16] = function() -- 指定事件转移 1408 [16] = function() -- 指定事件转移
1401 local change = self:getCurMap():eventChangeToOther(effect[2], effect[3], effect[4], effect[5], effect[6]) 1409 local change = self:getCurMap():eventChangeToOther(effect[2], effect[3], effect[4], effect[5], effect[6])
1402 for _, one in ipairs(change) do 1410 for _, one in ipairs(change) do
1403 - self:backBlockChange(one[1].roomId, one[2].blockId) 1411 + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then
  1412 + clearBlock = false
  1413 + else
  1414 + self:backBlockChange(one[1].roomId, one[2].blockId)
  1415 + end
1404 end 1416 end
1405 end, 1417 end,
1406 } 1418 }
@@ -1526,6 +1538,24 @@ local function clickBuild(self, room, block, params) @@ -1526,6 +1538,24 @@ local function clickBuild(self, room, block, params)
1526 local status, clearBlock = chooseCommon(self, room, block, chooseData, choose, "build") 1538 local status, clearBlock = chooseCommon(self, room, block, chooseData, choose, "build")
1527 if not status then return end 1539 if not status then return end
1528 1540
  1541 + local isMine = false -- 是不是宝藏怪
  1542 + for _, mid in ipairs(globalCsv.adv_egg_treasureLayer_id) do
  1543 + if mid == oldId then
  1544 + isMine = true
  1545 + break
  1546 + end
  1547 + end
  1548 + if isMine then
  1549 + local advMine = self.owner:getProperty("advMine")
  1550 + advMine[2] = advMine[2] or {}
  1551 + local mineCo2 = advMine[2].co or {}
  1552 + if chooseData.limit ~= 0 then
  1553 + mineCo2[oldId] = (mineCo2[oldId] or 0) + 1
  1554 + end
  1555 + advMine[2].co = mineCo2
  1556 + self.owner:setProperty("advMine", advMine)
  1557 + end
  1558 +
1529 self:checkTask(Adv.TaskType.Build, 1, oldId) 1559 self:checkTask(Adv.TaskType.Build, 1, oldId)
1530 self:checkAchievement(Adv.AchievType.Build, 1, oldId) 1560 self:checkAchievement(Adv.AchievType.Build, 1, oldId)
1531 self:checkAchievement(Adv.AchievType.BuildBySelect, 1, oldId, choose) 1561 self:checkAchievement(Adv.AchievType.BuildBySelect, 1, oldId, choose)
@@ -1960,6 +1990,7 @@ function Adv:enemyDead(enemy, escape) @@ -1960,6 +1990,7 @@ function Adv:enemyDead(enemy, escape)
1960 break 1990 break
1961 end 1991 end
1962 end 1992 end
  1993 +
1963 if isMine then 1994 if isMine then
1964 local advMine = self.owner:getProperty("advMine") 1995 local advMine = self.owner:getProperty("advMine")
1965 advMine[1] = advMine[1] or {} 1996 advMine[1] = advMine[1] or {}
@@ -1986,9 +2017,6 @@ function Adv:enemyDead(enemy, escape) @@ -1986,9 +2017,6 @@ function Adv:enemyDead(enemy, escape)
1986 etype = AdvEventType.Build, 2017 etype = AdvEventType.Build,
1987 id = cId 2018 id = cId
1988 }) 2019 })
1989 - if csvdb["event_buildingCsv"][cId].limit ~= 0 then  
1990 - mineCo2[cId] = (mineCo2[cId] or 0) + 1  
1991 - end  
1992 had = true 2020 had = true
1993 end 2021 end
1994 end 2022 end
src/adv/AdvMap.lua
@@ -13,12 +13,12 @@ local createMap, getEventLib @@ -13,12 +13,12 @@ local createMap, getEventLib
13 function Map:ctor(adv, mapIdx, mapInfo, isEnter, isNewRelay) 13 function Map:ctor(adv, mapIdx, mapInfo, isEnter, isNewRelay)
14 self.adv = adv 14 self.adv = adv
15 local isNew = type(mapInfo) == "number" 15 local isNew = type(mapInfo) == "number"
  16 + self.mapIdx = mapIdx
16 if isNew then -- mapInfo 传入 id 17 if isNew then -- mapInfo 传入 id
17 mapInfo = createMap(self, mapInfo, isEnter, isNewRelay) -- 生成地图 18 mapInfo = createMap(self, mapInfo, isEnter, isNewRelay) -- 生成地图
18 end 19 end
19 if not mapInfo then return end 20 if not mapInfo then return end
20 21
21 - self.mapIdx = mapIdx  
22 self.mapId = mapInfo.mapId 22 self.mapId = mapInfo.mapId
23 self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用 23 self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用
24 self.rooms = {} 24 self.rooms = {}
@@ -349,8 +349,8 @@ function Map:getDistance(froomId, fblockId, troomId, tblockId) @@ -349,8 +349,8 @@ function Map:getDistance(froomId, fblockId, troomId, tblockId)
349 local room1 = self.rooms[froomId] 349 local room1 = self.rooms[froomId]
350 local room2 = self.rooms[troomId] 350 local room2 = self.rooms[troomId]
351 if room1 and room2 then 351 if room1 and room2 then
352 - local block1 = room1[fblockId]  
353 - local block2 = room2[tblockId] 352 + local block1 = room1.blocks[fblockId]
  353 + local block2 = room2.blocks[tblockId]
354 if block1 and block2 then 354 if block1 and block2 then
355 local c1, r1 = room1:tranLtoG(block1.col, block1.row) 355 local c1, r1 = room1:tranLtoG(block1.col, block1.row)
356 local c2, r2 = room2:tranLtoG(block2.col, block2.row) 356 local c2, r2 = room2:tranLtoG(block2.col, block2.row)
@@ -811,46 +811,47 @@ createMap = function(self, mapId, isEnter, isNewRelay) @@ -811,46 +811,47 @@ createMap = function(self, mapId, isEnter, isNewRelay)
811 end 811 end
812 end 812 end
813 end 813 end
814 -  
815 -- 宝藏怪刷新 814 -- 宝藏怪刷新
816 - for idx = #(stagePool["global"][AdvCodeRandomStage] or {}), 1, -1 do  
817 - local c = stagePool["global"][AdvCodeRandomStage][idx] -- {room = roomId, block = blockId}  
818 - if mapInfo.rooms[c["room"]]["event"][c["block"]] then -- 存在  
819 - table.remove(stagePool["global"][AdvCodeRandomStage], idx)  
820 - end  
821 - end  
822 - local ln = #(stagePool["global"][AdvCodeRandomStage] or {})  
823 - local advMine = self.adv.owner:getProperty("advMine")  
824 - advMine[1] = advMine[1] or {}  
825 - local mineCh = advMine[1].ch or globalCsv.adv_egg_treasureMonster_showup  
826 - local mineCo = advMine[1].co or {}  
827 - local had = false  
828 - if ln > 0 then  
829 - if math.randomInt(1, 100) <= mineCh then -- 刷出来了  
830 - local mpool = {}  
831 - for _, mid in ipairs(globalCsv.adv_egg_treasureMonster_id) do  
832 - local monster = csvdb["event_monsterCsv"][mid]  
833 - if (not mineCo[mid] or monster.limit == 0 or mineCo[mid] < monster.limit) and monster.showup > 0 then  
834 - mpool[mid] = {monster.showup}  
835 - end  
836 - end  
837 - if next(mpool) then  
838 - local idx = math.randomInt(1, ln)  
839 - local cur = stagePool["global"][AdvCodeRandomStage][idx]  
840 - giveEvent(cur["room"], cur["block"], AdvEventType.Monster, math.randWeight(mpool, 1)) 815 + if self.mapIdx == 1 and not self.adv.isRelay then
  816 + for idx = #(stagePool["global"][AdvCodeRandomStage] or {}), 1, -1 do
  817 + local c = stagePool["global"][AdvCodeRandomStage][idx] -- {room = roomId, block = blockId}
  818 + if mapInfo.rooms[c["room"]]["event"][c["block"]] then -- 存在
841 table.remove(stagePool["global"][AdvCodeRandomStage], idx) 819 table.remove(stagePool["global"][AdvCodeRandomStage], idx)
842 - ln = ln - 1  
843 - had = true  
844 end 820 end
845 end 821 end
  822 + local ln = #(stagePool["global"][AdvCodeRandomStage] or {})
  823 + local advMine = self.adv.owner:getProperty("advMine")
  824 + advMine[1] = advMine[1] or {}
  825 + local mineCh = advMine[1].ch or globalCsv.adv_egg_treasureMonster_showup
  826 + local mineCo = advMine[1].co or {}
  827 + local had = false
  828 + if ln > 0 then
  829 + if math.randomInt(1, 100) <= mineCh then -- 刷出来了
  830 + local mpool = {}
  831 + for _, mid in ipairs(globalCsv.adv_egg_treasureMonster_id) do
  832 + local monster = csvdb["event_monsterCsv"][mid]
  833 + if (not mineCo[mid] or monster.limit == 0 or mineCo[mid] < monster.limit) and monster.showup > 0 then
  834 + mpool[mid] = {monster.showup}
  835 + end
  836 + end
  837 + if next(mpool) then
  838 + local idx = math.randomInt(1, ln)
  839 + local cur = stagePool["global"][AdvCodeRandomStage][idx]
  840 + giveEvent(cur["room"], cur["block"], AdvEventType.Monster, math.randWeight(mpool, 1))
  841 + table.remove(stagePool["global"][AdvCodeRandomStage], idx)
  842 + ln = ln - 1
  843 + had = true
  844 + end
  845 + end
  846 + end
  847 + if not had then
  848 + mineCh = math.min(mineCh + globalCsv.adv_egg_treasureMonster_showup_add, 100)
  849 + else
  850 + mineCh = nil
  851 + end
  852 + advMine[1].ch = mineCh
  853 + self.adv.owner:setProperty("advMine", advMine)
846 end 854 end
847 - if not had then  
848 - mineCh = math.min(mineCh + globalCsv.adv_egg_treasureMonster_showup_add, 100)  
849 - else  
850 - mineCh = nil  
851 - end  
852 - advMine[1].ch = mineCh  
853 - self.adv.owner:setProperty("advMine", advMine)  
854 855
855 856
856 if mapCsvData.clearType == 1 and not haveBoss then 857 if mapCsvData.clearType == 1 and not haveBoss then
src/adv/AdvPassive.lua
@@ -50,7 +50,7 @@ end @@ -50,7 +50,7 @@ end
50 50
51 FilterFactory[Filter.RANGE] = function (_Filter) 51 FilterFactory[Filter.RANGE] = function (_Filter)
52 _Filter._execute = function (self, target, params) 52 _Filter._execute = function (self, target, params)
53 - if self.owner.blockId and self.owner.roomId and params.blockId and params.roomId then 53 + if params and self.owner.blockId and self.owner.roomId and params.blockId and params.roomId then
54 local distance = self.owner.battle.adv:getCurMap():getDistance(self.owner.roomId, self.owner.blockId, params.roomId, params.blockId) 54 local distance = self.owner.battle.adv:getCurMap():getDistance(self.owner.roomId, self.owner.blockId, params.roomId, params.blockId)
55 return distance ~= -1 and distance <= self.value 55 return distance ~= -1 and distance <= self.value
56 end 56 end
@@ -95,9 +95,8 @@ function Filter:execute(params) @@ -95,9 +95,8 @@ function Filter:execute(params)
95 if not target then 95 if not target then
96 return 96 return
97 end 97 end
98 - if self:_execute(target) then  
99 - return self:_execute(target, params)  
100 - end 98 +
  99 + return self:_execute(target, params)
101 end 100 end
102 101
103 -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 102 -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -414,6 +413,7 @@ function Passive:trigger(condType, params) --触发检查 @@ -414,6 +413,7 @@ function Passive:trigger(condType, params) --触发检查
414 if self.round and self.round > 0 then -- cd 413 if self.round and self.round > 0 then -- cd
415 return 414 return
416 end 415 end
  416 + self.owner.battle.adv:pushBackEvent(AdvBackEventType.PassiveEffect, {show = self.passiveData.show, roomId = self.owner.roomId, blockId = self.owner.blockId })
417 self:effect(params) 417 self:effect(params)
418 end 418 end
419 419