Commit df0f3a8e928370e5f4ce36431c72c529acec0ce3
Merge branch 'develop' of 120.26.43.151:wasteland/server into develop
Showing
6 changed files
with
74 additions
and
19 deletions
Show diff stats
src/adv/Adv.lua
... | ... | @@ -1436,7 +1436,7 @@ function Adv:clickBlock(roomId, blockId, params) |
1436 | 1436 | if not ignoreGuard and _block:isGuard() then |
1437 | 1437 | if _block:isMonster() then |
1438 | 1438 | local enemy = self.battle:getEnemy(_room.roomId, _block.blockId) |
1439 | - if not enemy:hadBuff(Buff.DONT_DEFEND) then | |
1439 | + if not enemy:hadBuff(Buff.DONT_DEFEND) and not self.battle.player:hadBuff(Buff.SNEAK) then | |
1440 | 1440 | return false |
1441 | 1441 | end |
1442 | 1442 | else | ... | ... |
src/adv/AdvBattle.lua
... | ... | @@ -163,7 +163,11 @@ function Battle:addEnemy(room, block, mapIdx) |
163 | 163 | end |
164 | 164 | block.event.enemy = enemy |
165 | 165 | end |
166 | - local player = Enemy.new(self, block.event.mId or 999, block.event.id, room.roomId, block.blockId, not block.isOpen, block.event.enemy, mapIdx) | |
166 | + if not block.event.mId then | |
167 | + block.event.mId = self.adv.lastEnemyId | |
168 | + self.adv.lastEnemyId = self.adv.lastEnemyId + 1 | |
169 | + end | |
170 | + local player = Enemy.new(self, block.event.mId, block.event.id, room.roomId, block.blockId, not block.isOpen, block.event.enemy, mapIdx) | |
167 | 171 | table.insert(self.enemys[mapIdx], player) |
168 | 172 | return player |
169 | 173 | elseif block:isBuild() then | ... | ... |
src/adv/AdvBlock.lua
... | ... | @@ -54,11 +54,9 @@ function Block:randomEvent() |
54 | 54 | local randomFunc = {} |
55 | 55 | --怪 |
56 | 56 | randomFunc[AdvEventType.Monster] = function() |
57 | - self.event.mId = adv.lastEnemyId --给怪一个有序id 回合逻辑时使用 | |
58 | - adv.lastEnemyId = adv.lastEnemyId + 1 | |
59 | 57 | local enemy = adv.battle:getEnemy(room.roomId, self.blockId, map.mapIdx) |
60 | 58 | if enemy then |
61 | - enemy:unlock(self.event.mId) | |
59 | + enemy:unlock() | |
62 | 60 | else |
63 | 61 | enemy = adv.battle:addEnemy(room, self, map.mapIdx) |
64 | 62 | enemy:initAfter(self.event.enemy) |
... | ... | @@ -177,18 +175,14 @@ function Block:randomEvent() |
177 | 175 | backTrap = false |
178 | 176 | elseif data.target == 3 then -- 翻开周围8格,并给怪物附带buff(不伤害玩家) |
179 | 177 | self.room.map.adv:getCurMap():openBlocksBySize(self.room.roomId, self.blockId, 2) |
180 | - local blocks = self.room.map.adv:getCurMap():getBlocksBySize(self.room.roomId, self.blockId, 2) | |
181 | - for _, block in pairs(blocks) do | |
182 | - if block:isMonster() then | |
183 | - local e = adv.battle:getEnemy(block.room.roomId, block.blockId) | |
184 | - for _, buffId in ipairs(buffs) do | |
185 | - e:addBuff(buffId) | |
186 | - end | |
178 | + local enemys = self.room.map.adv:getCurMap():getEnemysBySize(self.room.roomId, self.blockId, 2) | |
179 | + for _, e in ipairs(enemys) do | |
180 | + for _, buffId in ipairs(buffs) do | |
181 | + e:addBuff(buffId) | |
187 | 182 | end |
188 | 183 | end |
189 | 184 | end |
190 | 185 | |
191 | - | |
192 | 186 | if data.specialEff ~= "" then |
193 | 187 | local effect = data.specialEff:toArray(true, "=") |
194 | 188 | if effect[1] == 1 then | ... | ... |
src/adv/AdvBuff.lua
... | ... | @@ -32,6 +32,7 @@ Buff.SP_MAX_CHANGE = 28 -- 魔法上限 |
32 | 32 | Buff.ITEM_GET_UP = 29 -- 获得道具数量增加 |
33 | 33 | Buff.Buff_EFFECT_CHANGE = 30 -- 改变 buff 效果 |
34 | 34 | Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 |
35 | +Buff.SNEAK = 32 --潜行 | |
35 | 36 | |
36 | 37 | |
37 | 38 | --角色一些属性的变化 |
... | ... | @@ -371,7 +372,26 @@ local BuffFactory = { |
371 | 372 | return self.buffData.effectValue1 |
372 | 373 | end |
373 | 374 | end, |
375 | + [Buff.SNEAK] = function(_Buff) | |
376 | + _Buff._initDB = function(self, data) | |
377 | + self.sneak = data.sneak | |
378 | + end | |
374 | 379 | |
380 | + _Buff._getDB = function(self) | |
381 | + return {sneak = self.sneak} | |
382 | + end | |
383 | + -- 翻开怪 周围的格子 | |
384 | + _Buff.sneakBreak = function(self, enemyIds) | |
385 | + if self.isDel then return end | |
386 | + for _, enemyId in ipairs(enemyIds) do | |
387 | + self.sneak[enemyId] = (self.sneak[enemyId] or 0) + 1 | |
388 | + if self.sneak[enemyId] >= 4 then -- 4格 就删掉玩家的buff | |
389 | + self.isDel = true | |
390 | + break | |
391 | + end | |
392 | + end | |
393 | + end | |
394 | + end, | |
375 | 395 | } |
376 | 396 | |
377 | 397 | -- 同样的返回 effectValue1, effectValue2 * self.layer 类型的buff |
... | ... | @@ -488,6 +508,7 @@ function Buff:checkKeep() |
488 | 508 | 2=建筑id; |
489 | 509 | 3=事件id |
490 | 510 | 4=队伍为特定属性时 |
511 | + 5=拥有指定buff | |
491 | 512 | --]] |
492 | 513 | |
493 | 514 | local checkFunc = {} |
... | ... | @@ -524,6 +545,13 @@ function Buff:checkKeep() |
524 | 545 | local role = self.owner.battle.adv.owner |
525 | 546 | return role:getHerosCamp(role:getProperty("advTeam").heros) == teamAttr |
526 | 547 | end |
548 | + checkFunc[5] = function(_, buffId) | |
549 | + local buff = self.owner:getBuffById(buffId) | |
550 | + if buff and not buff.isDel then | |
551 | + return true | |
552 | + end | |
553 | + return false | |
554 | + end | |
527 | 555 | |
528 | 556 | local keepTerm = self.buffData.keepTerm:toArray(true, "=") |
529 | 557 | if not checkFunc[keepTerm[1]] then return true end | ... | ... |
src/adv/AdvMap.lua
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 | local Room = require "adv.AdvRoom" |
3 | 3 | local Passive = require "adv.AdvPassive" |
4 | 4 | local AdvCommon = require "adv.AdvCommon" |
5 | + | |
6 | +local Buff = require "adv.AdvBuff" | |
5 | 7 | -- 一层地图 |
6 | 8 | local Map = class("AdvMap") |
7 | 9 | -- 内部方法声明 |
... | ... | @@ -115,12 +117,15 @@ function Map:addNewMonsterRand(monsterId, where) |
115 | 117 | monsterId = math.randWeight(eventLib[AdvEventType.Monster][0], "showup") |
116 | 118 | end |
117 | 119 | |
118 | - local event = {etype = AdvEventType.Monster, mId = self.adv.lastEnemyId} | |
119 | - self.adv.lastEnemyId = self.adv.lastEnemyId + 1 | |
120 | - event.id = monsterId | |
120 | + local event = { | |
121 | + type = AdvEventType.Monster, | |
122 | + id = monsterId, | |
123 | + } | |
121 | 124 | block:updateEvent(event) |
122 | 125 | |
123 | - self.adv.battle:addEnemy(room, block):triggerPassive(Passive.BORN_ONCE) | |
126 | + local enemy = self.adv.battle:addEnemy(room, block) | |
127 | + enemy:initAfter(event.enemy) | |
128 | + enemy:triggerPassive(Passive.BORN_ONCE) | |
124 | 129 | |
125 | 130 | return room, block |
126 | 131 | end |
... | ... | @@ -168,6 +173,17 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack) |
168 | 173 | if not ignoreBack then |
169 | 174 | self.adv:backBlockChange(roomId, blockId) |
170 | 175 | end |
176 | + | |
177 | + -- 潜行检查 | |
178 | + local sneakBuff = self.adv.battle.player:hadBuff(Buff.SNEAK) | |
179 | + if sneakBuff then | |
180 | + local enemys = self:getEnemysBySize(roomId, blockId, 2) | |
181 | + local ids = {} | |
182 | + for _, e in ipairs(enemys) do | |
183 | + table.insert(ids, e.id) | |
184 | + end | |
185 | + sneakBuff:sneakBreak(ids) | |
186 | + end | |
171 | 187 | end |
172 | 188 | end |
173 | 189 | |
... | ... | @@ -244,6 +260,20 @@ function Map:getBlocksBySize(roomId, blockId, size) |
244 | 260 | return blocks |
245 | 261 | end |
246 | 262 | |
263 | +function Map:getEnemysBySize(roomId, blockId, size) | |
264 | + local blocks = self:getBlocksBySize(roomId, blockId, size) | |
265 | + local enemys = {} | |
266 | + for _, block in ipairs(blocks) do | |
267 | + if block:isMonster() then | |
268 | + local e = self.adv.battle:getEnemy(block.room.roomId, block.blockId) | |
269 | + if e then | |
270 | + table.insert(enemys, e) | |
271 | + end | |
272 | + end | |
273 | + end | |
274 | + return enemys | |
275 | +end | |
276 | + | |
247 | 277 | -----------------------------随机地图----------------------------- |
248 | 278 | |
249 | 279 | -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入 | ... | ... |
src/adv/AdvPlayer.lua
... | ... | @@ -527,8 +527,7 @@ function Enemy:ctor(battle, mId, monsterId, roomId, blockId, lock, enemy, mapIdx |
527 | 527 | self.mapIdx = mapIdx |
528 | 528 | self:initData(enemy) |
529 | 529 | end |
530 | -function Enemy:unlock(id) | |
531 | - self.id = id | |
530 | +function Enemy:unlock() | |
532 | 531 | self.lock = nil |
533 | 532 | end |
534 | 533 | ... | ... |