Commit 9c8e948242667e1a5fe81be06aa477d343a60d69
1 parent
44d8a134
buff 被动 限定地图
Showing
3 changed files
with
54 additions
and
16 deletions
 
Show diff stats
src/adv/AdvBuff.lua
| ... | ... | @@ -434,6 +434,9 @@ function Buff:initNew(release, data) | 
| 434 | 434 | if self.buffData.effectTime > 0 then | 
| 435 | 435 | self.count = self.buffData.effectTime | 
| 436 | 436 | end | 
| 437 | + if self.buffData.mapLock == 1 then | |
| 438 | + self.mapId = self.owner.battle.adv:getCurMap().mapId | |
| 439 | + end | |
| 437 | 440 | end | 
| 438 | 441 | |
| 439 | 442 | function Buff:createAfter() | 
| ... | ... | @@ -456,6 +459,9 @@ function Buff:initByDB(data) | 
| 456 | 459 | if data.count then | 
| 457 | 460 | self.count = data.count | 
| 458 | 461 | end | 
| 462 | + if data.mapId then | |
| 463 | + self.mapId = data.mapId | |
| 464 | + end | |
| 459 | 465 | self.layer = data.layer or 1 | 
| 460 | 466 | if self._initDB then | 
| 461 | 467 | self:_initDB(data) | 
| ... | ... | @@ -464,7 +470,7 @@ end | 
| 464 | 470 | |
| 465 | 471 | |
| 466 | 472 | function Buff:afterRound() | 
| 467 | - if self.isDel or self.owner.isDead then return end | |
| 473 | + if self.owner.isDead or self:isHide() then return end | |
| 468 | 474 | |
| 469 | 475 | -- keepTerm 检查 | 
| 470 | 476 | if not self:checkKeep() then | 
| ... | ... | @@ -533,7 +539,7 @@ function Buff:checkKeep() | 
| 533 | 539 | end | 
| 534 | 540 | checkFunc[5] = function(_, buffId) | 
| 535 | 541 | local buff = self.owner:getBuffById(buffId) | 
| 536 | - if buff and not buff.isDel then | |
| 542 | + if buff then | |
| 537 | 543 | return true | 
| 538 | 544 | end | 
| 539 | 545 | return false | 
| ... | ... | @@ -574,6 +580,18 @@ function Buff:effect() | 
| 574 | 580 | return self:_effectValue() | 
| 575 | 581 | end | 
| 576 | 582 | end | 
| 583 | + | |
| 584 | +-- 在当前阶段不可用 小透明 < 不会回合遍历 不会查找遍历 可以删除遍历 可以下层遍历 > | |
| 585 | +function Buff:isHide() | |
| 586 | + if self.isDel then | |
| 587 | + return false | |
| 588 | + end | |
| 589 | + if self.buffData.mapLock == 1 and self.mapId and self.owner.battle.adv:getCurMap().mapId ~= self.mapId then | |
| 590 | + return false | |
| 591 | + end | |
| 592 | + return true | |
| 593 | +end | |
| 594 | + | |
| 577 | 595 | --删除buff 时调用 | 
| 578 | 596 | function Buff:endBuff() | 
| 579 | 597 | if self._endBuff then | 
| ... | ... | @@ -678,6 +696,9 @@ function Buff:getDB() | 
| 678 | 696 | if self.count ~= -1 then | 
| 679 | 697 | db.count = self.count | 
| 680 | 698 | end | 
| 699 | + if self.mapId then | |
| 700 | + db.mapId = self.mapId | |
| 701 | + end | |
| 681 | 702 | db.layer = self.layer | 
| 682 | 703 | if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then | 
| 683 | 704 | db.releId = self.releaseId | ... | ... | 
src/adv/AdvPassive.lua
| ... | ... | @@ -265,6 +265,9 @@ function Passive:ctor(owner, data) | 
| 265 | 265 | self.round = data.round or 0 --触发剩余回合数 | 
| 266 | 266 | self.count = data.count or self.passiveData.count --触发剩余次数 | 
| 267 | 267 | self.delay = data.delay or self.passiveData.delayRound --触发延迟回合数 | 
| 268 | + if self.passiveData.mapLock == 1 and not self.mapId then | |
| 269 | + self.mapId = self.owner.battle.adv:getCurMap().mapId | |
| 270 | + end | |
| 268 | 271 | |
| 269 | 272 | self.effects = self.passiveData.effect:toTableArray(true) | 
| 270 | 273 | self.filters = {} | 
| ... | ... | @@ -331,7 +334,7 @@ function Passive:effect(triggerPms) | 
| 331 | 334 | end | 
| 332 | 335 | |
| 333 | 336 | function Passive:afterRound() | 
| 334 | - if self.isDel or self.owner.isDead or self.owner.lock then return end | |
| 337 | + if self.isDel or self.owner.isDead or self.owner.lock or self:isHide() then return end | |
| 335 | 338 | if self.round > 0 then --回合触发的 | 
| 336 | 339 | self.round = self.round - 1 | 
| 337 | 340 | end | 
| ... | ... | @@ -349,9 +352,20 @@ function Passive:afterLayer() | 
| 349 | 352 | end | 
| 350 | 353 | end | 
| 351 | 354 | |
| 355 | +-- 在当前阶段不可用 小透明 < 不会回合遍历 不会查找遍历 可以删除遍历 可以下层遍历 > | |
| 356 | +function Passive:isHide() | |
| 357 | + if self.isDel then | |
| 358 | + return false | |
| 359 | + end | |
| 360 | + if self.passiveData.mapLock == 1 and self.mapId and self.owner.battle.adv:getCurMap().mapId ~= self.mapId then | |
| 361 | + return false | |
| 362 | + end | |
| 363 | + return true | |
| 364 | +end | |
| 365 | + | |
| 352 | 366 | -- 可以触发 | 
| 353 | 367 | function Passive:canTrigger( ) | 
| 354 | - return self.count > 0 and self.delay <= 0 | |
| 368 | + return self.count > 0 and self.delay <= 0 and not self:isHide() | |
| 355 | 369 | end | 
| 356 | 370 | |
| 357 | 371 | function Passive:trigger(condType, params) --触发检查 | 
| ... | ... | @@ -393,6 +407,9 @@ function Passive:getDB() | 
| 393 | 407 | db.round = self.round | 
| 394 | 408 | db.count = self.count | 
| 395 | 409 | db.delay = self.delay | 
| 410 | + if self.mapId then | |
| 411 | + db.mapId = self.mapId | |
| 412 | + end | |
| 396 | 413 | return db | 
| 397 | 414 | end | 
| 398 | 415 | ... | ... | 
src/adv/AdvPlayer.lua
| ... | ... | @@ -124,7 +124,7 @@ end | 
| 124 | 124 | function BaseObject:getDisablePassiveCount() | 
| 125 | 125 | local count | 
| 126 | 126 | for _, buff in ipairs(self.buffs) do | 
| 127 | - if not buff.isDel and buff:getType() == Buff.DISABLE_BUFF then | |
| 127 | + if not buff:isHide() and buff:getType() == Buff.DISABLE_BUFF then | |
| 128 | 128 | if buff:effect() == 0 then | 
| 129 | 129 | return 0 | 
| 130 | 130 | end | 
| ... | ... | @@ -138,7 +138,7 @@ function BaseObject:addBuff(buffId, releaser) | 
| 138 | 138 | local buffData = csvdb["adv_map_buffCsv"][buffId] | 
| 139 | 139 | if not buffData then return end | 
| 140 | 140 | for _, buff in ipairs(self.buffs) do | 
| 141 | - if not buff.isDel and (buff:getType() == Buff.CLEAR_BUFF or buff:getType() == Buff.IMMNUE_BUFF) then | |
| 141 | + if not buff:isHide() and (buff:getType() == Buff.CLEAR_BUFF or buff:getType() == Buff.IMMNUE_BUFF) then | |
| 142 | 142 | if buff:canEffect(buffId) then | 
| 143 | 143 | buff:effect() | 
| 144 | 144 | return | 
| ... | ... | @@ -166,7 +166,7 @@ end | 
| 166 | 166 | |
| 167 | 167 | function BaseObject:getBuffById(bId) | 
| 168 | 168 | for idx, buff in ipairs(self.buffs) do | 
| 169 | - if buff.id == bId then | |
| 169 | + if buff.id == bId and not buff:isHide() then | |
| 170 | 170 | return buff | 
| 171 | 171 | end | 
| 172 | 172 | end | 
| ... | ... | @@ -196,7 +196,7 @@ end | 
| 196 | 196 | |
| 197 | 197 | function BaseObject:hadBuff(bType) | 
| 198 | 198 | for _, buff in ipairs(self.buffs) do | 
| 199 | - if not buff.isDel and buff:getType() == bType then | |
| 199 | + if not buff:isHide() and buff:getType() == bType then | |
| 200 | 200 | return buff | 
| 201 | 201 | end | 
| 202 | 202 | end | 
| ... | ... | @@ -204,7 +204,7 @@ end | 
| 204 | 204 | |
| 205 | 205 | function BaseObject:hadBuffById(bId) | 
| 206 | 206 | for _, buff in ipairs(self.buffs) do | 
| 207 | - if not buff.isDel and buff.id == bId then | |
| 207 | + if not buff:isHide() and buff.id == bId then | |
| 208 | 208 | return buff | 
| 209 | 209 | end | 
| 210 | 210 | end | 
| ... | ... | @@ -218,7 +218,7 @@ end | 
| 218 | 218 | function BaseObject:getCommonBuffEffect(bType, otherCond) | 
| 219 | 219 | local effect, count = {[0] = 0, [1] = 0}, 0 | 
| 220 | 220 | for _, buff in ipairs(self.buffs) do | 
| 221 | - if not buff.isDel and buff:getType() == bType then | |
| 221 | + if not buff:isHide() and buff:getType() == bType then | |
| 222 | 222 | local cType, value, cond = buff:effect() | 
| 223 | 223 | if cType and (not otherCond or otherCond == cond) then | 
| 224 | 224 | effect[cType] = effect[cType] + value | 
| ... | ... | @@ -233,7 +233,7 @@ end | 
| 233 | 233 | function BaseObject:getBackHurtBuff() | 
| 234 | 234 | local effect = {[0] = 0, [1] = 0} | 
| 235 | 235 | for _, buff in ipairs(self.buffs) do | 
| 236 | - if not buff.isDel and buff:getType() == Buff.BACK_HURT then | |
| 236 | + if not buff:isHide() and buff:getType() == Buff.BACK_HURT then | |
| 237 | 237 | local cType, value = buff:effect() -- aType 0 全部 1 普通攻击 | 
| 238 | 238 | if cType then | 
| 239 | 239 | effect[cType] = effect[cType] + value | 
| ... | ... | @@ -268,7 +268,7 @@ function BaseObject:getBuffEffectChange(classify) | 
| 268 | 268 | end | 
| 269 | 269 | local effect = 0 | 
| 270 | 270 | for _, buff in ipairs(self.buffs) do | 
| 271 | - if not buff.isDel and buff:getType() == Buff.Buff_EFFECT_CHANGE then | |
| 271 | + if not buff:isHide() and buff:getType() == Buff.Buff_EFFECT_CHANGE then | |
| 272 | 272 | local cType, value = buff:effect() | 
| 273 | 273 | if cType and had[cType] then | 
| 274 | 274 | effect = effect + value | 
| ... | ... | @@ -286,7 +286,7 @@ function BaseObject:getAttrBuffChange(attr) | 
| 286 | 286 | } | 
| 287 | 287 | local effect, count = {[0] = 0, [1] = 0}, 0 | 
| 288 | 288 | for _, buff in ipairs(self.buffs) do | 
| 289 | - if not buff.isDel and AttrBuff[buff:getType()] then | |
| 289 | + if not buff:isHide() and AttrBuff[buff:getType()] then | |
| 290 | 290 | local cType, value, attrName = buff:effect() | 
| 291 | 291 | if cType and attr == attrName then | 
| 292 | 292 | effect[cType] = effect[cType] + value | 
| ... | ... | @@ -310,7 +310,7 @@ end | 
| 310 | 310 | function BaseObject:reSetHpMax() | 
| 311 | 311 | self.hpMax = self._hpMax | 
| 312 | 312 | for _, buff in ipairs(self.buffs) do | 
| 313 | - if not buff.isDel and buff:getType() == Buff.HP_MAX_CHANGE then | |
| 313 | + if not buff:isHide() and buff:getType() == Buff.HP_MAX_CHANGE then | |
| 314 | 314 | local cv = buff:effect() | 
| 315 | 315 | if cv then | 
| 316 | 316 | self.hpMax = self.hpMax + cv | 
| ... | ... | @@ -665,7 +665,7 @@ end | 
| 665 | 665 | --战斗结束了扣战斗buff次数 | 
| 666 | 666 | function Player:effectBattleBuff() | 
| 667 | 667 | for _, buff in ipairs(self.buffs) do | 
| 668 | - if not buff.isDel and (buff:getType() == Buff.BATTLE_BUFF or buff:getType() == Buff.BATTLE_PASSIVE) then | |
| 668 | + if not buff:isHide() and (buff:getType() == Buff.BATTLE_BUFF or buff:getType() == Buff.BATTLE_PASSIVE) then | |
| 669 | 669 | buff:effect() | 
| 670 | 670 | end | 
| 671 | 671 | end | 
| ... | ... | @@ -699,7 +699,7 @@ end | 
| 699 | 699 | function Player:attrChangeCondBuffCheck(etype, cond) | 
| 700 | 700 | local effect = {} | 
| 701 | 701 | for _, buff in ipairs(self.buffs) do | 
| 702 | - if not buff.isDel and (buff:getType() == Buff.ATTR_CHANGE_COND) then | |
| 702 | + if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then | |
| 703 | 703 | local _et, _attr, _co = buff:getEffectBy() | 
| 704 | 704 | if etype == _et and (not _co or _co == cond) then | 
| 705 | 705 | effect[_attr] = 1 | ... | ... | 
- 
mentioned in commit 52f8c5f05d0a531232a7dd7887becd2a77986aa1
 - 
mentioned in commit ba6d85edc65900830c7e168102d70671881b5808