Commit 42dcb7da068acd98806c651965e7c663fffa3fc0
merge code
Showing
13 changed files
with
273 additions
and
120 deletions
Show diff stats
src/actions/GmAction.lua
@@ -419,7 +419,6 @@ end | @@ -419,7 +419,6 @@ end | ||
419 | 419 | ||
420 | table.insert(helpDes, {"挂机清除" , "idlec"}) | 420 | table.insert(helpDes, {"挂机清除" , "idlec"}) |
421 | function _M.idlec(role, pms) | 421 | function _M.idlec(role, pms) |
422 | - role:updateProperty({field = "hangTeam", value = {}}) | ||
423 | role:updateProperty({field = "hangInfo", value = {}}) | 422 | role:updateProperty({field = "hangInfo", value = {}}) |
424 | role:updateProperty({field = "hangBag", value = {}}) | 423 | role:updateProperty({field = "hangBag", value = {}}) |
425 | role:mylog("gm_action", {desc = "idlec", key1 = pms.sender}) | 424 | role:mylog("gm_action", {desc = "idlec", key1 = pms.sender}) |
src/actions/HangAction.lua
@@ -347,7 +347,9 @@ function _M.roleFormatRpc(agent , data) | @@ -347,7 +347,9 @@ function _M.roleFormatRpc(agent , data) | ||
347 | team.leader = msg.leader | 347 | team.leader = msg.leader |
348 | team.supports = supports | 348 | team.supports = supports |
349 | team.title = title | 349 | team.title = title |
350 | - team.tactics = tactics | 350 | + if msg.tactics and globalCsv.tactics_skill_passive_cell[msg.tactics] then |
351 | + team.tactics = msg.tactics | ||
352 | + end | ||
351 | 353 | ||
352 | role:setTeamFormat(index, team) | 354 | role:setTeamFormat(index, team) |
353 | 355 | ||
@@ -461,36 +463,6 @@ function _M.quickRpc(agent , data) | @@ -461,36 +463,6 @@ function _M.quickRpc(agent , data) | ||
461 | return true | 463 | return true |
462 | end | 464 | end |
463 | 465 | ||
464 | -function _M.bonusFormatRpc(agent , data) | ||
465 | - local role = agent.role | ||
466 | - local msg = MsgPack.unpack(data) | ||
467 | - local bTeam = role:getProperty("bTeam") | ||
468 | - for slot, heroId in pairs(msg.heros) do | ||
469 | - if not role.heros[heroId] then | ||
470 | - return | ||
471 | - end | ||
472 | - end | ||
473 | - local supports = {} | ||
474 | - for slot, support in pairs(msg.supports) do | ||
475 | - if slot ~= 1 and slot ~= 2 then return end | ||
476 | - local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | ||
477 | - if level <= 0 then return end | ||
478 | - supports[slot] = support | ||
479 | - end | ||
480 | - if not checkLeader(msg.heros, msg.leader) then return end | ||
481 | - | ||
482 | - table.clear(bTeam) | ||
483 | - bTeam.heros = {} | ||
484 | - for slot, heroId in pairs(msg.heros) do | ||
485 | - bTeam.heros[slot] = heroId | ||
486 | - end | ||
487 | - bTeam.leader = msg.leader | ||
488 | - bTeam.supports = supports | ||
489 | - | ||
490 | - role:updateProperty({field = "bTeam", value = bTeam}) | ||
491 | - SendPacket(actionCodes.Hang_bonusFormatRpc, '') | ||
492 | - return true | ||
493 | -end | ||
494 | 466 | ||
495 | function _M.buyBonusCountRpc(agent, data) | 467 | function _M.buyBonusCountRpc(agent, data) |
496 | local role = agent.role | 468 | local role = agent.role |
@@ -713,4 +685,4 @@ function _M.selectTeamRpc(agent, data) | @@ -713,4 +685,4 @@ function _M.selectTeamRpc(agent, data) | ||
713 | return true | 685 | return true |
714 | end | 686 | end |
715 | 687 | ||
716 | -return _M | ||
717 | \ No newline at end of file | 688 | \ No newline at end of file |
689 | +return _M |
src/actions/PvpAction.lua
@@ -50,6 +50,9 @@ function _M.formatCommonRpc(agent , data) | @@ -50,6 +50,9 @@ function _M.formatCommonRpc(agent , data) | ||
50 | end | 50 | end |
51 | pvpTC.leader = msg.leader | 51 | pvpTC.leader = msg.leader |
52 | pvpTC.supports = supports | 52 | pvpTC.supports = supports |
53 | + if msg.tactics and globalCsv.tactics_skill_passive_cell[msg.tactics] then | ||
54 | + pvpTC.tactics = msg.tactics | ||
55 | + end | ||
53 | 56 | ||
54 | role:savePvpCTeam(pvpTC) | 57 | role:savePvpCTeam(pvpTC) |
55 | SendPacket(actionCodes.Pvp_formatCommonRpc, '') | 58 | SendPacket(actionCodes.Pvp_formatCommonRpc, '') |
@@ -92,6 +95,9 @@ function _M.formatHighRpc(agent , data) | @@ -92,6 +95,9 @@ function _M.formatHighRpc(agent , data) | ||
92 | curTeam.heros = team.heros | 95 | curTeam.heros = team.heros |
93 | curTeam.leader = team.leader | 96 | curTeam.leader = team.leader |
94 | curTeam.supports = supports | 97 | curTeam.supports = supports |
98 | + if team.tactics and globalCsv.tactics_skill_passive_cell[team.tactics] then | ||
99 | + curTeam.tactics = team.tactics | ||
100 | + end | ||
95 | 101 | ||
96 | table.insert(pvpTH, curTeam) | 102 | table.insert(pvpTH, curTeam) |
97 | end | 103 | end |
@@ -462,6 +468,10 @@ function _M.startBattleHRpc(agent, data) | @@ -462,6 +468,10 @@ function _M.startBattleHRpc(agent, data) | ||
462 | curTeam.heros = team.heros | 468 | curTeam.heros = team.heros |
463 | curTeam.leader = team.leader | 469 | curTeam.leader = team.leader |
464 | curTeam.supports = supports | 470 | curTeam.supports = supports |
471 | + if team.tactics and globalCsv.tactics_skill_passive_cell[team.tactics] then | ||
472 | + curTeam.tactics = team.tactics | ||
473 | + end | ||
474 | + | ||
465 | 475 | ||
466 | table.insert(pvpTH, curTeam) | 476 | table.insert(pvpTH, curTeam) |
467 | end | 477 | end |
src/actions/RoleAction.lua
@@ -291,7 +291,7 @@ function _M.loginRpc( agent, data ) | @@ -291,7 +291,7 @@ function _M.loginRpc( agent, data ) | ||
291 | 291 | ||
292 | 292 | ||
293 | -- 玩家登陆做的一些操作 | 293 | -- 玩家登陆做的一些操作 |
294 | - role:saveHangTeam() | 294 | + role:updateHangTeamInfo() |
295 | role:savePvpCTeam() | 295 | role:savePvpCTeam() |
296 | role:savePvpHTeam() | 296 | role:savePvpHTeam() |
297 | 297 |
src/actions/TowerAction.lua
@@ -8,36 +8,6 @@ local MsgPack = MsgPack | @@ -8,36 +8,6 @@ local MsgPack = MsgPack | ||
8 | local _M = {} | 8 | local _M = {} |
9 | 9 | ||
10 | 10 | ||
11 | -function _M.roleFormatRpc(agent , data) | ||
12 | - local role = agent.role | ||
13 | - local msg = MsgPack.unpack(data) | ||
14 | - local towerTeam = role:getProperty("towerF") | ||
15 | - for slot, heroId in pairs(msg.heros) do | ||
16 | - if not role.heros[heroId] then | ||
17 | - return | ||
18 | - end | ||
19 | - end | ||
20 | - local supports = {} | ||
21 | - for slot, support in pairs(msg.supports) do | ||
22 | - if slot ~= 1 and slot ~= 2 then return end | ||
23 | - local level = role.dinerData:getProperty("dishTree"):getv(support, 0) | ||
24 | - if level <= 0 then return end | ||
25 | - supports[slot] = support | ||
26 | - end | ||
27 | - table.clear(towerTeam) | ||
28 | - towerTeam.heros = {} | ||
29 | - for slot, heroId in pairs(msg.heros) do | ||
30 | - towerTeam.heros[slot] = heroId | ||
31 | - end | ||
32 | - towerTeam.leader = msg.leader | ||
33 | - towerTeam.supports = supports | ||
34 | - | ||
35 | - | ||
36 | - role:updateProperty({field = "towerF", value = towerTeam}) | ||
37 | - SendPacket(actionCodes.Tower_roleFormatRpc, '') | ||
38 | - return true | ||
39 | -end | ||
40 | - | ||
41 | 11 | ||
42 | local function getUpdateTime(lastCount, lastTime) | 12 | local function getUpdateTime(lastCount, lastTime) |
43 | local nextCount, nextTime = lastCount, skynet.timex() | 13 | local nextCount, nextTime = lastCount, skynet.timex() |
src/adv/Adv.lua
@@ -102,6 +102,9 @@ function Adv:initByChapter(params) | @@ -102,6 +102,9 @@ function Adv:initByChapter(params) | ||
102 | self.cacheUnlock = self.cacheUnlock or {} | 102 | self.cacheUnlock = self.cacheUnlock or {} |
103 | self.shopStatus = self.shopStatus or {} | 103 | self.shopStatus = self.shopStatus or {} |
104 | self.support = self.support or {} | 104 | self.support = self.support or {} |
105 | + if self.battle then | ||
106 | + self.battle:overBattle() | ||
107 | + end | ||
105 | self.battle = nil -- 清掉 老的 battle | 108 | self.battle = nil -- 清掉 老的 battle |
106 | self.logid = self.owner:getActionUcode() | 109 | self.logid = self.owner:getActionUcode() |
107 | 110 | ||
@@ -211,7 +214,7 @@ function Adv:saveDB(notNotify) | @@ -211,7 +214,7 @@ function Adv:saveDB(notNotify) | ||
211 | advInfo.logid = self.logid | 214 | advInfo.logid = self.logid |
212 | advInfo.maps = {} | 215 | advInfo.maps = {} |
213 | 216 | ||
214 | - self.battle:saveDB() | 217 | + self.battle:saveDB(advInfo) |
215 | 218 | ||
216 | for id , map in ipairs(self.maps) do | 219 | for id , map in ipairs(self.maps) do |
217 | advInfo.maps[id] = map:getDB() | 220 | advInfo.maps[id] = map:getDB() |
@@ -468,6 +471,11 @@ function Adv:initBattle(notDb) | @@ -468,6 +471,11 @@ function Adv:initBattle(notDb) | ||
468 | if notDb and self.level ~= 1 then | 471 | if notDb and self.level ~= 1 then |
469 | self.battle.player:attrChangeCondBuffCheck(1) | 472 | self.battle.player:attrChangeCondBuffCheck(1) |
470 | end | 473 | end |
474 | + | ||
475 | + -- 初始化 | ||
476 | + if notDb then | ||
477 | + self.battle:newBattle() | ||
478 | + end | ||
471 | end | 479 | end |
472 | 480 | ||
473 | function Adv:triggerPassive(condType, params) | 481 | function Adv:triggerPassive(condType, params) |
@@ -1029,7 +1037,7 @@ function Adv:useItem(itemId, count, target) | @@ -1029,7 +1037,7 @@ function Adv:useItem(itemId, count, target) | ||
1029 | if itemData["function"] == 0 or itemData["function"] == 2 then count = 1 end | 1037 | if itemData["function"] == 0 or itemData["function"] == 2 then count = 1 end |
1030 | 1038 | ||
1031 | if itemId == 5020 then | 1039 | if itemId == 5020 then |
1032 | - role:finishGuide(53) | 1040 | + self.owner:finishGuide(53) |
1033 | end | 1041 | end |
1034 | 1042 | ||
1035 | self:checkAchievement(self.AchievType.UseItem, count, itemId) | 1043 | self:checkAchievement(self.AchievType.UseItem, count, itemId) |
@@ -1084,7 +1092,9 @@ local function clickOut(self, room, block, params, isExit) | @@ -1084,7 +1092,9 @@ local function clickOut(self, room, block, params, isExit) | ||
1084 | end | 1092 | end |
1085 | 1093 | ||
1086 | if #self.mapStack > 1 then -- 处于夹层中 | 1094 | if #self.mapStack > 1 then -- 处于夹层中 |
1095 | + local oldMapIdx = self:getCurMapIdx() | ||
1087 | table.remove(self.mapStack) --退出夹层 | 1096 | table.remove(self.mapStack) --退出夹层 |
1097 | + self.battle:iLayerChange(oldMapIdx) | ||
1088 | self:backLayer(-1) | 1098 | self:backLayer(-1) |
1089 | else --处于底层 | 1099 | else --处于底层 |
1090 | 1100 | ||
@@ -1119,7 +1129,6 @@ local function clickOut(self, room, block, params, isExit) | @@ -1119,7 +1129,6 @@ local function clickOut(self, room, block, params, isExit) | ||
1119 | end | 1129 | end |
1120 | local isHaveRelay = self:isHaveRelay(self.level) | 1130 | local isHaveRelay = self:isHaveRelay(self.level) |
1121 | 1131 | ||
1122 | - self.owner:getProperty("advTeam").player = self.battle.player:getDB() -- 临时缓存住 battle 的player | ||
1123 | if isHaveRelay and not self.isRelay then | 1132 | if isHaveRelay and not self.isRelay then |
1124 | self:initByChapter({ | 1133 | self:initByChapter({ |
1125 | chapterId = self.chapterId, | 1134 | chapterId = self.chapterId, |
@@ -1562,6 +1571,7 @@ local function clickClick(self, room, block, params) | @@ -1562,6 +1571,7 @@ local function clickClick(self, room, block, params) | ||
1562 | end | 1571 | end |
1563 | 1572 | ||
1564 | local function clickLayer(self, room, block, params) | 1573 | local function clickLayer(self, room, block, params) |
1574 | + local oldMapIdx = self:getCurMapIdx() | ||
1565 | if block.event.mapIdx then | 1575 | if block.event.mapIdx then |
1566 | table.insert(self.mapStack, block.event.mapIdx) --进入夹层 | 1576 | table.insert(self.mapStack, block.event.mapIdx) --进入夹层 |
1567 | else | 1577 | else |
@@ -1577,6 +1587,7 @@ local function clickLayer(self, room, block, params) | @@ -1577,6 +1587,7 @@ local function clickLayer(self, room, block, params) | ||
1577 | self.maps[mapIdx]:initBattleAfter() | 1587 | self.maps[mapIdx]:initBattleAfter() |
1578 | self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId) | 1588 | self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId) |
1579 | end | 1589 | end |
1590 | + self.battle:iLayerChange(oldMapIdx) | ||
1580 | self:backLayer(1) | 1591 | self:backLayer(1) |
1581 | return true | 1592 | return true |
1582 | end | 1593 | end |
@@ -2101,21 +2112,11 @@ function Adv:scoreChange(scoreType, score) | @@ -2101,21 +2112,11 @@ function Adv:scoreChange(scoreType, score) | ||
2101 | end | 2112 | end |
2102 | 2113 | ||
2103 | function Adv:getScore() | 2114 | function Adv:getScore() |
2104 | - self.score[AdvScoreType.Level] = math.floor(self.score[AdvScoreType.Level] or 0) | ||
2105 | - self.score[AdvScoreType.Task] = math.floor(self.score[AdvScoreType.Task] or 0) | ||
2106 | - self.score[AdvScoreType.Kill] = math.floor(self.score[AdvScoreType.Kill] or 0) | ||
2107 | - self.score[AdvScoreType.KillBoss] = math.floor(self.score[AdvScoreType.KillBoss] or 0) | ||
2108 | - self.score[AdvScoreType.ItemBack] = math.floor(self.score[AdvScoreType.ItemBack] or 0) | ||
2109 | - self.score[AdvScoreType.Event] = math.floor(self.score[AdvScoreType.Event] or 0) | ||
2110 | - self.score[AdvScoreType.Story] = math.floor(self.score[AdvScoreType.Story] or 0) | ||
2111 | - | ||
2112 | - return self.score[AdvScoreType.Level] | ||
2113 | - + self.score[AdvScoreType.Task] | ||
2114 | - + self.score[AdvScoreType.Kill] | ||
2115 | - + self.score[AdvScoreType.KillBoss] | ||
2116 | - + self.score[AdvScoreType.ItemBack] | ||
2117 | - + self.score[AdvScoreType.Event] | ||
2118 | - + self.score[AdvScoreType.Story] | 2115 | + local allScore = 0 |
2116 | + for _, score in pairs(self.score) do | ||
2117 | + allScore = allScore + math.floor(score) | ||
2118 | + end | ||
2119 | + return allScore | ||
2119 | end | 2120 | end |
2120 | 2121 | ||
2121 | function Adv:popBackEvents() | 2122 | function Adv:popBackEvents() |
src/adv/AdvBattle.lua
@@ -8,6 +8,7 @@ function Battle:ctor(adv) | @@ -8,6 +8,7 @@ function Battle:ctor(adv) | ||
8 | self.isNewPlayer = false | 8 | self.isNewPlayer = false |
9 | self.enemys = {} --怪 | 9 | self.enemys = {} --怪 |
10 | self.builds = {} -- 建筑 | 10 | self.builds = {} -- 建筑 |
11 | + self.auras = {} -- 光环 | ||
11 | self.cachePassiveEvent = {} | 12 | self.cachePassiveEvent = {} |
12 | self:initPlayer() | 13 | self:initPlayer() |
13 | self:initEnemys() | 14 | self:initEnemys() |
@@ -198,8 +199,10 @@ function Battle:addEnemy(room, block, mapIdx, init) | @@ -198,8 +199,10 @@ function Battle:addEnemy(room, block, mapIdx, init) | ||
198 | end | 199 | end |
199 | 200 | ||
200 | for _, buff in ipairs(buffs) do | 201 | for _, buff in ipairs(buffs) do |
201 | - enemy:addBuff(buff) | 202 | + player:addBuff(buff) |
202 | end | 203 | end |
204 | + -- 新生成的怪 加上 已有的光环buff | ||
205 | + player:checkAuraBuff(self:checkDiffAuraBuff({}, self:getAurasByMap())) | ||
203 | end | 206 | end |
204 | end | 207 | end |
205 | return player | 208 | return player |
@@ -347,6 +350,8 @@ function Battle:afterRound() | @@ -347,6 +350,8 @@ function Battle:afterRound() | ||
347 | 350 | ||
348 | self.player:triggerPassive(Passive.AFTER_ROUND) | 351 | self.player:triggerPassive(Passive.AFTER_ROUND) |
349 | 352 | ||
353 | + self:checkAura() | ||
354 | + | ||
350 | if self.player.isDead then | 355 | if self.player.isDead then |
351 | self.adv:over(false, nil, -2) | 356 | self.adv:over(false, nil, -2) |
352 | end | 357 | end |
@@ -435,8 +440,116 @@ function Battle:initMapEffect(ilayer) | @@ -435,8 +440,116 @@ function Battle:initMapEffect(ilayer) | ||
435 | end | 440 | end |
436 | 441 | ||
437 | 442 | ||
443 | +-- 夹层 进入退出 接口 清理玩家身上的老光环 添加新的光环 | ||
444 | +function Battle:iLayerChange(oldMapIdx) | ||
445 | + local auras = self:getActiveAuras() | ||
446 | + local playerBuffs = self:checkDiffAuraBuff(self:getAurasByMap(oldMapIdx), auras) | ||
447 | + local enemyBuffs = self:checkDiffAuraBuff(self:getAurasByMap(), auras) | ||
448 | + self.player:checkAuraBuff(playerBuffs) | ||
449 | + for _, enemy in pairs(self.player:getTeam(2)) do | ||
450 | + enemy:checkAuraBuff(enemyBuffs) | ||
451 | + end | ||
452 | + self:setMapAuras(auras) | ||
453 | +end | ||
454 | + | ||
455 | +-- 新的 关卡 关闭旧的战斗模块 清理 玩家身上的光环效果 | ||
456 | +function Battle:overBattle() | ||
457 | + local buffs = self:checkDiffAuraBuff(self:getAurasByMap(), {}) | ||
458 | + self.player:checkAuraBuff(buffs) | ||
459 | + self.adv.owner:getProperty("advTeam").player = self.player:getDB() -- 临时缓存住 battle 的player | ||
460 | +end | ||
461 | + | ||
462 | +-- 初始化 新的 关卡 | ||
463 | +function Battle:newBattle() | ||
464 | + local auras = self:getActiveAuras() | ||
465 | + local buffs = self:checkDiffAuraBuff({}, auras) | ||
466 | + self:setMapAuras(auras) | ||
467 | +end | ||
468 | + | ||
469 | +-- 过了回合 检查光环 | ||
470 | +function Battle:checkAura() | ||
471 | + local auras = self:getActiveAuras() | ||
472 | + local buffs = self:checkDiffAuraBuff(self:getAurasByMap(), auras) | ||
473 | + self.player:checkAuraBuff(buffs) | ||
474 | + for _, enemy in pairs(self.player:getTeam(2)) do | ||
475 | + enemy:checkAuraBuff(buffs) | ||
476 | + end | ||
477 | + self:setMapAuras(auras) | ||
478 | +end | ||
479 | + | ||
480 | +-- 查找差异buff | ||
481 | +function Battle:checkDiffAuraBuff(oldAuras, newAuras) | ||
482 | + local auras = {} | ||
483 | + for aurasId , count in pairs(oldAuras) do | ||
484 | + auras[aurasId] = -count | ||
485 | + end | ||
486 | + for aurasId , count in pairs(newAuras) do | ||
487 | + auras[aurasId] = (auras[aurasId] or 0) + count | ||
488 | + end | ||
489 | + | ||
490 | + local buffs = {} | ||
491 | + for aurasId , count in pairs(auras) do | ||
492 | + local auraData = csvdb["adv_map_haloCsv"][aurasId] | ||
493 | + if auraData then | ||
494 | + for _, effect in ipairs(auraData.effect:toTableArray(true)) do | ||
495 | + temp = buffs | ||
496 | + for i = 1, #effect do | ||
497 | + temp[effect[i]] = temp[effect[i]] or {} | ||
498 | + temp = temp[effect[i]] | ||
499 | + end | ||
500 | + temp.count = (temp.count or 0) + count | ||
501 | + if newAuras[aurasId] then | ||
502 | + -- 加上 未消失标记 | ||
503 | + temp.exist = true | ||
504 | + end | ||
505 | + end | ||
506 | + end | ||
507 | + end | ||
508 | + return buffs | ||
509 | +end | ||
510 | + | ||
511 | +-- 获取所有生效的 光环 | ||
512 | +function Battle:getActiveAuras() | ||
513 | + local auras = {} | ||
514 | + for _, one in pairs(self.player:getAuras()) do | ||
515 | + auras[one] = (auras[one] or 0) + 1 | ||
516 | + end | ||
517 | + for _, enemy in pairs(self.player:getTeam(2)) do | ||
518 | + for _, one in pairs(enemy:getAuras()) do | ||
519 | + auras[one] = (auras[one] or 0) + 1 | ||
520 | + end | ||
521 | + end | ||
522 | + for _, build in pairs(self:getBuilds()) do | ||
523 | + for _, one in pairs(build:getAuras()) do | ||
524 | + auras[one] = (auras[one] or 0) + 1 | ||
525 | + end | ||
526 | + end | ||
527 | + return auras | ||
528 | +end | ||
529 | + | ||
530 | +function Battle:setMapAuras(auras) | ||
531 | + self.auras[self.adv:getCurMapIdx()] = auras | ||
532 | +end | ||
533 | + | ||
534 | +function Battle:getAurasByMap(mapIdx) | ||
535 | + mapIdx = mapIdx or self.adv:getCurMapIdx() | ||
536 | + local auras = self.auras[mapIdx] or {} | ||
537 | + return auras | ||
538 | +end | ||
539 | + | ||
540 | +function Battle:getBuilds() | ||
541 | + local team = {} | ||
542 | + for _, build in pairs(self.builds[self.adv:getCurMapIdx()]) do | ||
543 | + if not build.isDead and not build.lock then -- 已经翻开的 | ||
544 | + table.insert(team, build) | ||
545 | + end | ||
546 | + end | ||
547 | + return team | ||
548 | +end | ||
549 | + | ||
550 | + | ||
438 | --写入数据 | 551 | --写入数据 |
439 | -function Battle:saveDB() | 552 | +function Battle:saveDB(advInfo) |
440 | for idx, mapEnemys in pairs(self.enemys) do | 553 | for idx, mapEnemys in pairs(self.enemys) do |
441 | for _, enemy in ipairs(mapEnemys) do | 554 | for _, enemy in ipairs(mapEnemys) do |
442 | local block = self.adv:getBlock(enemy.roomId, enemy.blockId, idx) | 555 | local block = self.adv:getBlock(enemy.roomId, enemy.blockId, idx) |
@@ -453,6 +566,7 @@ function Battle:saveDB() | @@ -453,6 +566,7 @@ function Battle:saveDB() | ||
453 | end | 566 | end |
454 | end | 567 | end |
455 | end | 568 | end |
569 | + advInfo.auras = self.auras | ||
456 | end | 570 | end |
457 | 571 | ||
458 | return Battle | 572 | return Battle |
459 | \ No newline at end of file | 573 | \ No newline at end of file |
src/adv/AdvBlock.lua
@@ -70,7 +70,7 @@ function Block:updateEvent(event, isInit) | @@ -70,7 +70,7 @@ function Block:updateEvent(event, isInit) | ||
70 | em[oldet] =1 | 70 | em[oldet] =1 |
71 | end | 71 | end |
72 | if newet then | 72 | if newet then |
73 | - em[oldet] =1 | 73 | + em[newet] =1 |
74 | end | 74 | end |
75 | 75 | ||
76 | local player = self.room.map.adv.battle.player | 76 | local player = self.room.map.adv.battle.player |
src/adv/AdvBuff.lua
@@ -460,7 +460,18 @@ function Buff:initNew(release, data) | @@ -460,7 +460,18 @@ function Buff:initNew(release, data) | ||
460 | end | 460 | end |
461 | end | 461 | end |
462 | 462 | ||
463 | -function Buff:createAfter() | 463 | +function Buff:createAfter(layer) |
464 | + layer = layer or 1 | ||
465 | + local otype, maxLayer = self:getOverlay() | ||
466 | + if otype then | ||
467 | + self.layer = layer | ||
468 | + if maxLayer ~= 0 then | ||
469 | + self.layer = math.min(maxLayer, self.layer) | ||
470 | + end | ||
471 | + else | ||
472 | + self.layer = 1 | ||
473 | + end | ||
474 | + | ||
464 | if self._init then | 475 | if self._init then |
465 | self:_init() | 476 | self:_init() |
466 | end | 477 | end |
@@ -647,12 +658,13 @@ function Buff:getOverlay() | @@ -647,12 +658,13 @@ function Buff:getOverlay() | ||
647 | end | 658 | end |
648 | 659 | ||
649 | -- 叠加 | 660 | -- 叠加 |
650 | -function Buff:overlay(releaser, data) | 661 | +function Buff:overlay(releaser, data, layer) |
651 | local otype, maxLayer = self:getOverlay() | 662 | local otype, maxLayer = self:getOverlay() |
652 | if self.isDel or not otype then -- 新获得的 (不可叠加相当于新获得的) | 663 | if self.isDel or not otype then -- 新获得的 (不可叠加相当于新获得的) |
653 | - self.isDel = false | ||
654 | self:endBuff() | 664 | self:endBuff() |
665 | + self.isDel = false | ||
655 | self:initNew(releaser, data) | 666 | self:initNew(releaser, data) |
667 | + self:createAfter(layer) | ||
656 | else | 668 | else |
657 | -- 重置回合 次数 | 669 | -- 重置回合 次数 |
658 | self.roundSpace = 0 | 670 | self.roundSpace = 0 |
@@ -665,7 +677,7 @@ function Buff:overlay(releaser, data) | @@ -665,7 +677,7 @@ function Buff:overlay(releaser, data) | ||
665 | 677 | ||
666 | self.release = releaser or self.release | 678 | self.release = releaser or self.release |
667 | -- 叠加层数 | 679 | -- 叠加层数 |
668 | - self.layer = self.layer + 1 | 680 | + self.layer = self.layer + layer |
669 | if maxLayer ~= 0 then | 681 | if maxLayer ~= 0 then |
670 | self.layer = math.min(maxLayer, self.layer) | 682 | self.layer = math.min(maxLayer, self.layer) |
671 | end | 683 | end |
@@ -676,14 +688,32 @@ function Buff:overlay(releaser, data) | @@ -676,14 +688,32 @@ function Buff:overlay(releaser, data) | ||
676 | end | 688 | end |
677 | 689 | ||
678 | -- 扣减层数 | 690 | -- 扣减层数 |
679 | -function Buff:uncover() | ||
680 | - if self.layer <= 1 then | 691 | +function Buff:uncover(layer, isAura) |
692 | + layer = layer or 1 | ||
693 | + local oldLayer = self.layer | ||
694 | + | ||
695 | + self.layer = self.layer - layer | ||
696 | + | ||
697 | + if self.layer <= 0 then | ||
681 | self.isDel = true | 698 | self.isDel = true |
682 | end | 699 | end |
683 | 700 | ||
684 | - self.layer = self.layer - 1 | ||
685 | - if self._uncover then | ||
686 | - self:_uncover() | 701 | + if isAura then |
702 | + if layer == -1 then | ||
703 | + self.layer = 0 | ||
704 | + self.isDel = true | ||
705 | + else | ||
706 | + self.layer = math.max(1, self.layer) | ||
707 | + self.isDel = false | ||
708 | + end | ||
709 | + end | ||
710 | + | ||
711 | + if self.isDel then return end | ||
712 | + | ||
713 | + if oldLayer ~= self.layer then | ||
714 | + if self._uncover then | ||
715 | + self:_uncover() | ||
716 | + end | ||
687 | end | 717 | end |
688 | end | 718 | end |
689 | 719 |
src/adv/AdvPlayer.lua
@@ -143,7 +143,8 @@ function BaseObject:getDisablePassiveCount() | @@ -143,7 +143,8 @@ function BaseObject:getDisablePassiveCount() | ||
143 | return count | 143 | return count |
144 | end | 144 | end |
145 | 145 | ||
146 | -function BaseObject:addBuff(buffId, releaser) | 146 | +function BaseObject:addBuff(buffId, releaser, layer) |
147 | + layer = layer or 1 | ||
147 | local buffData = csvdb["adv_map_buffCsv"][buffId] | 148 | local buffData = csvdb["adv_map_buffCsv"][buffId] |
148 | if not buffData then return end | 149 | if not buffData then return end |
149 | for _, buff in ipairs(self.buffs) do | 150 | for _, buff in ipairs(self.buffs) do |
@@ -157,7 +158,7 @@ function BaseObject:addBuff(buffId, releaser) | @@ -157,7 +158,7 @@ function BaseObject:addBuff(buffId, releaser) | ||
157 | local oldBuff = self:getBuffById(buffId) | 158 | local oldBuff = self:getBuffById(buffId) |
158 | if oldBuff then | 159 | if oldBuff then |
159 | if not oldBuff:checkKeep() then return end | 160 | if not oldBuff:checkKeep() then return end |
160 | - oldBuff:overlay(releaser, {}) -- 叠加 | 161 | + oldBuff:overlay(releaser, {}, layer) -- 叠加 |
161 | else | 162 | else |
162 | -- 不能保持的buff 也加不上去 | 163 | -- 不能保持的buff 也加不上去 |
163 | if not Buff.checkKeep({ | 164 | if not Buff.checkKeep({ |
@@ -167,7 +168,7 @@ function BaseObject:addBuff(buffId, releaser) | @@ -167,7 +168,7 @@ function BaseObject:addBuff(buffId, releaser) | ||
167 | }) then return end | 168 | }) then return end |
168 | local buff = Buff.create(self, releaser, {id = buffId}) | 169 | local buff = Buff.create(self, releaser, {id = buffId}) |
169 | table.insert(self.buffs, buff) | 170 | table.insert(self.buffs, buff) |
170 | - buff:createAfter() | 171 | + buff:createAfter(layer) |
171 | end | 172 | end |
172 | self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) | 173 | self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) |
173 | self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) | 174 | self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) |
@@ -224,6 +225,30 @@ end | @@ -224,6 +225,30 @@ end | ||
224 | function BaseObject:reSetSpMax() | 225 | function BaseObject:reSetSpMax() |
225 | end | 226 | end |
226 | 227 | ||
228 | +function BaseObject:checkAuraBuff(buffs) | ||
229 | +end | ||
230 | + | ||
231 | +function BaseObject:getAuras() | ||
232 | + local auras = {} | ||
233 | + if self:is("Enemy") then | ||
234 | + local halo = csvdb["event_monsterCsv"][self.monsterId].halo | ||
235 | + if halo then | ||
236 | + for _, one in ipairs(halo:toArray(true, "=")) do | ||
237 | + table.insert(auras, one) | ||
238 | + end | ||
239 | + end | ||
240 | + elseif self:is("Build") then | ||
241 | + local halo = csvdb["event_buildingCsv"][self.id].halo | ||
242 | + if halo then | ||
243 | + for _, one in ipairs(halo:toArray(true, "=")) do | ||
244 | + table.insert(auras, one) | ||
245 | + end | ||
246 | + end | ||
247 | + end | ||
248 | + | ||
249 | + return auras | ||
250 | +end | ||
251 | + | ||
227 | 252 | ||
228 | -- 通用的buff 效果汇总 -- 0 固定 1百分比 两种分类 | 253 | -- 通用的buff 效果汇总 -- 0 固定 1百分比 两种分类 |
229 | function BaseObject:getCommonBuffEffect(bType, otherCond) | 254 | function BaseObject:getCommonBuffEffect(bType, otherCond) |
@@ -625,6 +650,33 @@ function Enemy:getClassify() | @@ -625,6 +650,33 @@ function Enemy:getClassify() | ||
625 | return csvdb["event_monsterCsv"][self.monsterId].classify | 650 | return csvdb["event_monsterCsv"][self.monsterId].classify |
626 | end | 651 | end |
627 | 652 | ||
653 | +-- 0=所有 1=怪物 2=玩家 | ||
654 | +function Enemy:checkAuraBuff(buffs) | ||
655 | + local needBuffs = {} | ||
656 | + | ||
657 | + for buffId, info in pairs(buffs[0] or {}) do | ||
658 | + needBuffs[buffId] = needBuffs[buffId] or {} | ||
659 | + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count | ||
660 | + needBuffs[buffId].exist = info.exist | ||
661 | + end | ||
662 | + | ||
663 | + for buffId, info in pairs(buffs[1] or {}) do | ||
664 | + needBuffs[buffId] = needBuffs[buffId] or {} | ||
665 | + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count | ||
666 | + needBuffs[buffId].exist = info.exist | ||
667 | + end | ||
668 | + | ||
669 | + for buffId, info in pairs(needBuffs) do | ||
670 | + if info.count < 0 then | ||
671 | + local buff = self:getBuffById(buffId) | ||
672 | + if buff then | ||
673 | + buff:uncover(info.exist and -info.count or -1, true) | ||
674 | + end | ||
675 | + elseif count > 0 then | ||
676 | + self:addBuff(buffId, nil, info.count) | ||
677 | + end | ||
678 | + end | ||
679 | +end | ||
628 | 680 | ||
629 | function Enemy:kill() | 681 | function Enemy:kill() |
630 | self:hurt(self.hp, self.battle.player, {hurtType = 5}) | 682 | self:hurt(self.hp, self.battle.player, {hurtType = 5}) |
@@ -775,6 +827,33 @@ function Player:addBuff(buffId, releaser) | @@ -775,6 +827,33 @@ function Player:addBuff(buffId, releaser) | ||
775 | end | 827 | end |
776 | return status | 828 | return status |
777 | end | 829 | end |
830 | +-- 0=所有 1=怪物 2=玩家 | ||
831 | +function Player:checkAuraBuff(buffs) | ||
832 | + local needBuffs = {} | ||
833 | + | ||
834 | + for buffId, info in pairs(buffs[0] or {}) do | ||
835 | + needBuffs[buffId] = needBuffs[buffId] or {} | ||
836 | + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count | ||
837 | + needBuffs[buffId].exist = info.exist | ||
838 | + end | ||
839 | + | ||
840 | + for buffId, info in pairs(buffs[2] or {}) do | ||
841 | + needBuffs[buffId] = needBuffs[buffId] or {} | ||
842 | + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count | ||
843 | + needBuffs[buffId].exist = info.exist | ||
844 | + end | ||
845 | + | ||
846 | + for buffId, info in pairs(needBuffs) do | ||
847 | + if info.count < 0 then | ||
848 | + local buff = self:getBuffById(buffId) | ||
849 | + if buff then | ||
850 | + buff:uncover(info.exist and -info.count or -1, true) | ||
851 | + end | ||
852 | + elseif info.count > 0 then | ||
853 | + self:addBuff(buffId, nil, info.count) | ||
854 | + end | ||
855 | + end | ||
856 | +end | ||
778 | 857 | ||
779 | function Player:isPlayer() | 858 | function Player:isPlayer() |
780 | return true | 859 | return true |
src/models/Role.lua
@@ -103,7 +103,6 @@ Role.schema = { | @@ -103,7 +103,6 @@ Role.schema = { | ||
103 | --挂机相关 | 103 | --挂机相关 |
104 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 104 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
105 | hangGift = {"table", {}}, -- 挂机奖励 {id = 1} | 105 | hangGift = {"table", {}}, -- 挂机奖励 {id = 1} |
106 | - hangTeam = {"table", {}}, -- 挂机队伍 | ||
107 | hangTS = {"table", {}}, -- 挂机队伍他人可读的队伍信息 | 106 | hangTS = {"table", {}}, -- 挂机队伍他人可读的队伍信息 |
108 | hangTB = {"table", {}}, -- 挂机队伍他人可用的战斗信息mao | 107 | hangTB = {"table", {}}, -- 挂机队伍他人可用的战斗信息mao |
109 | hangTBV = {"number", 0}, -- 挂机队伍他人可用的战斗力 | 108 | hangTBV = {"number", 0}, -- 挂机队伍他人可用的战斗力 |
@@ -111,7 +110,6 @@ Role.schema = { | @@ -111,7 +110,6 @@ Role.schema = { | ||
111 | hangInfo = {"table", {}}, -- 当前挂机信息 | 110 | hangInfo = {"table", {}}, -- 当前挂机信息 |
112 | hangBag = {"table", {}}, -- 背包 | 111 | hangBag = {"table", {}}, -- 背包 |
113 | hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限 | 112 | hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限 |
114 | - bTeam = {"table", {}}, -- 奖励副本队伍 | ||
115 | hangTeams = {"table", {}}, -- pve自选编队 | 113 | hangTeams = {"table", {}}, -- pve自选编队 |
116 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType | 114 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType |
117 | advTeams = {"table", {}}, -- 拾荒自选编队 | 115 | advTeams = {"table", {}}, -- 拾荒自选编队 |
@@ -145,7 +143,6 @@ Role.schema = { | @@ -145,7 +143,6 @@ Role.schema = { | ||
145 | boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}} | 143 | boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}} |
146 | 144 | ||
147 | towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey} | 145 | towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey} |
148 | - towerF = {"table", {}}, -- 爬塔阵容 | ||
149 | 146 | ||
150 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} | 147 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} |
151 | 148 | ||
@@ -357,11 +354,9 @@ function Role:data() | @@ -357,11 +354,9 @@ function Role:data() | ||
357 | 354 | ||
358 | hangPass = self:getProperty("hangPass"), | 355 | hangPass = self:getProperty("hangPass"), |
359 | hangGift = self:getProperty("hangGift"), | 356 | hangGift = self:getProperty("hangGift"), |
360 | - hangTeam = self:getProperty("hangTeam"), | ||
361 | hangInfo = self:getProperty("hangInfo"), | 357 | hangInfo = self:getProperty("hangInfo"), |
362 | hangBag = self:getProperty("hangBag"), | 358 | hangBag = self:getProperty("hangBag"), |
363 | hangBagLimit = self:getProperty("hangBagLimit"), | 359 | hangBagLimit = self:getProperty("hangBagLimit"), |
364 | - bTeam = self:getProperty("bTeam"), | ||
365 | hangTeams = self:getProperty("hangTeams"), | 360 | hangTeams = self:getProperty("hangTeams"), |
366 | teamIndex = self:getProperty("teamIndex"), | 361 | teamIndex = self:getProperty("teamIndex"), |
367 | advTeams = self:getProperty("advTeams"), | 362 | advTeams = self:getProperty("advTeams"), |
@@ -380,7 +375,6 @@ function Role:data() | @@ -380,7 +375,6 @@ function Role:data() | ||
380 | equips = self:getProperty("equips"), | 375 | equips = self:getProperty("equips"), |
381 | boxL = self:getProperty("boxL"), | 376 | boxL = self:getProperty("boxL"), |
382 | towerInfo = self:getProperty("towerInfo"), | 377 | towerInfo = self:getProperty("towerInfo"), |
383 | - towerF = self:getProperty("towerF"), | ||
384 | spTask = self:getProperty("spTask"), | 378 | spTask = self:getProperty("spTask"), |
385 | dTask = self:getProperty("dTask"), | 379 | dTask = self:getProperty("dTask"), |
386 | wTask = self:getProperty("wTask"), | 380 | wTask = self:getProperty("wTask"), |
src/models/RoleBattle.lua
@@ -57,7 +57,6 @@ function Role:checkBattle(battleType, params) | @@ -57,7 +57,6 @@ function Role:checkBattle(battleType, params) | ||
57 | end | 57 | end |
58 | end, | 58 | end, |
59 | tower = function() | 59 | tower = function() |
60 | - --local towerF = self:getProperty("towerF") | ||
61 | local towerF = self:getTeamFormatByType(TeamSystemType.Tower) | 60 | local towerF = self:getTeamFormatByType(TeamSystemType.Tower) |
62 | for slot, hero in pairs(self:getTeamHerosInfo(towerF.heros)) do | 61 | for slot, hero in pairs(self:getTeamHerosInfo(towerF.heros)) do |
63 | selflist[slot] = hero.type | 62 | selflist[slot] = hero.type |
@@ -73,7 +72,6 @@ function Role:checkBattle(battleType, params) | @@ -73,7 +72,6 @@ function Role:checkBattle(battleType, params) | ||
73 | end | 72 | end |
74 | end, | 73 | end, |
75 | bonus = function() | 74 | bonus = function() |
76 | - --local bTeam = self:getProperty("bTeam") | ||
77 | local bTeam = self:getTeamFormatByType(TeamSystemType.BonusBattle) | 75 | local bTeam = self:getTeamFormatByType(TeamSystemType.BonusBattle) |
78 | for slot, hero in pairs(self:getTeamHerosInfo(bTeam.heros)) do | 76 | for slot, hero in pairs(self:getTeamHerosInfo(bTeam.heros)) do |
79 | selflist[slot] = hero.type | 77 | selflist[slot] = hero.type |
src/models/RolePlugin.lua
@@ -1135,7 +1135,6 @@ function RolePlugin.bind(Role) | @@ -1135,7 +1135,6 @@ function RolePlugin.bind(Role) | ||
1135 | local now = skynet.timex() | 1135 | local now = skynet.timex() |
1136 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 | 1136 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 |
1137 | local ct = 10000 - ct -- 越早的排名越靠前 | 1137 | local ct = 10000 - ct -- 越早的排名越靠前 |
1138 | - --local towerTeam = self:getProperty("towerF") | ||
1139 | local towerTeam = self:getTeamFormatByType(TeamSystemType.Tower) | 1138 | local towerTeam = self:getTeamFormatByType(TeamSystemType.Tower) |
1140 | local battleV = self:getTeamBattleValue(towerTeam.heros) | 1139 | local battleV = self:getTeamBattleValue(towerTeam.heros) |
1141 | local score = (level * 10000 + ct) * 10000000 + battleV | 1140 | local score = (level * 10000 + ct) * 10000000 + battleV |
@@ -1289,6 +1288,7 @@ function RolePlugin.bind(Role) | @@ -1289,6 +1288,7 @@ function RolePlugin.bind(Role) | ||
1289 | for slot, id in pairs(team.supports or {}) do | 1288 | for slot, id in pairs(team.supports or {}) do |
1290 | teamInfo.supports[slot] = {id, self.dinerData:getProperty("dishTree"):getv(id, 0)} | 1289 | teamInfo.supports[slot] = {id, self.dinerData:getProperty("dishTree"):getv(id, 0)} |
1291 | end | 1290 | end |
1291 | + teamInfo.tactics = globalCsv.tactics_skill_passive_cell[team.tactics] and team.tactics or nil | ||
1292 | return teamInfo | 1292 | return teamInfo |
1293 | end | 1293 | end |
1294 | 1294 | ||
@@ -1315,20 +1315,6 @@ function RolePlugin.bind(Role) | @@ -1315,20 +1315,6 @@ function RolePlugin.bind(Role) | ||
1315 | return self:getRealBattleValue(heros) | 1315 | return self:getRealBattleValue(heros) |
1316 | end | 1316 | end |
1317 | 1317 | ||
1318 | - -- 不传参数 只修改保存的阵容信息 | ||
1319 | - function Role:saveHangTeam(team) | ||
1320 | - if not team then | ||
1321 | - team = self:getProperty("hangTeam") | ||
1322 | - else | ||
1323 | - self:updateProperty({field = "hangTeam", value = team}) | ||
1324 | - end | ||
1325 | - self:setProperties({ | ||
1326 | - hangTS = self:getTeamHerosInfo(team.heros), | ||
1327 | - hangTB = self:getTeamBattleInfo(team), | ||
1328 | - hangTBV = self:getTeamBattleValue(team.heros), | ||
1329 | - }) | ||
1330 | - end | ||
1331 | - | ||
1332 | function Role:updateHangTeamInfo() | 1318 | function Role:updateHangTeamInfo() |
1333 | local team = self:getTeamFormatByType(TeamSystemType.Hang) | 1319 | local team = self:getTeamFormatByType(TeamSystemType.Hang) |
1334 | if not team then return end | 1320 | if not team then return end |