Commit d3da3368ff132964721b07865ae706319111d6e7
1 parent
98761edc
冒险地图被动技, buff 神器
Showing
10 changed files
with
247 additions
and
78 deletions
Show diff stats
src/actions/AdvAction.lua
| ... | ... | @@ -366,12 +366,12 @@ function _M.wearArtifactRpc(agent, data) |
| 366 | 366 | |
| 367 | 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 | 373 | local status = adv:wearArtifact(slot, id) |
| 374 | - if not status then return end | |
| 374 | + if not status then return 4 end | |
| 375 | 375 | adv:saveDB() |
| 376 | 376 | |
| 377 | 377 | SendPacket(actionCodes.Adv_wearArtifactRpc, '') |
| ... | ... | @@ -385,14 +385,15 @@ function _M.upArtifactRpc(agent, data) |
| 385 | 385 | local id = msg.id |
| 386 | 386 | |
| 387 | 387 | local adv = role:getAdvData() |
| 388 | + if adv:isWaitChooseArtifact() then return 1 end | |
| 388 | 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 | 395 | local status = adv:artifactLevelUp(id) |
| 395 | - if not status then return end | |
| 396 | + if not status then return 5 end | |
| 396 | 397 | adv:cost(cost, {}) |
| 397 | 398 | |
| 398 | 399 | if status == 1 then -- 现在穿着呢。更新下 |
| ... | ... | @@ -449,6 +450,7 @@ function _M.endBattleRpc(agent, data) |
| 449 | 450 | local enemyId = msg.enemyId |
| 450 | 451 | local key = msg.key |
| 451 | 452 | local player = msg.player |
| 453 | + local bySkill = msg.bySkill --死于 技能 | |
| 452 | 454 | |
| 453 | 455 | if not player or not player.hp or not player.sp or not enemyId or not key then return end |
| 454 | 456 | local adv = role:getAdvData() |
| ... | ... | @@ -461,7 +463,7 @@ function _M.endBattleRpc(agent, data) |
| 461 | 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 | 467 | if not status then return end |
| 466 | 468 | SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()})) |
| 467 | 469 | return true | ... | ... |
src/actions/GmAction.lua
| ... | ... | @@ -290,17 +290,28 @@ function _M.idlec(role, pms) |
| 290 | 290 | return "成功" |
| 291 | 291 | end |
| 292 | 292 | |
| 293 | -table.insert(helpDes, {"获取冒险内道具", "advit"}) | |
| 293 | +table.insert(helpDes, {"冒险内可使用道具", "advit", "ALL"}) | |
| 294 | +table.insert(helpDes, {"冒险内消耗道具", "advit", "itemId", "count"}) | |
| 294 | 295 | function _M.advit(role, pms) |
| 295 | 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 | 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 | 312 | end |
| 301 | - for k , v in pairs(csvdb["adv_artifactCsv"]) do | |
| 302 | - reward[k] = 1 | |
| 303 | - end | |
| 313 | + | |
| 314 | + | |
| 304 | 315 | local adv = role:getAdvData() |
| 305 | 316 | adv:award(reward) |
| 306 | 317 | return "成功" | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -273,18 +273,17 @@ function Adv:waitChooseArtifact() |
| 273 | 273 | table.insert(pool, id) |
| 274 | 274 | end |
| 275 | 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 | 280 | local idx = math.randomInt(1, #pool) |
| 282 | 281 | table.insert(chooses, pool[idx]) |
| 283 | 282 | table.remove(pool, idx) |
| 284 | 283 | end |
| 284 | + self.waitArtifact = chooses | |
| 285 | + self:backChooseArtifact() | |
| 285 | 286 | end |
| 286 | - self.waitArtifact = chooses | |
| 287 | - self:backChooseArtifact() | |
| 288 | 287 | end |
| 289 | 288 | |
| 290 | 289 | function Adv:isWaitChooseArtifact() |
| ... | ... | @@ -293,9 +292,8 @@ end |
| 293 | 292 | |
| 294 | 293 | function Adv:chooseArtifact(index) |
| 295 | 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 | 297 | return true |
| 300 | 298 | end |
| 301 | 299 | |
| ... | ... | @@ -308,6 +306,7 @@ function Adv:over(success, isAllPass) |
| 308 | 306 | local score = self:getScore() |
| 309 | 307 | local scoreInfo = self.score |
| 310 | 308 | local reward |
| 309 | + self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) | |
| 311 | 310 | if success then |
| 312 | 311 | reward = self.owner:award(self.owner:getProperty("advItems"):toNumMap()) |
| 313 | 312 | self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) |
| ... | ... | @@ -391,7 +390,7 @@ function Adv:award(gift, params) |
| 391 | 390 | for itemId, count in pairs(tgift) do |
| 392 | 391 | if count > 0 then |
| 393 | 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 | 394 | self:scoreChange(AdvScoreType.Item, {itemId, count}) |
| 396 | 395 | self:checkTask(Adv.TaskType.Item, count, itemId) |
| 397 | 396 | self:checkAchievement(Adv.AchievType.GetItem, count, itemId) |
| ... | ... | @@ -473,6 +472,7 @@ local function clickOut(self, room, block, params) |
| 473 | 472 | if params.relay or (not self:isEndless() and (self.level >= levellimit or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1))) then --关卡结束 |
| 474 | 473 | self:over(true, not self:isEndless() and self.level >= levellimit) |
| 475 | 474 | else |
| 475 | + self.battle.player:triggerPassive(Passive.DOWN_LAYER) | |
| 476 | 476 | self:initByChapter(self.chapterId, self.level + 1, true, true) |
| 477 | 477 | self:backNext() --下一关 |
| 478 | 478 | end |
| ... | ... | @@ -616,6 +616,7 @@ end |
| 616 | 616 | local function clickDrop(self, room, block, params) |
| 617 | 617 | local reward = {} |
| 618 | 618 | if not block.event.item then return end |
| 619 | + self.battle.player:triggerPassive(Passive.CLICK_DROP) | |
| 619 | 620 | local reward = self:award({[block.event.item[1]] = block.event.item[2]}) |
| 620 | 621 | -- local reward = self:award({[5801] = 1}) |
| 621 | 622 | block:clear() |
| ... | ... | @@ -763,7 +764,7 @@ function Adv:clickBlock(roomId, blockId, params) |
| 763 | 764 | end |
| 764 | 765 | end |
| 765 | 766 | if canOpen and not hadMonster then --开放 |
| 766 | - room:openBlock(block) | |
| 767 | + self:getCurMap():openBlock(roomId, blockId, true) | |
| 767 | 768 | status = true |
| 768 | 769 | end |
| 769 | 770 | else |
| ... | ... | @@ -1022,6 +1023,7 @@ function Adv:enemyDead(enemy, escape) |
| 1022 | 1023 | etype = AdvEventType.Click, |
| 1023 | 1024 | id = clickId |
| 1024 | 1025 | }) |
| 1026 | + self.battle.player:triggerPassive(Passive.BATTLE_WIN) | |
| 1025 | 1027 | else |
| 1026 | 1028 | local item = block.event.item |
| 1027 | 1029 | if not item then |
| ... | ... | @@ -1036,11 +1038,13 @@ function Adv:enemyDead(enemy, escape) |
| 1036 | 1038 | end |
| 1037 | 1039 | if item[1] == 0 then |
| 1038 | 1040 | block:clear() |
| 1041 | + self.battle.player:triggerPassive(Passive.BATTLE_WIN) | |
| 1039 | 1042 | else |
| 1040 | 1043 | block:updateEvent({ |
| 1041 | 1044 | etype = AdvEventType.Drop, |
| 1042 | 1045 | item = item |
| 1043 | 1046 | }) |
| 1047 | + self.battle.player:triggerPassive(Passive.BATTLE_WIN, {count = item[2]}) | |
| 1044 | 1048 | end |
| 1045 | 1049 | end |
| 1046 | 1050 | self:checkTask(Adv.TaskType.Kill, 1, enemyId) | ... | ... |
src/adv/AdvBattle.lua
| ... | ... | @@ -196,6 +196,8 @@ function Battle:afterRound() |
| 196 | 196 | end |
| 197 | 197 | end |
| 198 | 198 | |
| 199 | + self.player:triggerPassive(Passive.AFTER_ROUND) | |
| 200 | + | |
| 199 | 201 | if self.player.isDead then |
| 200 | 202 | self.adv:over(false) |
| 201 | 203 | end |
| ... | ... | @@ -212,6 +214,9 @@ function Battle:battleBegin(roomId, blockId, params) |
| 212 | 214 | self.player:effectBattleBuff() |
| 213 | 215 | |
| 214 | 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 | 220 | end |
| 216 | 221 | if player.hp > self.player.hp then |
| 217 | 222 | self.player:recover(player.hp - self.player.hp, player) | ... | ... |
src/adv/AdvBlock.lua
| ... | ... | @@ -54,6 +54,11 @@ function Block:randomEvent() |
| 54 | 54 | enemy = adv.battle:addEnemy(room, self, map.mapIdx) |
| 55 | 55 | end |
| 56 | 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 | 62 | end |
| 58 | 63 | randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] |
| 59 | 64 | --掉落 |
| ... | ... | @@ -107,6 +112,7 @@ function Block:randomEvent() |
| 107 | 112 | self.room.map.adv:mapItemChange(effect[2]) |
| 108 | 113 | end |
| 109 | 114 | end |
| 115 | + adv.battle.player:triggerPassive(Passive.CLICK_TRAP) | |
| 110 | 116 | adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id) |
| 111 | 117 | adv:backTrap() |
| 112 | 118 | self:clear() |
| ... | ... | @@ -130,6 +136,7 @@ function Block:open() |
| 130 | 136 | self:randomEvent() |
| 131 | 137 | adv.owner:checkTaskEnter("AdvOpenBlock") |
| 132 | 138 | self.isOpen = true |
| 139 | + return true | |
| 133 | 140 | end |
| 134 | 141 | |
| 135 | 142 | return Block |
| 136 | 143 | \ No newline at end of file | ... | ... |
src/adv/AdvBuff.lua
| ... | ... | @@ -65,7 +65,7 @@ local function commonAttCond(_Buff, attrName) |
| 65 | 65 | self._changeV = self._changeV - self._changeV / (self.layer + 1) |
| 66 | 66 | self:_reSetAttr() |
| 67 | 67 | end |
| 68 | - | |
| 68 | + | |
| 69 | 69 | _Buff._hpChange = function(self) |
| 70 | 70 | local oldHpMax = self.owner.hpMax |
| 71 | 71 | self.owner:reSetHpMax() |
| ... | ... | @@ -268,7 +268,7 @@ local BuffFactory = { |
| 268 | 268 | [Buff.OPEN_BLOCK] = function(_Buff) |
| 269 | 269 | _Buff._afterRound = function(self) |
| 270 | 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 | 272 | end |
| 273 | 273 | _Buff._effectValue = function(self) |
| 274 | 274 | -- 数量 |
| ... | ... | @@ -345,7 +345,7 @@ local BuffFactory = { |
| 345 | 345 | _Buff._init = function(self) |
| 346 | 346 | -- 先给自己的buff 搞一下子 |
| 347 | 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 | 349 | buff:effectChange() |
| 350 | 350 | end |
| 351 | 351 | end |
| ... | ... | @@ -388,6 +388,7 @@ function Buff:ctor(owner, id) |
| 388 | 388 | self.round = 0 --剩余的回合 |
| 389 | 389 | self.count = -1 -- 可生效的次数 -1 无次数限制 |
| 390 | 390 | self.layer = 1 -- 当前buff 层数 |
| 391 | + self.releaseId = nil -- 释放的怪物Id | |
| 391 | 392 | |
| 392 | 393 | if BuffFactory[self.buffData.type] then |
| 393 | 394 | BuffFactory[self.buffData.type](self) |
| ... | ... | @@ -408,6 +409,7 @@ end |
| 408 | 409 | |
| 409 | 410 | function Buff:initNew(release, data) |
| 410 | 411 | self.release = release or self.owner |
| 412 | + self.releaseId = self.release.monsterId or 0 | |
| 411 | 413 | self.round = self.buffData.round |
| 412 | 414 | self.roundSpace = 0 --生效间隔 |
| 413 | 415 | self.layer = 1 |
| ... | ... | @@ -427,6 +429,7 @@ function Buff:initByDB(data) |
| 427 | 429 | self.release = self.owner.battle:getEnemyById(data.rele) |
| 428 | 430 | end |
| 429 | 431 | end |
| 432 | + self.releaseId = data.releId | |
| 430 | 433 | self.round = data.round |
| 431 | 434 | self.roundSpace = data.roundSp |
| 432 | 435 | if data.count then |
| ... | ... | @@ -462,7 +465,7 @@ function Buff:afterRound() |
| 462 | 465 | self:decRound() |
| 463 | 466 | end |
| 464 | 467 | |
| 465 | --- 只使用owner 和 buffData | |
| 468 | +-- 只使用owner 和 buffData 和 releaseId | |
| 466 | 469 | function Buff:checkKeep() |
| 467 | 470 | if self.buffData.keepTerm == "" then return true end |
| 468 | 471 | --[[ |
| ... | ... | @@ -473,10 +476,10 @@ function Buff:checkKeep() |
| 473 | 476 | --]] |
| 474 | 477 | |
| 475 | 478 | local checkFunc = {} |
| 476 | - checkFunc[1] = function(_, enemyId) | |
| 479 | + checkFunc[1] = function(_) | |
| 477 | 480 | local enemys = self.owner.battle.player:getTeam(2) |
| 478 | 481 | for _, enemy in pairs(enemys) do |
| 479 | - if enemy.monsterId == enemyId then | |
| 482 | + if enemy.monsterId == self.releaseId then | |
| 480 | 483 | return true |
| 481 | 484 | end |
| 482 | 485 | end |
| ... | ... | @@ -621,7 +624,7 @@ function Buff:effectChange() |
| 621 | 624 | end |
| 622 | 625 | |
| 623 | 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 | 628 | local change = self.owner:getBuffEffectChange(self.buffData.classify) |
| 626 | 629 | return effect * (1 + change) |
| 627 | 630 | end |
| ... | ... | @@ -643,6 +646,9 @@ function Buff:getDB() |
| 643 | 646 | db.count = self.count |
| 644 | 647 | end |
| 645 | 648 | db.layer = self.layer |
| 649 | + if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then | |
| 650 | + db.releId = self.releaseId | |
| 651 | + end | |
| 646 | 652 | return db |
| 647 | 653 | end |
| 648 | 654 | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where) |
| 100 | 100 | end |
| 101 | 101 | |
| 102 | 102 | -- 随机翻开 num 个 以开放的房间的 地块 |
| 103 | -function Map:openBlockRand(num) | |
| 103 | +function Map:openBlockRand(num, isPlayer) | |
| 104 | 104 | local pool = {} |
| 105 | 105 | for _, room in pairs(self.rooms) do |
| 106 | 106 | if room.isShow and not room.isPath then |
| ... | ... | @@ -113,12 +113,12 @@ function Map:openBlockRand(num) |
| 113 | 113 | end |
| 114 | 114 | if #pool <= num then |
| 115 | 115 | for _, temp in ipairs(pool) do |
| 116 | - self:openBlock(temp[1], temp[2]) | |
| 116 | + self:openBlock(temp[1], temp[2], isPlayer) | |
| 117 | 117 | end |
| 118 | 118 | else |
| 119 | 119 | for i = 1, num do |
| 120 | 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 | 122 | table.remove(pool, idx) |
| 123 | 123 | end |
| 124 | 124 | 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 | 130 | local room = self.rooms[roomId] |
| 131 | 131 | if not room then return end |
| 132 | 132 | local block = room.blocks[blockId] |
| 133 | 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 | 138 | self:backBlockChange(roomId, blockId) |
| 136 | 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 | 164 | --获取,某个位置上的 room 和 block |
| 140 | 165 | function Map:getRBByPos(c, r) | ... | ... |
src/adv/AdvPassive.lua
| ... | ... | @@ -89,10 +89,10 @@ Passive.HP_LOW_SELF = 5 --自身生命值<N%时,每回合触发 |
| 89 | 89 | Passive.HP_LOW_TEAM = 6 --敌人生命值<N%时,每回合触发 |
| 90 | 90 | Passive.HP_UP_SELF = 7 --自身生命值>N%时,每回合触发 |
| 91 | 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 | 96 | Passive.MONSTER_COUNT_UP = 13 --场上存在N个以上怪物,每回合触发 |
| 97 | 97 | Passive.MONSTER_COUNT_LOW = 14 --场上存在N个以下怪物,每回合触发 |
| 98 | 98 | Passive.SELF_DEAD = 15 --自身死亡后,触发1次 |
| ... | ... | @@ -100,6 +100,18 @@ Passive.TEAM_DEAD = 16 --队友死亡后,触发1次 |
| 100 | 100 | Passive.TARGET_SKILL = 17 --目标每使用N次技能,触发1次 |
| 101 | 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 | 117 | local PassiveCondFactory = {} |
| ... | ... | @@ -122,21 +134,63 @@ end |
| 122 | 134 | |
| 123 | 135 | PassiveCondFactory[Passive.HURT_PERCENT_TEAM] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 |
| 124 | 136 | PassiveCondFactory[Passive.SELF_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 |
| 125 | -PassiveCondFactory[Passive.SELF_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 | |
| 126 | 137 | PassiveCondFactory[Passive.TEAM_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 |
| 127 | -PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 | |
| 128 | 138 | PassiveCondFactory[Passive.TARGET_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 |
| 129 | 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 | 157 | PassiveCondFactory[Passive.ROOM_SHOW] = function(_Passive) |
| 132 | 158 | _Passive._trigger = function(self, params) |
| 133 | 159 | local roomId = params.roomId |
| 134 | - if self.roomId == roomId then | |
| 160 | + if self.owner.roomId == roomId then | |
| 135 | 161 | return true |
| 136 | 162 | end |
| 137 | 163 | end |
| 138 | 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 | 194 | PassiveCondFactory[Passive.HP_LOW_SELF] = function(_Passive) |
| 141 | 195 | _Passive._afterRound = function(self) |
| 142 | 196 | if self.owner.hp / self.owner.hpMax * 100 < self.passiveData.value then |
| ... | ... | @@ -242,12 +296,16 @@ function Passive:canEffect(effType, effValue) |
| 242 | 296 | return true |
| 243 | 297 | end |
| 244 | 298 | |
| 245 | -function Passive:effect(trigger) | |
| 299 | +function Passive:effect(triggerPms) | |
| 246 | 300 | for _, effect in pairs(self.effects) do |
| 247 | 301 | local effType = effect[1] |
| 248 | 302 | local effValue = effect[2] |
| 303 | + local otherPms = {} | |
| 304 | + for i = 3, #effect do | |
| 305 | + table.insert(otherPms, effect[i]) | |
| 306 | + end | |
| 249 | 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 | 309 | end |
| 252 | 310 | end |
| 253 | 311 | |
| ... | ... | @@ -296,7 +354,7 @@ function Passive:trigger(condType, params) --触发检查 |
| 296 | 354 | if self.round > 0 and self.turn > 0 then -- cd |
| 297 | 355 | return |
| 298 | 356 | end |
| 299 | - self:effect(params.trigger) | |
| 357 | + self:effect(params) | |
| 300 | 358 | end |
| 301 | 359 | |
| 302 | 360 | function Passive:filter(params) |
| ... | ... | @@ -330,25 +388,39 @@ function Passive:effect1(value) |
| 330 | 388 | self.owner:addBuff(value, self.owner) |
| 331 | 389 | end |
| 332 | 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 | 394 | end |
| 337 | 395 | end |
| 338 | 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 | 407 | end |
| 342 | 408 | --4=逃跑 |
| 343 | 409 | function Passive:effect4() |
| 344 | 410 | self.owner.isDead = 1 --跑了 |
| 345 | - -- self.owner.battle.adv:enemyDead(self.owner, true) | |
| 346 | 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 | 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 | 424 | end |
| 353 | 425 | --6=给自己加一個被動技能 |
| 354 | 426 | function Passive:effect6(value) |
| ... | ... | @@ -362,4 +434,31 @@ function Passive:effect7(value) |
| 362 | 434 | end |
| 363 | 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 | 464 | return Passive |
| 366 | 465 | \ No newline at end of file | ... | ... |
src/adv/AdvPlayer.lua
| ... | ... | @@ -140,9 +140,11 @@ function BaseObject:addBuff(buffId, releaser) |
| 140 | 140 | if not Buff.checkKeep({ |
| 141 | 141 | owner = self, |
| 142 | 142 | buffData = buffData, |
| 143 | + releaseId = releaser.monsterId | |
| 143 | 144 | }) then return end |
| 144 | 145 | table.insert(self.buffs, Buff.create(self, releaser, {id = buffId})) |
| 145 | 146 | end |
| 147 | + self:triggerPassive(Passive.GET_BUFF, {buffId = buffId}) | |
| 146 | 148 | self.battle.adv:backBuff(self.id, buffId) |
| 147 | 149 | end |
| 148 | 150 | |
| ... | ... | @@ -168,7 +170,6 @@ end |
| 168 | 170 | function BaseObject:delPassiveById(pId) |
| 169 | 171 | for idx, passive in ipairs(self.passives) do |
| 170 | 172 | if passive.id == pId then |
| 171 | - passive:endPassive() | |
| 172 | 173 | table.remove(self.passives, idx) |
| 173 | 174 | return passive |
| 174 | 175 | end |
| ... | ... | @@ -239,11 +240,16 @@ end |
| 239 | 240 | |
| 240 | 241 | -- buff 增益 检疫 |
| 241 | 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 | 248 | local effect = 0 |
| 243 | 249 | for _, buff in ipairs(self.buffs) do |
| 244 | 250 | if not buff.isDel and buff:getType() == Buff_EFFECT_CHANGE then |
| 245 | 251 | local cType, value = buff:effect() |
| 246 | - if cType and cType == classify then | |
| 252 | + if cType and had[cType] then | |
| 247 | 253 | effect = effect + value |
| 248 | 254 | end |
| 249 | 255 | end |
| ... | ... | @@ -298,7 +304,7 @@ function BaseObject:reSetHpMax() |
| 298 | 304 | end |
| 299 | 305 | end |
| 300 | 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 | 308 | self.hpMax = math.ceil(math.max(1, self.hpMax)) |
| 303 | 309 | self.hp = math.min(self.hpMax, self.hp) |
| 304 | 310 | end |
| ... | ... | @@ -321,22 +327,26 @@ end |
| 321 | 327 | function BaseObject:hurt(value, releaser, params) |
| 322 | 328 | params = params or {} |
| 323 | 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 | 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 | 347 | end |
| 339 | 348 | end |
| 349 | + | |
| 340 | 350 | if params.hurtType ~= 5 and params.hurtType ~= 6 then |
| 341 | 351 | if not params.hurtType or params.hurtType ~= 4 then |
| 342 | 352 | value = self:getInjuredValue(value) --减伤计算 | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -701,9 +701,9 @@ function RolePlugin.bind(Role) |
| 701 | 701 | |
| 702 | 702 | if curData.unlock == 1 then -- 获得解锁 |
| 703 | 703 | return self:getProperty("advAFOpen")[id] and true or false |
| 704 | - elseif temp[1].unlock == 2 then -- 特殊神器 不可解锁 | |
| 704 | + elseif curData.unlock == 2 then -- 特殊神器 不可解锁 | |
| 705 | 705 | return isCheckLevel |
| 706 | - elseif temp[1].unlock == 3 then | |
| 706 | + elseif curData.unlock == 3 then | |
| 707 | 707 | return isEndless |
| 708 | 708 | end |
| 709 | 709 | return true | ... | ... |