Commit d3da3368ff132964721b07865ae706319111d6e7

Authored by zhouhaihai
1 parent 98761edc

冒险地图被动技, buff 神器

src/actions/AdvAction.lua
@@ -366,12 +366,12 @@ function _M.wearArtifactRpc(agent, data) @@ -366,12 +366,12 @@ function _M.wearArtifactRpc(agent, data)
366 366
367 local adv = role:getAdvData() 367 local adv = role:getAdvData()
368 368
369 - if math.illegalNum(slot, 1, 5) then return end  
370 - if not adv:isHaveArtifact(id) then return end  
371 - if not adv:isWaitChooseArtifact() then return end 369 + if math.illegalNum(slot, 1, 5) then return 1 end
  370 + if not adv:isHaveArtifact(id) then return 2 end
  371 + if adv:isWaitChooseArtifact() then return 3 end
372 372
373 local status = adv:wearArtifact(slot, id) 373 local status = adv:wearArtifact(slot, id)
374 - if not status then return end 374 + if not status then return 4 end
375 adv:saveDB() 375 adv:saveDB()
376 376
377 SendPacket(actionCodes.Adv_wearArtifactRpc, '') 377 SendPacket(actionCodes.Adv_wearArtifactRpc, '')
@@ -385,14 +385,15 @@ function _M.upArtifactRpc(agent, data) @@ -385,14 +385,15 @@ function _M.upArtifactRpc(agent, data)
385 local id = msg.id 385 local id = msg.id
386 386
387 local adv = role:getAdvData() 387 local adv = role:getAdvData()
  388 + if adv:isWaitChooseArtifact() then return 1 end
388 local curLevel = adv:isHaveArtifact(id) 389 local curLevel = adv:isHaveArtifact(id)
389 - if not curLevel then return end  
390 - if not role:isArtifactOpen(id, adv:isEndless(), curLevel + 1) then return end  
391 - local cost = csvdb["adv_artifactCsv"][curLevel].exp:toNumMap()  
392 - if not adv:cost(cost, {}, true) then return end 390 + if not curLevel then return 2 end
  391 + if not role:isArtifactOpen(id, adv:isEndless(), curLevel + 1) then return 3 end
  392 + local cost = csvdb["adv_artifactCsv"][id][curLevel].exp:toNumMap()
  393 + if not adv:cost(cost, {}, true) then return 4 end
393 394
394 local status = adv:artifactLevelUp(id) 395 local status = adv:artifactLevelUp(id)
395 - if not status then return end 396 + if not status then return 5 end
396 adv:cost(cost, {}) 397 adv:cost(cost, {})
397 398
398 if status == 1 then -- 现在穿着呢。更新下 399 if status == 1 then -- 现在穿着呢。更新下
@@ -449,6 +450,7 @@ function _M.endBattleRpc(agent, data) @@ -449,6 +450,7 @@ function _M.endBattleRpc(agent, data)
449 local enemyId = msg.enemyId 450 local enemyId = msg.enemyId
450 local key = msg.key 451 local key = msg.key
451 local player = msg.player 452 local player = msg.player
  453 + local bySkill = msg.bySkill --死于 技能
452 454
453 if not player or not player.hp or not player.sp or not enemyId or not key then return end 455 if not player or not player.hp or not player.sp or not enemyId or not key then return end
454 local adv = role:getAdvData() 456 local adv = role:getAdvData()
@@ -461,7 +463,7 @@ function _M.endBattleRpc(agent, data) @@ -461,7 +463,7 @@ function _M.endBattleRpc(agent, data)
461 adv.__battleCache = nil 463 adv.__battleCache = nil
462 464
463 465
464 - local status = adv:clickBlock(roomId, blockId, {player = player}) 466 + local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill})
465 if not status then return end 467 if not status then return end
466 SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()})) 468 SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()}))
467 return true 469 return true
src/actions/GmAction.lua
@@ -290,17 +290,28 @@ function _M.idlec(role, pms) @@ -290,17 +290,28 @@ function _M.idlec(role, pms)
290 return "成功" 290 return "成功"
291 end 291 end
292 292
293 -table.insert(helpDes, {"获取冒险内道具", "advit"}) 293 +table.insert(helpDes, {"冒险内可使用道具", "advit", "ALL"})
  294 +table.insert(helpDes, {"冒险内消耗道具", "advit", "itemId", "count"})
294 function _M.advit(role, pms) 295 function _M.advit(role, pms)
295 local reward = {} 296 local reward = {}
296 - for k, v in pairs(csvdb["adv_itemCsv"]) do  
297 - if csvdb["itemCsv"][k] and v.effect ~= 0 then  
298 - reward[k] = 1 297 + if pms.pm1 == "ALL" then
  298 + for k, v in pairs(csvdb["adv_itemCsv"]) do
  299 + if csvdb["itemCsv"][k] and v.effect ~= 0 then
  300 + reward[k] = 1
  301 + end
299 end 302 end
  303 + for k , v in pairs(csvdb["adv_artifactCsv"]) do
  304 + if v.unlock == 0 then
  305 + reward[k] = 1
  306 + end
  307 + end
  308 + else
  309 + local itemId = tonum(pms.pm1)
  310 + local count = tonum(pms.pm2)
  311 + reward[itemId] = count
300 end 312 end
301 - for k , v in pairs(csvdb["adv_artifactCsv"]) do  
302 - reward[k] = 1  
303 - end 313 +
  314 +
