Commit c0b7797ffc07c7aee96aaa1e2562028c4f0a461b

Authored by zhouhaihai
1 parent 1b35c0a2

陷阱、点击生效点

Showing 2 changed files with 45 additions and 0 deletions   Show diff stats
@@ -85,6 +85,8 @@ AdvEventType = { @@ -85,6 +85,8 @@ AdvEventType = {
85 Monster = 3, -- 普通怪 85 Monster = 3, -- 普通怪
86 Trader = 4, --商人 86 Trader = 4, --商人
87 Build = 5, --建筑物 87 Build = 5, --建筑物
  88 + Trap = 6, --陷阱
  89 + Click = 7, --点击生效
88 } 90 }
89 91
90 AdvBackEventType = { 92 AdvBackEventType = {
@@ -57,6 +57,8 @@ local function getEventLib(chapterId, level, needEventType) -- needEventType éœ @@ -57,6 +57,8 @@ local function getEventLib(chapterId, level, needEventType) -- needEventType éœ
57 ["event_dropCsv"] = AdvEventType.Drop, 57 ["event_dropCsv"] = AdvEventType.Drop,
58 ["event_buildingCsv"] = AdvEventType.Build, 58 ["event_buildingCsv"] = AdvEventType.Build,
59 ["event_traderCsv"] = AdvEventType.Trader, 59 ["event_traderCsv"] = AdvEventType.Trader,
  60 + ["event_trapCsv"] = AdvEventType.Trap,
  61 + ["event_clickCsv"] = AdvEventType.Click,
60 62
61 } 63 }
62 local eventLib = {} 64 local eventLib = {}
@@ -195,6 +197,11 @@ local function randomAdvMap(role, chapterId, level, notNotify) @@ -195,6 +197,11 @@ local function randomAdvMap(role, chapterId, level, notNotify)
195 randomFunc[AdvEventType.Trader] = randomCommon 197 randomFunc[AdvEventType.Trader] = randomCommon
196 --建筑 198 --建筑
197 randomFunc[AdvEventType.Build] = randomCommon 199 randomFunc[AdvEventType.Build] = randomCommon
  200 + --陷阱
  201 + randomFunc[AdvEventType.Trap] = randomCommon
  202 + --点击生效
  203 + randomFunc[AdvEventType.Click] = randomCommon
  204 +
198 205
199 if randomFunc[etype] then 206 if randomFunc[etype] then
200 if randomFunc[etype]() ~= false then 207 if randomFunc[etype]() ~= false then
@@ -342,6 +349,13 @@ function Block:open(adv, room) @@ -342,6 +349,13 @@ function Block:open(adv, room)
342 self.event.effect[3] = reward[2] 349 self.event.effect[3] = reward[2]
343 end 350 end
344 end 351 end
  352 + randomFunc[AdvEventType.Trap] = function()
  353 + local data = csvdb["event_trapCsv"][self.event.id]
  354 + for _, buffId in ipairs(data.effect:toArray(true, "=")) do
  355 + adv.battle.player:addBuff(buffId)
  356 + end
  357 + room:clearBEvent(self)
  358 + end
345 if self.event then -- éšæœºå‡ºå…·ä½“的事件 359 if self.event then -- éšæœºå‡ºå…·ä½“的事件
346 if randomFunc[self.event.etype] then 360 if randomFunc[self.event.etype] then
347 randomFunc[self.event.etype]() 361 randomFunc[self.event.etype]()
@@ -428,6 +442,10 @@ end @@ -428,6 +442,10 @@ end
428 442
429 function Room:clearBEvent(block) 443 function Room:clearBEvent(block)
430 if self.blocks[block.blockId] ~= block then return end 444 if self.blocks[block.blockId] ~= block then return end
  445 + if block.event.etype == AdvEventType.Trap then -- 记录陷阱ä½ç½®
  446 + self.info.trap = self.info.trap or {}
  447 + self.info.trap[block.blockId] = block.event.id
  448 + end
431 block.event = nil 449 block.event = nil
432 self.info.event[block.blockId] = nil 450 self.info.event[block.blockId] = nil
433 end 451 end
@@ -837,6 +855,30 @@ local function clickBuild(self, room, block, params) @@ -837,6 +855,30 @@ local function clickBuild(self, room, block, params)
837 return true 855 return true
838 end 856 end
839 857
  858 +local function clickClick(self, room, block, params)
  859 + local clickData = csvdb["event_clickCsv"][block.event.id]
  860 + if not clickData then return end
  861 + local clearBlock = true
  862 + local doEffect = {
  863 + [1] = function() -- 技能
  864 + for _, skillId in ipairs(clickData.effect:toArray(true, "=")) do
  865 + self.battle.player:releaseSkill(skillId)
  866 + end
  867 + end,
  868 + [2] = function() -- dropId
  869 + local reward = {}
  870 + for _, dropId in ipairs(clickData.effect:toArray(true, "=")) do
  871 + local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true)
  872 + reward[item[1]] = (reward[item[1]] or 0) + reward[item[2]]
  873 + end
  874 + self:backReward(self:award(reward, {}))
  875 + end,
  876 + }
  877 + if clearBlock then
  878 + room:clearBEvent(block)
  879 + end
  880 +end
  881 +
840 local eventCallFunc = { 882 local eventCallFunc = {
841 [AdvEventType.Out] = clickOut, 883 [AdvEventType.Out] = clickOut,
842 [AdvEventType.BOSS] = clickMonster, 884 [AdvEventType.BOSS] = clickMonster,
@@ -845,6 +887,7 @@ local eventCallFunc = { @@ -845,6 +887,7 @@ local eventCallFunc = {
845 [AdvEventType.Drop] = clickDrop, 887 [AdvEventType.Drop] = clickDrop,
846 [AdvEventType.Trader] = clickTrader, 888 [AdvEventType.Trader] = clickTrader,
847 [AdvEventType.Build] = clickBuild, 889 [AdvEventType.Build] = clickBuild,
  890 + [AdvEventType.Click] = clickClick,
848 } 891 }
849 892
850 --ç‚¹å‡»å¤„ç† roomId, blockId 893 --ç‚¹å‡»å¤„ç† roomId, blockId