Commit 1e7896240ae1d42323d7d434eb9a496001b95768
1 parent
a95b35ce
新的 buff 效果
Showing
5 changed files
with
133 additions
and
28 deletions
Show diff stats
src/adv/AdvBlock.lua
... | ... | @@ -48,6 +48,8 @@ function Block:updateEvent(event, isInit) |
48 | 48 | end |
49 | 49 | end |
50 | 50 | end |
51 | + local oldet = self:getEventType() | |
52 | + | |
51 | 53 | self.event = event |
52 | 54 | if not isInit and self.event then |
53 | 55 | -- 判断下类型是不是错的 |
... | ... | @@ -59,18 +61,48 @@ function Block:updateEvent(event, isInit) |
59 | 61 | self:randomEvent() |
60 | 62 | end |
61 | 63 | self:quickDrop() |
64 | + | |
65 | + if not isInit and self.isOpen then | |
66 | + local newet = self:getEventType() | |
67 | + if oldet ~= newet then | |
68 | + local em = {} | |
69 | + if oldet then | |
70 | + em[oldet] =1 | |
71 | + end | |
72 | + if newet then | |
73 | + em[oldet] =1 | |
74 | + end | |
75 | + | |
76 | + local player = self.room.map.adv.battle.player | |
77 | + player:attrChangeCondBuffCheck(4, em) | |
78 | + for _, monster in pairs(player:getTeam(2)) do | |
79 | + monster:attrChangeCondBuffCheck(4, em) | |
80 | + end | |
81 | + end | |
82 | + end | |
62 | 83 | end |
63 | 84 | |
64 | 85 | function Block:clear() |
65 | - if self:getEventType() == AdvEventType.Trap then | |
86 | + local et = self:getEventType() | |
87 | + if et == AdvEventType.Trap then | |
66 | 88 | self.trapId = self.event.id |
67 | - elseif self:getEventType() == AdvEventType.Build then | |
89 | + elseif et == AdvEventType.Build then | |
68 | 90 | local build = self.room.map.adv.battle:getBuild(self.room.roomId, self.blockId, self.room.map.mapIdx) |
69 | 91 | if build then |
70 | 92 | build.isDead = true |
71 | 93 | end |
72 | 94 | end |
73 | 95 | self.event = nil |
96 | + | |
97 | + | |
98 | + if et then | |
99 | + local em = {[et] = 1} | |
100 | + local player = self.room.map.adv.battle.player | |
101 | + player:attrChangeCondBuffCheck(4, em) | |
102 | + for _, monster in pairs(player:getTeam(2)) do | |
103 | + monster:attrChangeCondBuffCheck(4, em) | |
104 | + end | |
105 | + end | |
74 | 106 | end |
75 | 107 | |
76 | 108 | |
... | ... | @@ -91,8 +123,10 @@ function Block:randomEvent() |
91 | 123 | enemy:triggerPassive(Passive.BORN_ONCE) |
92 | 124 | |
93 | 125 | adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) |
126 | + adv.battle.player:attrChangeCondBuffCheck(3, enemy:getClassify()) | |
94 | 127 | for _, monster in pairs(adv.battle.player:getTeam(2)) do |
95 | - adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) | |
128 | + monster:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) | |
129 | + monster:attrChangeCondBuffCheck(3, enemy:getClassify()) | |
96 | 130 | end |
97 | 131 | end |
98 | 132 | randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] |
... | ... | @@ -272,6 +306,16 @@ function Block:open() |
272 | 306 | self.isOpen = true |
273 | 307 | self:randomEvent() |
274 | 308 | self:quickDrop() |
309 | + | |
310 | + local et = self:getEventType() | |
311 | + if et then | |
312 | + local em = {[et] = 1} | |
313 | + local player = self.room.map.adv.battle.player | |
314 | + player:attrChangeCondBuffCheck(4, em) | |
315 | + for _, monster in pairs(player:getTeam(2)) do | |
316 | + monster:attrChangeCondBuffCheck(4, em) | |
317 | + end | |
318 | + end | |
275 | 319 | return true |
276 | 320 | end |
277 | 321 | ... | ... |
src/adv/AdvBuff.lua
... | ... | @@ -89,13 +89,24 @@ local function commonAttCond(_Buff, attrName) |
89 | 89 | if buff then |
90 | 90 | effectCount = buff.layer |
91 | 91 | end |
92 | + elseif self.buffData.effectValue4 == 3 then | |
93 | + local classify = tonumber(self.buffData.effectValue5) -- 怪标签 | |
94 | + local enemy = self.owner.battle.player:getTeam(2) | |
95 | + for _, one in pairs(enemy) do | |
96 | + if one.isClassify and one:isClassify(classify) then | |
97 | + effectCount = effectCount + 1 | |
98 | + end | |
99 | + end | |
100 | + elseif self.buffData.effectValue4 == 4 then | |
101 | + local eventType = tonumber(self.buffData.effectValue5) -- event 类型 | |
102 | + effectCount = #self.owner.battle.adv:getCurMap():getEventTypeAllMap(eventType) | |
92 | 103 | end |
93 | 104 | return self.buffData.effectValue2 * effectCount |
94 | 105 | end |
95 | 106 | |
96 | 107 | _Buff.getEffectBy = function(self) |
97 | 108 | local cond = nil |
98 | - if self.buffData.effectValue4 == 2 then | |
109 | + if self.buffData.effectValue4 == 2 or self.buffData.effectValue4 == 3 or self.buffData.effectValue4 == 4 then | |
99 | 110 | cond = tonumber(self.buffData.effectValue5) |
100 | 111 | end |
101 | 112 | return self.buffData.effectValue4, attrName, cond | ... | ... |
src/adv/AdvMap.lua
... | ... | @@ -463,6 +463,18 @@ function Map:getEnemysBySize(roomId, blockId, size) |
463 | 463 | return enemys |
464 | 464 | end |
465 | 465 | |
466 | +function Map:getEventTypeAllMap(eventType) | |
467 | + local blocks = {} | |
468 | + if not eventType then return blocks end | |
469 | + for roomId, room in pairs(self.rooms) do | |
470 | + for blockId, block in pairs(room.blocks) do | |
471 | + if block.isOpen and block:getEventType() == eventType then | |
472 | + table.insert(blocks, block) | |
473 | + end | |
474 | + end | |
475 | + end | |
476 | + return blocks | |
477 | +end | |
466 | 478 | -----------------------------随机地图----------------------------- |
467 | 479 | |
468 | 480 | -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入 | ... | ... |
src/adv/AdvPassive.lua
... | ... | @@ -60,9 +60,7 @@ end |
60 | 60 | |
61 | 61 | FilterFactory[Filter.CLASSIFY] = function (_Filter) |
62 | 62 | _Filter._execute = function (self, target) |
63 | - if not target.monsterId then return end | |
64 | - local classify = csvdb["event_monsterCsv"][target.monsterId].classify | |
65 | - return classify and classify:sismember(self.value, " ") | |
63 | + return target.isClassify and target:isClassify(self.value) | |
66 | 64 | end |
67 | 65 | end |
68 | 66 | ... | ... |
src/adv/AdvPlayer.lua
... | ... | @@ -165,6 +165,7 @@ function BaseObject:addBuff(buffId, releaser) |
165 | 165 | end |
166 | 166 | self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) |
167 | 167 | self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) |
168 | + self:attrChangeCondBuffCheck(2, buffId) | |
168 | 169 | return true |
169 | 170 | end |
170 | 171 | |
... | ... | @@ -424,6 +425,12 @@ function BaseObject:hurt(value, releaser, params) |
424 | 425 | self.battle.adv:checkAchievement(self.battle.adv.AchievType.KillByBuff, 1, params.buffId) |
425 | 426 | end |
426 | 427 | self.isDead = true |
428 | + if self:is("Enemy") then | |
429 | + self.battle.player:attrChangeCondBuffCheck(3, self:getClassify()) | |
430 | + for _, monster in pairs(self.battle.player:getTeam(2)) do | |
431 | + monster:attrChangeCondBuffCheck(3, self:getClassify()) | |
432 | + end | |
433 | + end | |
427 | 434 | end |
428 | 435 | self:triggerPassive(Passive.HURT_PERCENT_SELF, {value = value / self.hpMax}) |
429 | 436 | for _, team in ipairs(self:getTeam(1, true)) do |
... | ... | @@ -505,6 +512,50 @@ function BaseObject:getTeam(nType, noSelf, mapIdx, includeLock) |
505 | 512 | return team |
506 | 513 | end |
507 | 514 | |
515 | +function BaseObject:attrChangeCondBuffCheck(etype, cond) | |
516 | + local effect = {} | |
517 | + if etype == 3 then | |
518 | + if type(cond) ~= "string" then | |
519 | + return | |
520 | + end | |
521 | + local temp = cond:toArray(true, " ") | |
522 | + cond = {} | |
523 | + for _, one in pairs(temp) do | |
524 | + cond[one] = 1 | |
525 | + end | |
526 | + elseif etype == 4 then | |
527 | + if not cond then | |
528 | + cond = {} | |
529 | + end | |
530 | + if type(cond) == "number" then | |
531 | + cond = {[cond] = 1} | |
532 | + end | |
533 | + end | |
534 | + for _, buff in ipairs(self.buffs) do | |
535 | + if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then | |
536 | + local _et, _attr, _co = buff:getEffectBy() | |
537 | + if etype == _et then | |
538 | + if etype == 3 or etype == 4 then | |
539 | + if cond[_co] then | |
540 | + effect[_attr] = 1 | |
541 | + end | |
542 | + else | |
543 | + if (not _co or _co == cond) then | |
544 | + effect[_attr] = 1 | |
545 | + end | |
546 | + end | |
547 | + end | |
548 | + end | |
549 | + end | |
550 | + for attrName, _ in pairs(effect) do | |
551 | + if attrName == "hp" then | |
552 | + self:reSetHpMax() | |
553 | + else | |
554 | + self:reSetAttr(attrName) | |
555 | + end | |
556 | + end | |
557 | +end | |
558 | + | |
508 | 559 | function BaseObject:getDB() |
509 | 560 | local db = {} |
510 | 561 | db.hp = self.hp |
... | ... | @@ -565,6 +616,16 @@ function Enemy:getObstacle() |
565 | 616 | return obstacle |
566 | 617 | end |
567 | 618 | |
619 | +function Enemy:isClassify(check) | |
620 | + local classify = self:getClassify() | |
621 | + return classify and classify:sismember(check, " ") | |
622 | +end | |
623 | + | |
624 | +function Enemy:getClassify() | |
625 | + return csvdb["event_monsterCsv"][self.monsterId].classify | |
626 | +end | |
627 | + | |
628 | + | |
568 | 629 | function Enemy:kill() |
569 | 630 | self:hurt(self.hp, self.battle.player, {hurtType = 5}) |
570 | 631 | end |
... | ... | @@ -704,7 +765,6 @@ end |
704 | 765 | function Player:addBuff(buffId, releaser) |
705 | 766 | local status = Player.super.addBuff(self, buffId, releaser) |
706 | 767 | if status then |
707 | - self.battle.player:attrChangeCondBuffCheck(2, buffId) | |
708 | 768 | self.battle.adv:checkAchievement(self.battle.adv.AchievType.GetBuff, 1, buffId) |
709 | 769 | self.battle.adv:pushBackEvent(AdvBackEventType.Buff, {buffId = buffId}) |
710 | 770 | self.battle:triggerPassive(Passive.PLAYER_BUFF, {buffId = buffId}) |
... | ... | @@ -716,26 +776,6 @@ function Player:addBuff(buffId, releaser) |
716 | 776 | return status |
717 | 777 | end |
718 | 778 | |
719 | -function Player:attrChangeCondBuffCheck(etype, cond) | |
720 | - local effect = {} | |
721 | - for _, buff in ipairs(self.buffs) do | |
722 | - if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then | |
723 | - local _et, _attr, _co = buff:getEffectBy() | |
724 | - if etype == _et and (not _co or _co == cond) then | |
725 | - effect[_attr] = 1 | |
726 | - end | |
727 | - | |
728 | - end | |
729 | - end | |
730 | - for attrName, _ in pairs(effect) do | |
731 | - if attrName == "hp" then | |
732 | - self:reSetHpMax() | |
733 | - else | |
734 | - self:reSetAttr(attrName) | |
735 | - end | |
736 | - end | |
737 | -end | |
738 | - | |
739 | 779 | function Player:isPlayer() |
740 | 780 | return true |
741 | 781 | end | ... | ... |