304 local adv = role:getAdvData() 315 local adv = role:getAdvData()
305 adv:award(reward) 316 adv:award(reward)
306 return "成功" 317 return "成功"
@@ -273,18 +273,17 @@ function Adv:waitChooseArtifact() @@ -273,18 +273,17 @@ function Adv:waitChooseArtifact()
273 table.insert(pool, id) 273 table.insert(pool, id)
274 end 274 end
275 end 275 end
276 -  
277 - for i = 1, count do  
278 - if len(pool) <= 0 then  
279 - table.insert(chooses, {ItemId.AdvPoint, 48})  
280 - else 276 + if #pool == 0 then
  277 + self:award({[ItemId.AdvPoint] = 48})
  278 + else
  279 + for i = 1, math.min(count, #pool) do
281 local idx = math.randomInt(1, #pool) 280 local idx = math.randomInt(1, #pool)
282 table.insert(chooses, pool[idx]) 281 table.insert(chooses, pool[idx])
283 table.remove(pool, idx) 282 table.remove(pool, idx)
284 end 283 end
  284 + self.waitArtifact = chooses
  285 + self:backChooseArtifact()
285 end 286 end
286 - self.waitArtifact = chooses  
287 - self:backChooseArtifact()  
288 end 287 end
289 288
290 function Adv:isWaitChooseArtifact() 289 function Adv:isWaitChooseArtifact()
@@ -293,9 +292,8 @@ end @@ -293,9 +292,8 @@ end
293 292
294 function Adv:chooseArtifact(index) 293 function Adv:chooseArtifact(index)
295 if not self.waitArtifact or not self.waitArtifact[index] then return end 294 if not self.waitArtifact or not self.waitArtifact[index] then return end
296 - local itemId = type(self.waitArtifact[index]) == "table" and self.waitArtifact[index][1] or self.waitArtifact[index]  
297 - local count = type(self.waitArtifact[index]) == "table" and self.waitArtifact[index][2] or 1  
298 - self:award({[itemId] = count}) 295 + self:award({[self.waitArtifact[index]] = 1})
  296 + self.waitArtifact = nil
299 return true 297 return true
300 end 298 end
301 299
@@ -308,6 +306,7 @@ function Adv:over(success, isAllPass) @@ -308,6 +306,7 @@ function Adv:over(success, isAllPass)
308 local score = self:getScore() 306 local score = self:getScore()
309 local scoreInfo = self.score 307 local scoreInfo = self.score
310 local reward 308 local reward
  309 + self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level})
311 if success then 310 if success then
312 reward = self.owner:award(self.owner:getProperty("advItems"):toNumMap()) 311 reward = self.owner:award(self.owner:getProperty("advItems"):toNumMap())
313 self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) 312 self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score})
@@ -391,7 +390,7 @@ function Adv:award(gift, params) @@ -391,7 +390,7 @@ function Adv:award(gift, params)
391 for itemId, count in pairs(tgift) do 390 for itemId, count in pairs(tgift) do
392 if count > 0 then 391 if count > 0 then
393 local buffAdd = self.battle.player:getRewardChange(itemId) 392 local buffAdd = self.battle.player:getRewardChange(itemId)
394 - count = math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1])) --附加 buff 的影响 393 + count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响
395 self:scoreChange(AdvScoreType.Item, {itemId, count}) 394 self:scoreChange(AdvScoreType.Item, {itemId, count})
396 self:checkTask(Adv.TaskType.Item, count, itemId) 395 self:checkTask(Adv.TaskType.Item, count, itemId)
397 self:checkAchievement(Adv.AchievType.GetItem, count, itemId) 396 self:checkAchievement(Adv.AchievType.GetItem, count, itemId)
@@ -473,6 +472,7 @@ local function clickOut(self, room, block, params) @@ -473,6 +472,7 @@ local function clickOut(self, room, block, params)
473 if params.relay or (not self:isEndless() and (self.level >= levellimit or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1))) then --关卡结束 472 if params.relay or (not self:isEndless() and (self.level >= levellimit or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1))) then --关卡结束
474 self:over(true, not self:isEndless() and self.level >= levellimit) 473 self:over(true, not self:isEndless() and self.level >= levellimit)
475 else 474 else
  475 + self.battle.player:triggerPassive(Passive.DOWN_LAYER)
476 self:initByChapter(self.chapterId, self.level + 1, true, true) 476 self:initByChapter(self.chapterId, self.level + 1, true, true)
477 self:backNext() --下一关 477 self:backNext() --下一关
478 end 478 end
@@ -616,6 +616,7 @@ end @@ -616,6 +616,7 @@ end
616 local function clickDrop(self, room, block, params) 616 local function clickDrop(self, room, block, params)
617 local reward = {} 617 local reward = {}
618 if not block.event.item then return end 618 if not block.event.item then return end
  619 + self.battle.player:triggerPassive(Passive.CLICK_DROP)
619 local reward = self:award({[block.event.item[1]] = block.event.item[2]}) 620 local reward = self:award({[block.event.item[1]] = block.event.item[2]})
620 -- local reward = self:award({[5801] = 1}) 621 -- local reward = self:award({[5801] = 1})
621 block:clear() 622 block:clear()
@@ -763,7 +764,7 @@ function Adv:clickBlock(roomId, blockId, params) @@ -763,7 +764,7 @@ function Adv:clickBlock(roomId, blockId, params)
763 end 764 end
764 end 765 end
765 if canOpen and not hadMonster then --开放 766 if canOpen and not hadMonster then --开放
766 - room:openBlock(block) 767 + self:getCurMap():openBlock(roomId, blockId, true)
767 status = true 768 status = true
768 end 769 end
769 else 770 else
@@ -1022,6 +1023,7 @@ function Adv:enemyDead(enemy, escape) @@ -1022,6 +1023,7 @@ function Adv:enemyDead(enemy, escape)
1022 etype = AdvEventType.Click, 1023 etype = AdvEventType.Click,
1023 id = clickId 1024 id = clickId
1024 }) 1025 })
  1026 + self.battle.player:triggerPassive(Passive.BATTLE_WIN)
1025 else 1027 else
1026 local item = block.event.item 1028 local item = block.event.item
1027 if not item then 1029 if not item then
@@ -1036,11 +1038,13 @@ function Adv:enemyDead(enemy, escape) @@ -1036,11 +1038,13 @@ function Adv:enemyDead(enemy, escape)
1036 end 1038 end
1037 if item[1] == 0 then 1039 if item[1] == 0 then
1038 block:clear() 1040 block:clear()
  1041 + self.battle.player:triggerPassive(Passive.BATTLE_WIN)
1039 else 1042 else
1040 block:updateEvent({ 1043 block:updateEvent({
1041 etype = AdvEventType.Drop, 1044 etype = AdvEventType.Drop,
1042 item = item 1045 item = item
1043 }) 1046 })
  1047 + self.battle.player:triggerPassive(Passive.BATTLE_WIN, {count = item[2]})
1044 end 1048 end
1045 end 1049 end
1046 self:checkTask(Adv.TaskType.Kill, 1, enemyId) 1050 self:checkTask(Adv.TaskType.Kill, 1, enemyId)
src/adv/AdvBattle.lua
@@ -196,6 +196,8 @@ function Battle:afterRound() @@ -196,6 +196,8 @@ function Battle:afterRound()
196 end 196 end
197 end 197 end
198 198
  199 + self.player:triggerPassive(Passive.AFTER_ROUND)
  200 +
199 if self.player.isDead then 201 if self.player.isDead then
200 self.adv:over(false) 202 self.adv:over(false)
201 end 203 end
@@ -212,6 +214,9 @@ function Battle:battleBegin(roomId, blockId, params) @@ -212,6 +214,9 @@ function Battle:battleBegin(roomId, blockId, params)
212 self.player:effectBattleBuff() 214 self.player:effectBattleBuff()
213 215
214 self.adv.owner:checkTaskEnter("AdvBattleWin", {id = self.adv.chapterId}) 216 self.adv.owner:checkTaskEnter("AdvBattleWin", {id = self.adv.chapterId})
  217 + if params.bySkill then
  218 + self.player:triggerPassive(Passive.SKILL_KILL)
  219 + end
215 end 220 end
216 if player.hp > self.player.hp then 221 if player.hp > self.player.hp then
217 self.player:recover(player.hp - self.player.hp, player) 222 self.player:recover(player.hp - self.player.hp, player)
src/adv/AdvBlock.lua
@@ -54,6 +54,11 @@ function Block:randomEvent() @@ -54,6 +54,11 @@ function Block:randomEvent()
54 enemy = adv.battle:addEnemy(room, self, map.mapIdx) 54 enemy = adv.battle:addEnemy(room, self, map.mapIdx)
55 end 55 end
56 enemy:triggerPassive(Passive.BORN_ONCE) 56 enemy:triggerPassive(Passive.BORN_ONCE)
  57 +
  58 + adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy})
  59 + for _, monster in pairs(adv.battle.player:getTeam(2)) do
  60 + adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy})
  61 + end
57 end 62 end
58 randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] 63 randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster]
59 --掉落 64 --掉落
@@ -107,6 +112,7 @@ function Block:randomEvent() @@ -107,6 +112,7 @@ function Block:randomEvent()
107 self.room.map.adv:mapItemChange(effect[2]) 112 self.room.map.adv:mapItemChange(effect[2])
108 end 113 end
109 end 114 end
  115 + adv.battle.player:triggerPassive(Passive.CLICK_TRAP)
110 adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id) 116 adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id)
111 adv:backTrap() 117 adv:backTrap()
112 self:clear() 118 self:clear()
@@ -130,6 +136,7 @@ function Block:open() @@ -130,6 +136,7 @@ function Block:open()
130 self:randomEvent() 136 self:randomEvent()
131 adv.owner:checkTaskEnter("AdvOpenBlock") 137 adv.owner:checkTaskEnter("AdvOpenBlock")
132 self.isOpen = true 138 self.isOpen = true
  139 + return true
133 end 140 end
134 141
135 return Block 142 return Block
136 \ No newline at end of file 143 \ No newline at end of file
src/adv/AdvBuff.lua
@@ -65,7 +65,7 @@ local function commonAttCond(_Buff, attrName) @@ -65,7 +65,7 @@ local function commonAttCond(_Buff, attrName)
65 self._changeV = self._changeV - self._changeV / (self.layer + 1) 65 self._changeV = self._changeV - self._changeV / (self.layer + 1)
66 self:_reSetAttr() 66 self:_reSetAttr()
67 end 67 end
68 - 68 +
69 _Buff._hpChange = function(self) 69 _Buff._hpChange = function(self)
70 local oldHpMax = self.owner.hpMax 70 local oldHpMax = self.owner.hpMax
71 self.owner:reSetHpMax() 71 self.owner:reSetHpMax()
@@ -268,7 +268,7 @@ local BuffFactory = { @@ -268,7 +268,7 @@ local BuffFactory = {
268 [Buff.OPEN_BLOCK] = function(_Buff) 268 [Buff.OPEN_BLOCK] = function(_Buff)
269 _Buff._afterRound = function(self) 269 _Buff._afterRound = function(self)
270 local roomNum = self:effect() 270 local roomNum = self:effect()
271 - self.owner.battle.adv:openBlockRand(roomNum) 271 + self.owner.battle.adv:getCurMap():openBlockRand(roomNum, not self.owner.monsterId)
272 end 272 end
273 _Buff._effectValue = function(self) 273 _Buff._effectValue = function(self)
274 -- 数量 274 -- 数量
@@ -345,7 +345,7 @@ local BuffFactory = { @@ -345,7 +345,7 @@ local BuffFactory = {
345 _Buff._init = function(self) 345 _Buff._init = function(self)
346 -- 先给自己的buff 搞一下子 346 -- 先给自己的buff 搞一下子
347 for _, buff in ipairs(self.owner.buffs) do 347 for _, buff in ipairs(self.owner.buffs) do
348 - if not buff.isDel and buff.classify == self.buffData.effectValue1 then 348 + if not buff.isDel and (buff.buffData.classify:find(" " .. self.buffData.effectValue1) or buff.buffData.classify:find(self.buffData.effectValue1 .. " ")) then
349 buff:effectChange() 349 buff:effectChange()
350 end 350 end
351 end 351 end
@@ -388,6 +388,7 @@ function Buff:ctor(owner, id) @@ -388,6 +388,7 @@ function Buff:ctor(owner, id)
388 self.round = 0 --剩余的回合 388 self.round = 0 --剩余的回合
389 self.count = -1 -- 可生效的次数 -1 无次数限制 389 self.count = -1 -- 可生效的次数 -1 无次数限制
390 self.layer = 1 -- 当前buff 层数 390 self.layer = 1 -- 当前buff 层数
  391 + self.releaseId = nil -- 释放的怪物Id
391 392
392 if BuffFactory[self.buffData.type] then 393 if BuffFactory[self.buffData.type] then
393 BuffFactory[self.buffData.type](self) 394 BuffFactory[self.buffData.type](self)
@@ -408,6 +409,7 @@ end @@ -408,6 +409,7 @@ end
408 409
409 function Buff:initNew(release, data) 410 function Buff:initNew(release, data)
410 self.release = release or self.owner 411 self.release = release or self.owner
  412 + self.releaseId = self.release.monsterId or 0
411 self.round = self.buffData.round 413 self.round = self.buffData.round
412 self.roundSpace = 0 --生效间隔 414 self.roundSpace = 0 --生效间隔
413 self.layer = 1 415 self.layer = 1
@@ -427,6 +429,7 @@ function Buff:initByDB(data) @@ -427,6 +429,7 @@ function Buff:initByDB(data)
427 self.release = self.owner.battle:getEnemyById(data.rele) 429 self.release = self.owner.battle:getEnemyById(data.rele)
428 end 430 end
429 end 431 end
  432 + self.releaseId = data.releId
430 self.round = data.round 433 self.round = data.round
431 self.roundSpace = data.roundSp 434 self.roundSpace = data.roundSp
432 if data.count then 435 if data.count then
@@ -462,7 +465,7 @@ function Buff:afterRound() @@ -462,7 +465,7 @@ function Buff:afterRound()
462 self:decRound() 465 self:decRound()
463 end 466 end
464 467
465 --- 只使用owner 和 buffData 468 +-- 只使用owner 和 buffData 和 releaseId
466 function Buff:checkKeep() 469 function Buff:checkKeep()
467 if self.buffData.keepTerm == "" then return true end 470 if self.buffData.keepTerm == "" then return true end
468 --[[ 471 --[[
@@ -473,10 +476,10 @@ function Buff:checkKeep() @@ -473,10 +476,10 @@ function Buff:checkKeep()
473 --]] 476 --]]
474 477
475 local checkFunc = {} 478 local checkFunc = {}
476 - checkFunc[1] = function(_, enemyId) 479 + checkFunc[1] = function(_)
477 local enemys = self.owner.battle.player:getTeam(2) 480 local enemys = self.owner.battle.player:getTeam(2)
478 for _, enemy in pairs(enemys) do 481 for _, enemy in pairs(enemys) do
479 - if enemy.monsterId == enemyId then 482 + if enemy.monsterId == self.releaseId then
480 return true 483 return true
481 end 484 end
482 end 485 end
@@ -621,7 +624,7 @@ function Buff:effectChange() @@ -621,7 +624,7 @@ function Buff:effectChange()
621 end 624 end
622 625
623 function Buff:doEffectChange(effect) 626 function Buff:doEffectChange(effect)
624 - if not self.buffData.classify then return effect end 627 + if self.buffData.classify == "" then return effect end
625 local change = self.owner:getBuffEffectChange(self.buffData.classify) 628 local change = self.owner:getBuffEffectChange(self.buffData.classify)
626 return effect * (1 + change) 629 return effect * (1 + change)
627 end 630 end
@@ -643,6 +646,9 @@ function Buff:getDB() @@ -643,6 +646,9 @@ function Buff:getDB()
643 db.count = self.count 646 db.count = self.count
644 end 647 end
645 db.layer = self.layer 648 db.layer = self.layer
  649 + if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then
  650 + db.releId = self.releaseId
  651 + end
646 return db 652 return db
647 end 653 end
648 654
src/adv/AdvMap.lua
@@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where) @@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where)
100 end 100 end
101 101
102 -- 随机翻开 num 个 以开放的房间的 地块 102 -- 随机翻开 num 个 以开放的房间的 地块
103 -function Map:openBlockRand(num) 103 +function Map:openBlockRand(num, isPlayer)
104 local pool = {} 104 local pool = {}
105 for _, room in pairs(self.rooms) do 105 for _, room in pairs(self.rooms) do
106 if room.isShow and not room.isPath then 106 if room.isShow and not room.isPath then
@@ -113,12 +113,12 @@ function Map:openBlockRand(num) @@ -113,12 +113,12 @@ function Map:openBlockRand(num)
113 end 113 end
114 if #pool <= num then 114 if #pool <= num then
115 for _, temp in ipairs(pool) do 115 for _, temp in ipairs(pool) do
116 - self:openBlock(temp[1], temp[2]) 116 + self:openBlock(temp[1], temp[2], isPlayer)
117 end 117 end
118 else 118 else
119 for i = 1, num do 119 for i = 1, num do
120 local idx = math.randomInt(1, #pool) 120 local idx = math.randomInt(1, #pool)
121 - self:openBlock(pool[idx][1], pool[idx][2]) 121 + self:openBlock(pool[idx][1], pool[idx][2], isPlayer)
122 table.remove(pool, idx) 122 table.remove(pool, idx)
123 end 123 end
124 end 124 end
@@ -126,15 +126,40 @@ end @@ -126,15 +126,40 @@ end
126 126
127 127
128 -- 打开一个地块 128 -- 打开一个地块
129 -function Map:openBlock(roomId, blockId) 129 +function Map:openBlock(roomId, blockId, isPlayer)
130 local room = self.rooms[roomId] 130 local room = self.rooms[roomId]
131 if not room then return end 131 if not room then return end
132 local block = room.blocks[blockId] 132 local block = room.blocks[blockId]
133 if not block then return end 133 if not block then return end
134 - room:openBlock(block, self) 134 + room:openBlock(block)
  135 + if isPlayer then
  136 + self.adv.player:triggerPassive(Passive.OPEN_BLOCK)
  137 + end
135 self:backBlockChange(roomId, blockId) 138 self:backBlockChange(roomId, blockId)
136 end 139 end
137 140
  141 +function Map:openBlockBySize(roomId, blockId, size, isPlayer)
  142 + local blocks = self:getBlocksBySize(roomId, blockId, size)
  143 + for _, block in pairs(blocks) do
  144 + self:openBlock(block.room.roomId, block.blockId, isPlayer)
  145 + end
  146 +end
  147 +
  148 +function Map:openBlocksByRoom(roomId, isPlayer)
  149 + local room = self.rooms[roomId]
  150 + if not room then return end
  151 +
  152 + for blockId, block in pairs(room.blocks) do
  153 + self:openBlock(roomId, blockId, isPlayer)
  154 + end
  155 +end
  156 +
  157 +function Map:openAllBlocks(isPlayer)
  158 + for roomId, room in pairs(self.rooms) do
  159 + self:openBlocksByRoom(room.roomId, isPlayer)
  160 + end
  161 +end
  162 +
138 163
139 --获取,某个位置上的 room 和 block 164 --获取,某个位置上的 room 和 block
140 function Map:getRBByPos(c, r) 165 function Map:getRBByPos(c, r)
src/adv/AdvPassive.lua
@@ -89,10 +89,10 @@ Passive.HP_LOW_SELF = 5 --自身生命值&lt;N%时,每回合触发 @@ -89,10 +89,10 @@ Passive.HP_LOW_SELF = 5 --自身生命值&lt;N%时,每回合触发
89 Passive.HP_LOW_TEAM = 6 --敌人生命值<N%时,每回合触发 89 Passive.HP_LOW_TEAM = 6 --敌人生命值<N%时,每回合触发
90 Passive.HP_UP_SELF = 7 --自身生命值>N%时,每回合触发 90 Passive.HP_UP_SELF = 7 --自身生命值>N%时,每回合触发
91 Passive.HP_UP_TEAM = 8 --敌人生命值>N%时,每回合触发 91 Passive.HP_UP_TEAM = 8 --敌人生命值>N%时,每回合触发
92 -Passive.SELF_ATK = 9 --自身攻击N次后,触发1次  
93 -Passive.SELF_HURT = 10 --自身受击N次后,触发1次  
94 -Passive.TEAM_ATK = 11 --队友攻击N次后,触发1次  
95 -Passive.TEAM_HURT = 12 --队友受击N次后,触发1次 92 +Passive.SELF_ATK = 9 --自身攻击N次后,触发1次 < discard >
  93 +Passive.SELF_HURT = 10 --自身受击buff后,触发1次
  94 +Passive.TEAM_ATK = 11 --队友攻击N次后,触发1次 < discard >
  95 +Passive.TEAM_HURT = 12 --队友受击buff后,触发1次
96 Passive.MONSTER_COUNT_UP = 13 --场上存在N个以上怪物,每回合触发 96 Passive.MONSTER_COUNT_UP = 13 --场上存在N个以上怪物,每回合触发
97 Passive.MONSTER_COUNT_LOW = 14 --场上存在N个以下怪物,每回合触发 97 Passive.MONSTER_COUNT_LOW = 14 --场上存在N个以下怪物,每回合触发
98 Passive.SELF_DEAD = 15 --自身死亡后,触发1次 98 Passive.SELF_DEAD = 15 --自身死亡后,触发1次
@@ -100,6 +100,18 @@ Passive.TEAM_DEAD = 16 --队友死亡后,触发1次 @@ -100,6 +100,18 @@ Passive.TEAM_DEAD = 16 --队友死亡后,触发1次
100 Passive.TARGET_SKILL = 17 --目标每使用N次技能,触发1次 100 Passive.TARGET_SKILL = 17 --目标每使用N次技能,触发1次
101 Passive.TEAM_SKILL = 18 --队友每使用N次技能,触发1次 101 Passive.TEAM_SKILL = 18 --队友每使用N次技能,触发1次
102 102
  103 +Passive.HAVE_MONSTER = 20 --场上拥有指定怪时 回合触发
  104 +Passive.SKILL_KILL = 21 --技能击杀怪物时 触发1次
  105 +Passive.CLICK_TRAP = 22 --触发陷阱时 触发1次
  106 +Passive.DOWN_LAYER = 23 --下层时 触发1次
  107 +Passive.ADV_OVER = 24 --结算时 触发1次
  108 +Passive.BATTLE_WIN = 25 --战斗胜利x次时
  109 +Passive.CLICK_DROP = 26 --拾取drop x次时
  110 +Passive.AFTER_ROUND = 27 --经过 x回合时
  111 +Passive.GET_BUFF = 28 --获得指定buff
  112 +Passive.OPEN_BLOCK = 29 --翻开格子
  113 +Passive.OPEN_MONSTER = 30 --翻开怪物
  114 +
103 115
104 -- 不同的开启条件 116 -- 不同的开启条件
105 local PassiveCondFactory = {} 117 local PassiveCondFactory = {}
@@ -122,21 +134,63 @@ end @@ -122,21 +134,63 @@ end
122 134
123 PassiveCondFactory[Passive.HURT_PERCENT_TEAM] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 135 PassiveCondFactory[Passive.HURT_PERCENT_TEAM] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
124 PassiveCondFactory[Passive.SELF_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 136 PassiveCondFactory[Passive.SELF_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
125 -PassiveCondFactory[Passive.SELF_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同  
126 PassiveCondFactory[Passive.TEAM_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 137 PassiveCondFactory[Passive.TEAM_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
127 -PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同  
128 PassiveCondFactory[Passive.TARGET_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 138 PassiveCondFactory[Passive.TARGET_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
129 PassiveCondFactory[Passive.TEAM_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 139 PassiveCondFactory[Passive.TEAM_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
  140 +PassiveCondFactory[Passive.BATTLE_WIN] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
  141 +PassiveCondFactory[Passive.CLICK_DROP] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
  142 +PassiveCondFactory[Passive.AFTER_ROUND] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
  143 +PassiveCondFactory[Passive.OPEN_BLOCK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同
  144 +
  145 +PassiveCondFactory[Passive.SELF_HURT] = function(_Passive)
  146 + _Passive._trigger = function(self, params)
  147 + local buffId = params.buffId
  148 + local data = csvdb["adv_map_buffCsv"][buffId]
  149 + if data.classify:find(" " .. self.passiveData.value) or data.classify:find(self.passiveData.value .. " ") then
  150 + return true
  151 + end
  152 + end
  153 +end
  154 +PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.SELF_HURT] --逻辑相同
  155 +
130 156
131 PassiveCondFactory[Passive.ROOM_SHOW] = function(_Passive) 157 PassiveCondFactory[Passive.ROOM_SHOW] = function(_Passive)
132 _Passive._trigger = function(self, params) 158 _Passive._trigger = function(self, params)
133 local roomId = params.roomId 159 local roomId = params.roomId
134 - if self.roomId == roomId then 160 + if self.owner.roomId == roomId then
135 return true 161 return true
136 end 162 end
137 end 163 end
138 end 164 end
139 165
  166 +PassiveCondFactory[Passive.GET_BUFF] = function(_Passive)
  167 + _Passive._trigger = function(self, params)
  168 + if self.passiveData.value == params.buffId then
  169 + return true
  170 + end
  171 + end
  172 +end
  173 +
  174 +
  175 +PassiveCondFactory[Passive.BORN_ONCE] = function(_Passive)
  176 + _Passive._afterRound = function(self)
  177 + if not self.owner.lock then
  178 + self:trigger(Passive.BORN_ONCE)
  179 + end
  180 + end
  181 +end
  182 +
  183 +PassiveCondFactory[Passive.HAVE_MONSTER] = function(_Passive)
  184 + _Passive._afterRound = function(self)
  185 + for _, player in ipairs(self.owner.battle.player:getTeam(2)) do
  186 + if player.monsterId == self.passiveData.value then
  187 + self:trigger(Passive.HAVE_MONSTER)
  188 + break
  189 + end
  190 + end
  191 + end
  192 +end
  193 +
140 PassiveCondFactory[Passive.HP_LOW_SELF] = function(_Passive) 194 PassiveCondFactory[Passive.HP_LOW_SELF] = function(_Passive)
141 _Passive._afterRound = function(self) 195 _Passive._afterRound = function(self)
142 if self.owner.hp / self.owner.hpMax * 100 < self.passiveData.value then 196 if self.owner.hp / self.owner.hpMax * 100 < self.passiveData.value then
@@ -242,12 +296,16 @@ function Passive:canEffect(effType, effValue) @@ -242,12 +296,16 @@ function Passive:canEffect(effType, effValue)
242 return true 296 return true
243 end 297 end
244 298
245 -function Passive:effect(trigger) 299 +function Passive:effect(triggerPms)
246 for _, effect in pairs(self.effects) do 300 for _, effect in pairs(self.effects) do
247 local effType = effect[1] 301 local effType = effect[1]
248 local effValue = effect[2] 302 local effValue = effect[2]
  303 + local otherPms = {}
  304 + for i = 3, #effect do
  305 + table.insert(otherPms, effect[i])
  306 + end
249 if self:canEffect(effType, effValue) then 307 if self:canEffect(effType, effValue) then
250 - self["effect" .. effType](self, effValue, trigger) 308 + self["effect" .. effType](self, effValue, triggerPms, table.unpack(otherPms))
251 end 309 end
252 end 310 end
253 311
@@ -296,7 +354,7 @@ function Passive:trigger(condType, params) --触发检查 @@ -296,7 +354,7 @@ function Passive:trigger(condType, params) --触发检查
296 if self.round > 0 and self.turn > 0 then -- cd 354 if self.round > 0 and self.turn > 0 then -- cd
297 return 355 return
298 end 356 end
299 - self:effect(params.trigger) 357 + self:effect(params)
300 end 358 end
301 359
302 function Passive:filter(params) 360 function Passive:filter(params)
@@ -330,25 +388,39 @@ function Passive:effect1(value) @@ -330,25 +388,39 @@ function Passive:effect1(value)
330 self.owner:addBuff(value, self.owner) 388 self.owner:addBuff(value, self.owner)
331 end 389 end
332 --2=触发目标获得buff 390 --2=触发目标获得buff
333 -function Passive:effect2(value, trigger)  
334 - if trigger then  
335 - trigger:addBuff(value, self.owner) 391 +function Passive:effect2(value, triggerPms)
  392 + if triggerPms.trigger then
  393 + triggerPms.trigger:addBuff(value, self.owner)
336 end 394 end
337 end 395 end
338 --3=翻开自己所在格子 396 --3=翻开自己所在格子
339 -function Passive:effect3()  
340 - self.owner.battle.adv:openBlock(self.owner.roomId, self.owner.blockId) 397 +function Passive:effect3(value)
  398 + if value == 0 then
  399 + self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId)
  400 + elseif value > 0 then
  401 + self.owner.battle.adv:getCurMap():openBlocksBySize(self.owner.roomId, self.owner.blockId, value)
  402 + elseif value == -1 then -- 当前房间
  403 + self.owner.battle.adv:getCurMap():openBlocksByRoom(self.owner.roomId)
  404 + elseif value == -2 then -- 当前层
  405 + self.owner.battle.adv:getCurMap():openAllBlocks(not self.owner.monsterId)
  406 + end
341 end 407 end
342 --4=逃跑 408 --4=逃跑
343 function Passive:effect4() 409 function Passive:effect4()
344 self.owner.isDead = 1 --跑了 410 self.owner.isDead = 1 --跑了
345 - -- self.owner.battle.adv:enemyDead(self.owner, true)  
346 end 411 end
347 ---5=给随机一个敌方增加一个buff  
348 -function Passive:effect5(value) 412 +
  413 +--5=召唤怪物
  414 +function Passive:effect5(monsterId)
  415 + self.owner.battle.adv:getCurMap():addNewMonsterRand(monsterId)
  416 +end
  417 +
  418 +--6=给所有敌方增加一个buff
  419 +function Passive:effect6(value)
349 local monsters = self.owner.battle.player:getTeam(2) 420 local monsters = self.owner.battle.player:getTeam(2)
350 - local randomId = math.random( 1, #monsters )  
351 - monsters[randomId]:addBuff(value, self.owner) 421 + for _, enemy in ipairs(monsters) do
  422 + enemy:addBuff(value, self.owner)
  423 + end
352 end 424 end
353 --6=给自己加一個被動技能 425 --6=给自己加一個被動技能
354 function Passive:effect6(value) 426 function Passive:effect6(value)
@@ -362,4 +434,31 @@ function Passive:effect7(value) @@ -362,4 +434,31 @@ function Passive:effect7(value)
362 end 434 end
363 end 435 end
364 436
  437 +--8=获得drop,直接进入背包
  438 +function Passive:effect8(dropId)
  439 + local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true)
  440 + self.owner.battle.adv:award({[item[1]] = item[2]})
  441 +end
  442 +
  443 +--9=直接获得item(可在结算触发时使用)
  444 +function Passive:effect9(itemId, triggerPms, ratio, max)
  445 + local cond = nil
  446 + if self.passiveData.value == 0 then
  447 + cond = triggerPms.score
  448 + elseif self.passiveData.value == 1 then
  449 + cond = triggerPms.level
  450 + else
  451 + return
  452 + end
  453 + if not cond then return end
  454 + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))})
  455 +end
  456 +
  457 +--10=战斗额外掉落次数
  458 +function Passive:effect10(itemId, triggerPms, count)
  459 + if triggerPms.count then
  460 + self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count})
  461 + end
  462 +end
  463 +
365 return Passive 464 return Passive
366 \ No newline at end of file 465 \ No newline at end of file
src/adv/AdvPlayer.lua
@@ -140,9 +140,11 @@ function BaseObject:addBuff(buffId, releaser) @@ -140,9 +140,11 @@ function BaseObject:addBuff(buffId, releaser)
140 if not Buff.checkKeep({ 140 if not Buff.checkKeep({
141 owner = self, 141 owner = self,
142 buffData = buffData, 142 buffData = buffData,
  143 + releaseId = releaser.monsterId
143 }) then return end 144 }) then return end
144 table.insert(self.buffs, Buff.create(self, releaser, {id = buffId})) 145 table.insert(self.buffs, Buff.create(self, releaser, {id = buffId}))
145 end 146 end
  147 + self:triggerPassive(Passive.GET_BUFF, {buffId = buffId})
146 self.battle.adv:backBuff(self.id, buffId) 148 self.battle.adv:backBuff(self.id, buffId)
147 end 149 end
148 150
@@ -168,7 +170,6 @@ end @@ -168,7 +170,6 @@ end
168 function BaseObject:delPassiveById(pId) 170 function BaseObject:delPassiveById(pId)
169 for idx, passive in ipairs(self.passives) do 171 for idx, passive in ipairs(self.passives) do
170 if passive.id == pId then 172 if passive.id == pId then
171 - passive:endPassive()  
172 table.remove(self.passives, idx) 173 table.remove(self.passives, idx)
173 return passive 174 return passive
174 end 175 end
@@ -239,11 +240,16 @@ end @@ -239,11 +240,16 @@ end
239 240
240 -- buff 增益 检疫 241 -- buff 增益 检疫
241 function BaseObject:getBuffEffectChange(classify) 242 function BaseObject:getBuffEffectChange(classify)
  243 + local classifys = classify:toArray(true, " ")
  244 + local had = {}
  245 + for _, one in pairs(classifys) do
  246 + had[one] = 1
  247 + end
242 local effect = 0 248 local effect = 0
243 for _, buff in ipairs(self.buffs) do 249 for _, buff in ipairs(self.buffs) do
244 if not buff.isDel and buff:getType() == Buff_EFFECT_CHANGE then 250 if not buff.isDel and buff:getType() == Buff_EFFECT_CHANGE then
245 local cType, value = buff:effect() 251 local cType, value = buff:effect()
246 - if cType and cType == classify then 252 + if cType and had[cType] then
247 effect = effect + value 253 effect = effect + value
248 end 254 end
249 end 255 end
@@ -298,7 +304,7 @@ function BaseObject:reSetHpMax() @@ -298,7 +304,7 @@ function BaseObject:reSetHpMax()
298 end 304 end
299 end 305 end
300 local effect = self:getAttrBuffChange("hp") 306 local effect = self:getAttrBuffChange("hp")
301 - self.hpMax = (self.hpMax + effect[0]) * (1 + effect[1])) 307 + self.hpMax = (self.hpMax + effect[0]) * (1 + effect[1])
302 self.hpMax = math.ceil(math.max(1, self.hpMax)) 308 self.hpMax = math.ceil(math.max(1, self.hpMax))
303 self.hp = math.min(self.hpMax, self.hp) 309 self.hp = math.min(self.hpMax, self.hp)
304 end 310 end
@@ -321,22 +327,26 @@ end @@ -321,22 +327,26 @@ end
321 function BaseObject:hurt(value, releaser, params) 327 function BaseObject:hurt(value, releaser, params)
322 params = params or {} 328 params = params or {}
323 if params.hurtType and params.hurtType == 1 then 329 if params.hurtType and params.hurtType == 1 then
324 - releaser:triggerPassive(Passive.SELF_ATK)  
325 - for _, team in ipairs(releaser:getTeam(1, true)) do  
326 - team:triggerPassive(Passive.TEAM_ATK)  
327 - end  
328 - if self:hadBuff(Buff.IMMNUE_ATK) then return end --无视普通攻击 330 + -- releaser:triggerPassive(Passive.SELF_ATK)
  331 + -- for _, team in ipairs(releaser:getTeam(1, true)) do
  332 + -- team:triggerPassive(Passive.TEAM_ATK)
  333 + -- end
  334 + -- if self:hadBuff(Buff.IMMNUE_ATK) then return end --无视普通攻击
329 335
330 - local hit = releaser.hit - self.miss --命中率  
331 - if hit < math.randomInt(1, 100) then --miss  
332 - self.battle.adv:backMiss(self.id)  
333 - return  
334 - end  
335 - self:triggerPassive(Passive.SELF_HURT, {trigger = releaser}) 336 + -- local hit = releaser.hit - self.miss --命中率
  337 + -- if hit < math.randomInt(1, 100) then --miss
  338 + -- self.battle.adv:backMiss(self.id)
  339 + -- return
  340 + -- end
  341 + end
  342 +
  343 + if params.hurtType and (params.hurtType == 2 or params.hurtType == 6) then
  344 + self:triggerPassive(Passive.SELF_HURT, {trigger = releaser, buffId = params.buffId})
336 for _, team in ipairs(self:getTeam(1, true)) do 345 for _, team in ipairs(self:getTeam(1, true)) do
337 - team:triggerPassive(Passive.TEAM_HURT, {trigger = releaser}) 346 + team:triggerPassive(Passive.TEAM_HURT, {trigger = releaser, buffId = params.buffId})
338 end 347 end
339 end 348 end
  349 +
340 if params.hurtType ~= 5 and params.hurtType ~= 6 then 350 if params.hurtType ~= 5 and params.hurtType ~= 6 then
341 if not params.hurtType or params.hurtType ~= 4 then 351 if not params.hurtType or params.hurtType ~= 4 then
342 value = self:getInjuredValue(value) --减伤计算 352 value = self:getInjuredValue(value) --减伤计算
src/models/RolePlugin.lua
@@ -701,9 +701,9 @@ function RolePlugin.bind(Role) @@ -701,9 +701,9 @@ function RolePlugin.bind(Role)
701 701
702 if curData.unlock == 1 then -- 获得解锁 702 if curData.unlock == 1 then -- 获得解锁
703 return self:getProperty("advAFOpen")[id] and true or false 703 return self:getProperty("advAFOpen")[id] and true or false
704 - elseif temp[1].unlock == 2 then -- 特殊神器 不可解锁 704 + elseif curData.unlock == 2 then -- 特殊神器 不可解锁
705 return isCheckLevel 705 return isCheckLevel
706 - elseif temp[1].unlock == 3 then 706 + elseif curData.unlock == 3 then
707 return isEndless 707 return isEndless
708 end 708 end
709 return true 709 return true