Commit 1d05db4889d437b7e24446bd0390d15597419844

Authored by 熊润斐
2 parents 648d9726 d93ec42c

Merge branch 'develop' into bugfix

src/GlobalVar.lua
... ... @@ -126,6 +126,7 @@ ItemId = {
126 126 HeroFC = {700, 701, 702, 703}, --通用角色碎片
127 127 AdvKey = 80, -- 冒险钥匙
128 128 BoxKey = 60, -- 拆解工具
  129 + AdvPower = 4701, -- 拾荒体力
129 130 }
130 131  
131 132 TimeReset = {
... ... @@ -322,4 +323,13 @@ DrawCardType = {
322 323 SpecifyDraw = 1,
323 324 NormalDraw = 2,
324 325 FriendDraw = 3
  326 +}
  327 +
  328 +-- 阵容系统类型
  329 +TeamSystemType = {
  330 + Hang = 1,
  331 + BonusBattle = 2,
  332 + Tower = 3,
  333 + Dinner = 4,
  334 + FriendBattle = 5,
325 335 }
326 336 \ No newline at end of file
... ...
src/ProtocolCode.lua
... ... @@ -49,6 +49,7 @@ actionCodes = {
49 49 Role_updateFeedbackInfoRpc = 133,
50 50 Role_useSelectItemRpc = 134, -- 使用多选一礼包
51 51 Role_broadGetSSR = 135, -- 全服广播 获得ssr英雄
  52 + Role_renameTeamRpc = 136, -- 编队改名
52 53  
53 54 Adv_startAdvRpc = 151,
54 55 Adv_startHangRpc = 152,
... ... @@ -71,6 +72,8 @@ actionCodes = {
71 72 Adv_rankRpc = 169,
72 73 Adv_quickHangRpc = 170,
73 74 Adv_refreshSupportRpc = 171,
  75 + Adv_selectTeamRpc = 172,
  76 + Adv_roleFormatRpc = 173,
74 77  
75 78 Hero_loadInfos = 201,
76 79 Hero_updateProperty = 202,
... ... @@ -96,6 +99,7 @@ actionCodes = {
96 99 Hero_unlockPoolRpc = 222,
97 100 Hero_changeCrown = 223,
98 101 Hero_drawHeroExtraRewardNtf = 224,
  102 + Hero_itemComposeRpc = 225,
99 103  
100 104 Hang_startRpc = 251,
101 105 Hang_checkRpc = 252,
... ... @@ -111,6 +115,7 @@ actionCodes = {
111 115 Hang_hangGiftRpc = 262,
112 116 Hang_bagFieldRpc = 263,
113 117 Hang_chatLineRpc = 264,
  118 + Hang_selectTeamRpc = 265,
114 119  
115 120 Diner_updateProperty = 300,
116 121 Diner_addSellRpc = 301,
... ... @@ -212,6 +217,9 @@ actionCodes = {
212 217 Activity_actPaySignRewardNtf = 654,
213 218 Activity_actCalendaTaskRpc = 655,
214 219 Activity_actPaySignRpc = 656,
  220 +
  221 + Radio_startQuestRpc = 700,
  222 + Radio_finishQuestRpc = 701,
215 223 }
216 224  
217 225 rpcResponseBegin = 10000
... ...
src/actions/AdvAction.lua
... ... @@ -47,6 +47,10 @@ local function checkFormat(role, format, checkAdvTeam)
47 47 end
48 48 end
49 49  
  50 + if not format then
  51 + format = role:getProperty("advTeam")
  52 + end
  53 +
50 54 if checkAdvTeam then
51 55 for _, heroId in pairs(role:getProperty("advTeam").heros or {}) do
52 56 hadHero[heroId] = true
... ... @@ -83,7 +87,7 @@ function _M.startAdvRpc( agent, data )
83 87 local msg = MsgPack.unpack(data)
84 88 local chapterId = msg.chapterId --关卡id
85 89 local layer = msg.layer or 1 --选择层数
86   - local format = msg.format --编队
  90 + --local format = msg.format --编队
87 91 local supportIdx = msg.supportIdx --选择的支援效果
88 92 if not role:isFuncUnlock(FuncUnlock.Adv) then return end
89 93  
... ... @@ -127,18 +131,18 @@ function _M.startAdvRpc( agent, data )
127 131 end
128 132 end
129 133  
130   - if not checkFormat(role, format) then return 7 end
131   -
132   - local advTeam = role:getProperty("advTeam")
133   - table.clear(advTeam)
134   -
135   - advTeam.heros = {}
136   - for slot, heroId in pairs(format.heros) do
137   - advTeam.heros[slot] = heroId
138   - end
139   - advTeam.leader = format.leader
140   - advTeam.leader2 = format.leader2
141   - role:updateProperty({field = "advTeam", value = advTeam})
  134 + if not checkFormat(role) then return 7 end
  135 +
  136 + --local advTeam = role:getProperty("advTeam")
  137 + --table.clear(advTeam)
  138 +
  139 + --advTeam.heros = {}
  140 + --for slot, heroId in pairs(format.heros) do
  141 + -- advTeam.heros[slot] = heroId
  142 + --end
  143 + --advTeam.leader = format.leader
  144 + --advTeam.leader2 = format.leader2
  145 + --role:updateProperty({field = "advTeam", value = advTeam})
142 146 if AdvCommon.isEndless(chapterId) then
143 147 role.dailyData:updateProperty({field = "advElC", delta = 1})
144 148 else
... ... @@ -243,13 +247,14 @@ function _M.startHangRpc(agent, data)
243 247 info.format.heros[slot] = heroId
244 248 end
245 249 info.time = skynet.timex() + adv_idle_time --挂机时间
  250 + info.duration = adv_idle_time
246 251 info.campId = campId
247 252 info.index = index
248 253  
249 254 -- 没有在战斗 用team来挂机了 把team清掉
250   - if not role:getAdvData():isRunning() then
251   - role:updateProperty({field = "advTeam", value = {}})
252   - end
  255 + --if not role:getAdvData():isRunning() then
  256 + -- role:updateProperty({field = "advTeam", value = {}})
  257 + --end
253 258 role:pushMsg({type = "adv", slot = chapterId, time = adv_idle_time})
254 259 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
255 260  
... ... @@ -261,6 +266,16 @@ function _M.startHangRpc(agent, data)
261 266 return true
262 267 end
263 268  
  269 +local function addHeroFaith(role, heroId, exp)
  270 + local hero = role.heros[heroId]
  271 + if not hero then
  272 + return
  273 + end
  274 +
  275 + hero:addHeroFaith(exp)
  276 + return hero:getProperty("faith")
  277 +end
  278 +
264 279 function _M.quickHangRpc(agent, data)
265 280 local role = agent.role
266 281 local msg = MsgPack.unpack(data)
... ... @@ -328,7 +343,7 @@ function _M.endHangRpc(agent, data)
328 343 end
329 344 adv_idle_time = adv_idle_time * 60
330 345  
331   - local reward, isFull, change
  346 + local reward, isFull, change, heroFaithMap
332 347 if skynet.timex() >= info.time then
333 348 -- 最新需求加成取消
334 349 --[[
... ... @@ -357,6 +372,14 @@ function _M.endHangRpc(agent, data)
357 372  
358 373 if not maxCampsite then return end
359 374 ]]
  375 + -- 增加英雄信赖
  376 + local exp = info.duration / 60
  377 + heroFaithMap = {}
  378 + for _, heroId in pairs(info.format.heros) do
  379 + local curFaith = addHeroFaith(role, heroId, exp)
  380 + heroFaithMap[heroId] = curFaith
  381 + end
  382 +
360 383 local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2
361 384  
362 385 local idleReward = totalReward:toNumMap()
... ... @@ -384,7 +407,7 @@ function _M.endHangRpc(agent, data)
384 407  
385 408 role:checkTaskEnter("AdvHang", {})
386 409  
387   - SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull}))
  410 + SendPacket(actionCodes.Adv_endHangRpc, MsgPack.pack({reward = reward, change = change, isFull = isFull, heroFaith = heroFaithMap}))
388 411 return true
389 412 end
390 413  
... ... @@ -504,25 +527,8 @@ function _M.useItemRpc(agent, data)
504 527 adv:cost({[itemId] = count}, {log = {desc = "useItem", int1 = itemId, int2 = count}})
505 528 adv:backUse({[itemId] = count})
506 529 end
507   -
508   - if itemId == 5020 then
509   - role:finishGuide(53)
510   - end
511   - adv:checkAchievement(adv.AchievType.UseItem, count, itemId)
512   - adv:mylog({desc = "useItem", int1 = itemId, int2 = count})
513   -
514   - role:log("mission_pick_use", {
515   - mission_threadid = adv.chapterId, -- 大地图ID
516   - mission_threadname = (csvdb["adv_chapterCsv"][adv.chapterId] or {})["chapter"] or "auto", -- 大地图名称
517   - mission_id = adv.level, -- 关卡ID
518   - item_id = itemId, -- 道具ID
519   - mission_pick_use_num = count, -- 道具使用量
520   - mission_sequenceid = adv.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志
521   - })
522   -
523   - for i = 1, count do
524   - adv:doActive(itemData.effect, target) -- target
525   - end
  530 +
  531 + adv:useItem(itemId, count, target)
526 532  
527 533 adv:afterRound()
528 534 adv:saveDB()
... ... @@ -950,4 +956,61 @@ function _M.refreshSupportRpc(agent, data)
950 956 return true
951 957 end
952 958  
  959 +function _M.roleFormatRpc(agent , data)
  960 + local role = agent.role
  961 + local msg = MsgPack.unpack(data)
  962 + local index = msg.index -- 阵容索引
  963 + local title = msg.title -- 阵容名称
  964 + local team = {}
  965 + for slot, heroId in pairs(msg.heros) do
  966 + if not role.heros[heroId] then
  967 + return 1
  968 + end
  969 + end
  970 +
  971 + if index > 10 then
  972 + return 2
  973 + end
  974 +
  975 + team.heros = {}
  976 + for slot, heroId in pairs(msg.heros) do
  977 + team.heros[slot] = heroId
  978 + end
  979 + team.leader = msg.leader
  980 + team.leader2 = msg.leader2
  981 + team.title = title
  982 + role:setAdvTeamFormat(index, team)
  983 +
  984 + local advTeam = role:getProperty("advTeam")
  985 + local curIndex = advTeam.index
  986 + if curIndex == index then
  987 + table.clear(advTeam)
  988 +
  989 + advTeam.heros = {}
  990 + for slot, heroId in pairs(msg.heros) do
  991 + advTeam.heros[slot] = heroId
  992 + end
  993 + advTeam.leader = msg.leader
  994 + advTeam.leader2 = msg.leader2
  995 + advTeam.index = index
  996 + role:updateProperty({field = "advTeam", value = advTeam})
  997 + end
  998 +
  999 + SendPacket(actionCodes.Adv_roleFormatRpc, '')
  1000 + return true
  1001 +end
  1002 +
  1003 +function _M.selectTeamRpc(agent, data)
  1004 + local role = agent.role
  1005 + local msg = MsgPack.unpack(data)
  1006 + local index = msg.index -- 阵容索引
  1007 + local team = role:getAdvTeamFormat(index)
  1008 + if not next(team) then return end
  1009 + team["index"] = index
  1010 + role:updateProperty({field = "advTeam", value = team})
  1011 +
  1012 + SendPacket(actionCodes.Adv_selectTeamRpc, '')
  1013 + return true
  1014 +end
  1015 +
953 1016 return _M
954 1017 \ No newline at end of file
... ...
src/actions/DinerAction.lua
... ... @@ -609,10 +609,10 @@ function _M.refreshTaskRpc( agent, data )
609 609 local role = agent.role
610 610 local msg = MsgPack.unpack(data)
611 611  
612   - local cost = {[ItemId.Diamond] = 40}
613   - if not role:checkItemEnough(cost) then
614   - return 1
615   - end
  612 + --local cost = {[ItemId.Diamond] = 40}
  613 + --if not role:checkItemEnough(cost) then
  614 + -- return 1
  615 + --end
616 616  
617 617 local orders = json.decode(role.dinerData:getProperty("order"))
618 618  
... ...
src/actions/GmAction.lua
... ... @@ -402,24 +402,23 @@ function _M.advl(role, pms)
402 402 return "成功"
403 403 end
404 404  
405   -table.insert(helpDes, {"冒险内等级增加", "advcl", "经验值"})
406   -function _M.advcl(role, pms)
407   - local exp = tonum(pms.pm1)
408   - local advData = role:getAdvData()
  405 +-- table.insert(helpDes, {"冒险内等级增加", "advcl", "经验值"})
  406 +-- function _M.advcl(role, pms)
  407 +-- local exp = tonum(pms.pm1)
  408 +-- local advData = role:getAdvData()
409 409  
410   - if not advData.chapterId then
411   - return "先随便开启一关"
412   - end
413   - advData.battle.player:addExp(exp)
414   - advData:saveDB()
415   - role:mylog("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender})
  410 +-- if not advData.chapterId then
  411 +-- return "先随便开启一关"
  412 +-- end
  413 +-- advData.battle.player:addExp(exp)
  414 +-- advData:saveDB()
  415 +-- role:mylog("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender})
416 416  
417   - return "成功"
418   -end
  417 +-- return "成功"
  418 +-- end
419 419  
420 420 table.insert(helpDes, {"挂机清除" , "idlec"})
421 421 function _M.idlec(role, pms)
422   - role:updateProperty({field = "hangTeam", value = {}})
423 422 role:updateProperty({field = "hangInfo", value = {}})
424 423 role:updateProperty({field = "hangBag", value = {}})
425 424 role:mylog("gm_action", {desc = "idlec", key1 = pms.sender})
... ...
src/actions/HangAction.lua
... ... @@ -269,7 +269,15 @@ function _M.endBattleRpc(agent, data)
269 269 local nextCarbonId = role:getNextCarbonId(carbonId)
270 270 -- 设置挂机关卡
271 271 if isWin then --and (hangInfo.carbonId or 0) < nextCarbonId then
272   - hangInfo.expCarbonId = carbonId
  272 + if not hangInfo.expCarbonId then
  273 + hangInfo.expCarbonId = carbonId
  274 + else
  275 + local oldCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId]
  276 + local newCarbonData = csvdb["idle_battleCsv"][carbonId]
  277 + if oldCarbonData.money < newCarbonData.money then
  278 + hangInfo.expCarbonId = carbonId
  279 + end
  280 + end
273 281 --local cfg = csvdb["idle_battleCsv"][nextCarbonId]
274 282 --if cfg then
275 283 -- hangInfo.bossTime = skynet.timex() + cfg.idle_time
... ... @@ -305,7 +313,10 @@ end
305 313 function _M.roleFormatRpc(agent , data)
306 314 local role = agent.role
307 315 local msg = MsgPack.unpack(data)
308   - local hangTeam = role:getProperty("hangTeam")
  316 + local index = msg.index -- 阵容索引
  317 + local title = msg.title -- 阵容名称
  318 + local tactics = msg.tactics -- 战术
  319 + local team = {}
309 320 for slot, heroId in pairs(msg.heros) do
310 321 if not role.heros[heroId] then
311 322 return 1
... ... @@ -321,15 +332,27 @@ function _M.roleFormatRpc(agent , data)
321 332 end
322 333 if not checkLeader(msg.heros, msg.leader) then return 4 end
323 334  
324   - table.clear(hangTeam)
325   - hangTeam.heros = {}
  335 + if index > 10 then
  336 + return 5
  337 + end
  338 +
  339 + if #title > 100 then
  340 + return 6
  341 + end
  342 +
  343 + team.heros = {}
326 344 for slot, heroId in pairs(msg.heros) do
327   - hangTeam.heros[slot] = heroId
  345 + team.heros[slot] = heroId
328 346 end
329   - hangTeam.leader = msg.leader
330   - hangTeam.supports = supports
331   - role:saveHangTeam(hangTeam)
332   - role:finishGuide(5)
  347 + team.leader = msg.leader
  348 + team.supports = supports
  349 + team.title = title
  350 + if msg.tactics and globalCsv.tactics_skill_passive_cell[msg.tactics] then
  351 + team.tactics = msg.tactics
  352 + end
  353 +
  354 + role:setTeamFormat(index, team)
  355 +
333 356 SendPacket(actionCodes.Hang_roleFormatRpc, '')
334 357 return true
335 358 end
... ... @@ -440,36 +463,6 @@ function _M.quickRpc(agent , data)
440 463 return true
441 464 end
442 465  
443   -function _M.bonusFormatRpc(agent , data)
444   - local role = agent.role
445   - local msg = MsgPack.unpack(data)
446   - local bTeam = role:getProperty("bTeam")
447   - for slot, heroId in pairs(msg.heros) do
448   - if not role.heros[heroId] then
449   - return
450   - end
451   - end
452   - local supports = {}
453   - for slot, support in pairs(msg.supports) do
454   - if slot ~= 1 and slot ~= 2 then return end
455   - local level = role.dinerData:getProperty("dishTree"):getv(support, 0)
456   - if level <= 0 then return end
457   - supports[slot] = support
458   - end
459   - if not checkLeader(msg.heros, msg.leader) then return end
460   -
461   - table.clear(bTeam)
462   - bTeam.heros = {}
463   - for slot, heroId in pairs(msg.heros) do
464   - bTeam.heros[slot] = heroId
465   - end
466   - bTeam.leader = msg.leader
467   - bTeam.supports = supports
468   -
469   - role:updateProperty({field = "bTeam", value = bTeam})
470   - SendPacket(actionCodes.Hang_bonusFormatRpc, '')
471   - return true
472   -end
473 466  
474 467 function _M.buyBonusCountRpc(agent, data)
475 468 local role = agent.role
... ... @@ -505,10 +498,53 @@ function _M.buyBonusCountRpc(agent, data)
505 498 return true
506 499 end
507 500  
  501 +local function bonusWinReward(role, bonusData, bwin, count)
  502 + count = count or 1
  503 + local open, actId = role.activity:isOpen("BonusDouble")
  504 + local actData = csvdb["activity_ctrlCsv"][actId]
  505 + local extraCnt = role.storeData:getBonusExtraFightCount()
  506 +
  507 + local coef = 1
  508 + if open and actData then
  509 + coef = tonumber(actData.condition2)
  510 + end
  511 + local bonusC = role.dailyData:getProperty("bonusC")
  512 + bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0}
  513 + if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] < count then return false, 1 end
  514 + bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count
  515 + role.dailyData:updateProperty({field = "bonusC", value = bonusC})
  516 +
  517 + local reward, change
  518 + reward = bonusData.reward:toNumMap()
  519 + for itemId, c in pairs(reward) do
  520 + reward[itemId] = c * count
  521 + end
  522 + for i = 1, count do
  523 + local chance = bonusData.chance:randWeight(true)
  524 + if chance[1] ~= 0 then
  525 + reward[chance[1]] = (reward[chance[1]] or 0) + chance[2]
  526 + end
  527 + end
  528 +
  529 + for k, v in pairs(reward) do
  530 + reward[k] = v * (coef > 1 and actData.condition or 1)
  531 + end
  532 +
  533 + if bwin then -- 满星 额外奖励
  534 + for k, v in pairs(bonusData.perfect_reward:toNumMap()) do
  535 + reward[k] = (reward[k] or 0) + v
  536 + end
  537 + end
  538 + reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}})
  539 + role:checkTaskEnter("BonusPass", {id = id, count = count})
  540 + return true, reward, change
  541 +end
  542 +
508 543 function _M.startBonusBattleRpc(agent, data)
509 544 local role = agent.role
510 545 local msg = MsgPack.unpack(data)
511 546 local id = msg.id
  547 + local count = msg.count or 1
512 548  
513 549 local open, actId = role.activity:isOpen("BonusDouble")
514 550  
... ... @@ -523,8 +559,6 @@ function _M.startBonusBattleRpc(agent, data)
523 559 if not bonusData then return 3 end
524 560 if not role:checkHangPass(bonusData.unlock) then return 4 end
525 561  
526   - if not next(role:getProperty("bTeam")) then return 5 end
527   -
528 562 local bonusC = role.dailyData:getProperty("bonusC")
529 563 bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0}
530 564  
... ... @@ -535,15 +569,24 @@ function _M.startBonusBattleRpc(agent, data)
535 569 if open and actData then
536 570 coef = tonumber(actData.condition2)
537 571 end
  572 +
  573 + if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end
538 574  
539   - if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] <= 0 then return 7 end
540   -
  575 + local bonusStar = role:getProperty("bonusStar")
  576 + if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then
  577 + local status, reward, change = bonusWinReward(role, bonusData, nil, count)
  578 + if not status then return 10 * (reward or 0) end
  579 + SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change}))
  580 + else
  581 + local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle)
  582 + if not next(bTeam) then return 5 end
  583 + role.__bonusBattleCache = {
  584 + key = tostring(math.random()),
  585 + id = id,
  586 + }
  587 + SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({key = role.__bonusBattleCache.key}))
  588 + end
541 589  
542   - role.__bonusBattleCache = {
543   - key = tostring(math.random()),
544   - id = id,
545   - }
546   - SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({key = role.__bonusBattleCache.key}))
547 590 return true
548 591 end
549 592  
... ... @@ -554,14 +597,7 @@ function _M.endBonusBattleRpc(agent, data)
554 597 local key = msg.key
555 598 local starNum = msg.starNum
556 599 if not role.__bonusBattleCache then return 1 end
557   - local open, actId = role.activity:isOpen("BonusDouble")
558   - local actData = csvdb["activity_ctrlCsv"][actId]
559   - local extraCnt = role.storeData:getBonusExtraFightCount()
560   -
561   - local coef = 1
562   - if open and actData then
563   - coef = tonumber(actData.condition2)
564   - end
  600 +
565 601  
566 602 if role.__bonusBattleCache.id ~= id or role.__bonusBattleCache.key ~= key then
567 603 SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1}))
... ... @@ -570,24 +606,79 @@ function _M.endBonusBattleRpc(agent, data)
570 606 local bonusData = csvdb["bonus_battleCsv"][id]
571 607  
572 608 local reward, change
  609 +
  610 + local bonusStar = role:getProperty("bonusStar")
  611 + local curStar = 0
573 612 if starNum and starNum > 0 then
574 613 -- 胜利扣除次数
575   - local bonusC = role.dailyData:getProperty("bonusC")
576   - bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0}
577   - if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] <= 0 then return 3 end
578   - bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1
579   - role.dailyData:updateProperty({field = "bonusC", value = bonusC})
580   -
581   - reward = bonusData.reward:toNumMap()
582   - local chance = bonusData.chance:randWeight(true)
583   - if chance[1] ~= 0 then
584   - reward[chance[1]] = (reward[chance[1]] or 0) + chance[2]
  614 +
  615 + local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle)
  616 + local herosInfo = role:getTeamHerosInfo(bTeam.heros)
  617 +
  618 + local check = {}
  619 + -- 1 通关
  620 + check[1] = function(_)
  621 + return true
585 622 end
586   - for k, v in pairs(reward) do
587   - reward[k] = v * (coef > 1 and actData.condition or 1)
  623 + -- 2 阵亡人数 <= N
  624 + check[2] = function(_, cond)
  625 + return msg.info.dead and msg.info.dead <= cond
588 626 end
589   - reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}})
590   - role:checkTaskEnter("BonusPass", {id = id})
  627 + -- 3 全员存活
  628 + check[3] = function(_)
  629 + return msg.info.dead and msg.info.dead == 0
  630 + end
  631 + -- 4 指定种族 >= N
  632 + check[4] = function(_, cond)
  633 + local count = 0
  634 + for _, one in pairs(herosInfo) do
  635 + local heroData = csv["unitCsv"][one.type]
  636 + if heroData.camp == cond then
  637 + count = count + 1
  638 + end
  639 + end
  640 + return count >= cond
  641 + end
  642 + -- 5 指定职业 >= N
  643 + check[5] = function(_, cond)
  644 + local count = 0
  645 + for _, one in pairs(herosInfo) do
  646 + local heroData = csv["unitCsv"][one.type]
  647 + if heroData.job == cond then
  648 + count = count + 1
  649 + end
  650 + end
  651 + return count >= cond
  652 + end
  653 + -- 6 含有指定角色
  654 + check[6] = function(_, cond)
  655 + for _, one in pairs(herosInfo) do
  656 + if one.type == cond then
  657 + return true
  658 + end
  659 + end
  660 + return false
  661 + end
  662 + -- 7 通关耗时 <= X 秒 msg.info.atime
  663 + check[7] = function(_, cond)
  664 + return msg.info.atime and msg.info.atime <= cond
  665 + end
  666 + curStar = 0
  667 + local sweepConds = bonusData.sweep_condition:toTableArray(true)
  668 + for i, cond in ipairs(sweepConds) do
  669 + if check[cond[1]] and check[cond[1]](table.unpack(cond)) then
  670 + curStar = curStar + (1 << (i - 1))
  671 + end
  672 + end
  673 + local status
  674 + status, reward, change = bonusWinReward(role, bonusData, curStar >= (1 << #sweepConds) - 1)
  675 + if not status then return 10 + (reward or 0) end
  676 + else
  677 + curStar = 0
  678 + end
  679 + if curStar ~= bonusStar[id] then
  680 + bonusStar[id] = curStar
  681 + role:updateProperty({field = "bonusStar", value = bonusStar})
591 682 end
592 683  
593 684 role:checkBattle("bonus", {
... ... @@ -666,4 +757,29 @@ function _M.chatLineRpc(agent, data)
666 757 return true
667 758 end
668 759  
669   -return _M
670 760 \ No newline at end of file
  761 +function _M.selectTeamRpc(agent, data)
  762 + local role = agent.role
  763 + local msg = MsgPack.unpack(data)
  764 + local index = msg.index -- 阵容索引
  765 + local type = msg.type -- 系统类型
  766 +
  767 + if index > 10 then
  768 + return 1
  769 + end
  770 + local team = role:getTeamFormat(index)
  771 + if not next(team) then return 2 end
  772 +
  773 + local teamIndex = role:getProperty("teamIndex") or {}
  774 + teamIndex[type] = index
  775 + role:updateProperty({field = "teamIndex", value = teamIndex})
  776 +
  777 + if type == TeamSystemType.Hang then
  778 + role:finishGuide(5)
  779 + role:updateHangTeamInfo()
  780 + end
  781 +
  782 + SendPacket(actionCodes.Hang_selectTeamRpc, '')
  783 + return true
  784 +end
  785 +
  786 +return _M
... ...
src/actions/HeroAction.lua
... ... @@ -143,74 +143,45 @@ function _M.talentRpc(agent, data)
143 143 local hero = role.heros[msg.id]
144 144 if not hero then return 1 end
145 145  
146   - local index = msg.index -- 第几个天赋
147   - local need = {[0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1}
148   - if not need[index] then return 2 end
149   -
150 146 local talent = hero:getProperty("talent")
  147 + local heroCfgId = hero:getProperty("type")
151 148 local curStage = talent:getv(0, 1)
152   - local curData = csvdb["unit_talentCsv"][curStage]
153   - if not curData then return 4 end
  149 + local curLevel = talent:getv(1, 1)
  150 + local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][curStage]
  151 + if not curData then return 1 end
154 152 local oldSkillLv = hero:getSkillLevel(1)
155 153  
156 154  
157 155 local cost = {}
158   - if index == 0 then
159   - --是否进阶
160   - local max = true
161   - for i = 1, 4 do
162   - if talent:getv(i, 0) < #curData then
163   - max = false
164   - break
165   - end
166   - end
167   - if max then
168   - talent = talent:setv(0, curStage + 1)
169   - for i = 1, 4 do
170   - talent = talent:setv(i, 0)
171   - end
172   - else
173   - return 12
174   - end
  156 + if curLevel == #curData then
  157 + talent = talent:setv(0, curStage + 1)
  158 + talent = talent:setv(1, 1)
175 159 else
176   -
177   - local level = talent:getv(index, 0)
178   - if level >= #curData then return 5 end
  160 + if curLevel > #curData then return 2 end
179 161  
180   - local talentData = curData[level]
181   - if not talentData then return end
  162 + local talentData = curData[curLevel]
  163 + if not talentData then return 3 end
182 164  
183   - if talentData.lvRequire > hero:getProperty("level") then return 6 end
  165 + if talentData.lvRequire > hero:getProperty("level") then return 4 end
184 166  
185 167 cost = talentData.money:toNumMap()
186   - local cost2 = talentData.cost:toNumMap()
187   - for k,v in pairs(cost2) do
188   - cost[globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp][k]] = v
189   - end
190   - if not role:checkItemEnough(cost) then return 6 end
  168 + if not role:checkItemEnough(cost) then return 5 end
191 169 role:costItems(cost, {log = {desc = "heroTalent", int1 = msg.id, int2 = hero:getProperty("type")}})
192   - talent = talent:incrv(index, 1)
193   -
194   -
195   - local aheadLevel = 0
196   - for i = 1, talent:getv(0, 1) - 1 do
197   - aheadLevel = aheadLevel + #csvdb["unit_talentCsv"][i]
198   - end
199   - aheadLevel = aheadLevel + talent:getv(index, 0)
200   -
201   - role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = aheadLevel})
  170 + talent = talent:setv(1, curLevel + 1)
202 171 end
  172 + curStage = talent:getv(0, 1)
  173 + role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage})
203 174  
204 175 hero:updateProperty({field = "talent", value = talent})
205 176  
206 177 role:log("hero_talent", {
207 178 hero_id = hero:getProperty("type"), --英雄ID
208   - hero_talent_id = index, --天赋ID
  179 + hero_talent_id = curStage, --天赋ID
209 180 hero_talent_cost = cost, -- 英雄天赋升级消耗,json格式记录,{道具ID1:消耗数量1,道具ID2:消耗数量2,………...}
210 181 hero_talent_levelbef = oldSkillLv, -- 英雄技能升级前等级
211 182 hero_talent_level = hero:getSkillLevel(1), -- 英雄技能升级后等级
212 183 })
213   - hero:mylog({desc = "talent", int1 = index, int2 = talent:getv(index, 0)})
  184 + hero:mylog({desc = "talent", int1 = talent:getv(0, 1), int2 = talent:getv(1, 1)})
214 185  
215 186 SendPacket(actionCodes.Hero_talentRpc, '')
216 187 return true
... ... @@ -633,6 +604,7 @@ end
633 604 function _M.getResetRewardRpc(agent, data)
634 605 local role = agent.role
635 606 local msg = MsgPack.unpack(data)
  607 + local pay = msg.pay
636 608  
637 609 local hero = role.heros[msg.id]
638 610 if not hero then return end
... ... @@ -640,9 +612,19 @@ function _M.getResetRewardRpc(agent, data)
640 612 local level = hero:getProperty("level")
641 613 local breakL = hero:getProperty("breakL")
642 614 local talent = hero:getProperty("talent")
  615 + local heroCfgId = hero:getProperty("type")
643 616  
  617 + local tmpLevel = level
644 618 if level <= 1 and talent == "" then return end
645 619  
  620 + if level <= 60 then
  621 + pay = false
  622 + end
  623 +
  624 + if pay and not role:costDiamond({count = globalCsv.unit_heroBack_cost or 200, log = {desc = "resetHero", int1 = msg.id}}) then
  625 + return 1
  626 + end
  627 +
646 628 local reward = {}
647 629 while level > 1 do
648 630 local curData = csvdb["unit_expCsv"][level - 1]
... ... @@ -659,32 +641,18 @@ function _M.getResetRewardRpc(agent, data)
659 641 end
660 642  
661 643 local stage = talent:getv(0, 1)
662   - local tlevel = {talent:getv(1, 0), talent:getv(2, 0), talent:getv(3, 0), talent:getv(4, 0)}
  644 + local curTalentLvl = talent:getv(1, 1)
  645 + --local tlevel = {talent:getv(1, 0), talent:getv(2, 0), talent:getv(3, 0), talent:getv(4, 0)}
663 646  
664   - local talentCostIds = globalCsv.unit_talent_cost[csvdb["unitCsv"][hero:getProperty("type")].camp]
665 647 while stage > 0 do
666   - local curData = csvdb["unit_talentCsv"][stage]
667   - for level = math.max(table.unpack(tlevel)), 1, -1 do
668   - local add = 0
669   - for i = 1, 4 do
670   - if tlevel[i] == level then
671   - add = add + 1
672   - tlevel[i] = tlevel[i] - 1
673   - end
674   - end
675   - local talentData = curData[level - 1]
  648 + local curData = csvdb["unit_talent_"..heroCfgId.."Csv"][stage]
  649 + for lvl = 1, curTalentLvl - 1 do
  650 + local talentData = curData[lvl]
676 651 for itemId, count in pairs(talentData.money:toNumMap()) do
677   - reward[itemId] = (reward[itemId] or 0) + count * add
678   - end
679   - for idx , count in pairs(talentData.cost:toNumMap()) do
680   - reward[talentCostIds[idx]] = (reward[talentCostIds[idx]] or 0) + count * add
  652 + reward[itemId] = (reward[itemId] or 0) + count
681 653 end
682 654 end
683 655 stage = stage - 1
684   - curData = csvdb["unit_talentCsv"][stage]
685   - if curData then
686   - tlevel = {#curData, #curData, #curData, #curData}
687   - end
688 656 end
689 657  
690 658 local equip = hero:getProperty("equip")
... ... @@ -708,9 +676,11 @@ function _M.getResetRewardRpc(agent, data)
708 676 rune = "",
709 677 })
710 678 hero:mylog({desc = "resetHero"})
711   -
  679 +
  680 + local coef = globalCsv.unit_back_discount
  681 + coef = (pay or tmpLevel <= 60) and 1 or coef
712 682 for itemId, count in pairs(reward) do
713   - reward[itemId] = math.floor(count * globalCsv.unit_back_discount)
  683 + reward[itemId] = math.floor(count * coef)
714 684 end
715 685 local change
716 686 reward, change = role:award(reward, {log = {desc = "resetHero", int1 = msg.id, int2 = hero:getProperty("type")}})
... ... @@ -1068,4 +1038,23 @@ function _M.changeCrown(agent, data)
1068 1038 return true
1069 1039 end
1070 1040  
  1041 +function _M.itemComposeRpc(agent, data)
  1042 + local role = agent.role
  1043 + local msg = MsgPack.unpack(data)
  1044 +
  1045 + local itemId = msg.id
  1046 + local count = msg.count
  1047 + if not csvdb["itemCsv"][itemId] then return 1 end
  1048 + local config = csvdb["item_processCsv"][itemId]
  1049 + if not config then return 2 end
  1050 +
  1051 + local cost = config.cost:toNumMap()
  1052 + if not role:checkItemEnough(cost) then return 2 end
  1053 + role:costItems(cost, {log = {desc = "itemCompose", int1 = itemId, int2 = count}})
  1054 + role:award({[itemId] = count}, {log = {desc = "itemCompose"}})
  1055 +
  1056 + SendPacket(actionCodes.Hero_itemComposeRpc, "")
  1057 + return true
  1058 +end
  1059 +
1071 1060 return _M
... ...
src/actions/PvpAction.lua
... ... @@ -50,6 +50,9 @@ function _M.formatCommonRpc(agent , data)
50 50 end
51 51 pvpTC.leader = msg.leader
52 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 57 role:savePvpCTeam(pvpTC)
55 58 SendPacket(actionCodes.Pvp_formatCommonRpc, '')
... ... @@ -92,6 +95,9 @@ function _M.formatHighRpc(agent , data)
92 95 curTeam.heros = team.heros
93 96 curTeam.leader = team.leader
94 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 102 table.insert(pvpTH, curTeam)
97 103 end
... ... @@ -462,6 +468,10 @@ function _M.startBattleHRpc(agent, data)
462 468 curTeam.heros = team.heros
463 469 curTeam.leader = team.leader
464 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 476 table.insert(pvpTH, curTeam)
467 477 end
... ...
src/actions/RadioAction.lua 0 → 100644
... ... @@ -0,0 +1,165 @@
  1 +local _M = {}
  2 +
  3 +-- 获取英雄大成功率
  4 +local function getHeroCoef(hero, condition)
  5 + -- 基础概率
  6 + local rareMap = {[HeroQuality.N] = 10, [HeroQuality.R] = 10, [HeroQuality.SR] = 15, [HeroQuality.SSR] = 20}
  7 + local rare = hero:getRare()
  8 + local result = 0
  9 + for _, it in ipairs(condition:toTableArray(true)) do
  10 + local type = it[1]
  11 + local value = it[2]
  12 + local add = it[3]
  13 + if type == 1 then -- 种族加成
  14 + if hero:getCamp() == value then
  15 + result = result + add
  16 + end
  17 + elseif type == 2 then -- 定位加成
  18 + if hero:getPosition() == value then
  19 + result = result + add
  20 + end
  21 + end
  22 + end
  23 +
  24 + return result + (rareMap[rare] or 0)
  25 +end
  26 +
  27 +local function getQuestMax(role)
  28 + local count = 0
  29 + for _, carbonId in ipairs(globalCsv.crusade_team_unlock or {}) do
  30 + if role:checkHangPass(carbonId) then
  31 + count = count + 1
  32 + end
  33 + end
  34 +
  35 + return count + (globalCsv.cursade_team_count_initial or 0)
  36 +end
  37 +
  38 +function _M.startQuestRpc(agent, data)
  39 + local role = agent.role
  40 + local msg = MsgPack.unpack(data)
  41 + local id = msg.id
  42 + local heros = msg.heros
  43 + local result = {}
  44 + local radioTask = role:getProperty("radioTask")
  45 + if table.numbers(radioTask) >= getQuestMax(role) then
  46 + return 1
  47 + end
  48 + -- check id
  49 + local config = csvdb["crusadeCsv"][id]
  50 + if not config then return 2 end
  51 + if not role:checkHangPass(config.unlock) then return 3 end
  52 + if radioTask[id] then return 4 end
  53 + -- check hero
  54 + --1=指定等级=人数
  55 + --2=指定稀有度=人数
  56 + --3=人数
  57 + local needHeroCnt = 0
  58 + local lvlMap = {}
  59 + local rareMap = {}
  60 + for _, it in ipairs(config.condition:toTableArray(true)) do
  61 + local type = it[1]
  62 + if type == 1 then
  63 + lvlMap[1] = it[2]
  64 + lvlMap[2] = it[3]
  65 + elseif type == 2 then
  66 + rareMap[1] = it[2]
  67 + rareMap[2] = it[3]
  68 + elseif type == 3 then
  69 + needHeroCnt = it[2]
  70 + end
  71 + end
  72 + for _, heroId in ipairs(heros) do
  73 + local hero = role.heros[heroId]
  74 + if hero then
  75 + needHeroCnt = needHeroCnt - 1
  76 + if next(lvlMap) then
  77 + if hero:getProperty("level") >= lvlMap[1] then
  78 + lvlMap[2] = lvlMap[2] - 1
  79 + if lvlMap[2] <= 0 then
  80 + lvlMap = {}
  81 + end
  82 + end
  83 + end
  84 + if next(rareMap) then
  85 + if hero:getRare() >= rareMap[1] then
  86 + rareMap[2] = rareMap[2] - 1
  87 + end
  88 + if rareMap[2] <= 0 then
  89 + rareMap = {}
  90 + end
  91 + end
  92 + end
  93 + end
  94 + if needHeroCnt > 0 or next(rareMap) or next(lvlMap) then
  95 + return 5
  96 + end
  97 + -- start quest, set finish time
  98 + local taskData = {}
  99 + taskData["time"] = skynet.timex() + config.time
  100 + taskData["heros"] = heros
  101 + radioTask[id] = taskData
  102 + role:updateProperty({field="radioTask", value=radioTask, notNotify=true})
  103 +
  104 + SendPacket(actionCodes.Radio_startQuestRpc, MsgPack.pack({id=id, task=taskData}))
  105 + return true
  106 +end
  107 +
  108 +function _M.finishQuestRpc(agent, data)
  109 + local role = agent.role
  110 + local msg = MsgPack.unpack(data)
  111 + local id = msg.id
  112 + -- check finish time
  113 + local radioTask = role:getProperty("radioTask")
  114 + local task = radioTask[id]
  115 + if not task then return 1 end
  116 + if skynet.timex() < task.time then return 2 end
  117 + -- check id
  118 + local config = csvdb["crusadeCsv"][id]
  119 + if not config then return 3 end
  120 + local carbonData = csvdb["idle_battleCsv"][config.unlock]
  121 + if not carbonData then return 4 end
  122 + -- get heros
  123 + local totalCoef = 0
  124 + local exp = config.time / 60
  125 + heroFaithMap = {}
  126 + for _, heroId in ipairs(task.heros) do
  127 + local hero = role.heros[heroId]
  128 + if hero then
  129 + totalCoef = totalCoef + getHeroCoef(hero, config.success)
  130 + -- 增加英雄信赖
  131 + hero:addHeroFaith(exp)
  132 + heroFaithMap[heroId] = hero:getProperty("faith")
  133 + end
  134 + end
  135 + -- send award
  136 + local bigSuccess = false
  137 + local result = math.randomInt(0, 100)
  138 + if result < totalCoef then
  139 + bigSuccess = true
  140 + end
  141 + local money = math.ceil(carbonData.money / 5) * config.time * config.money_clear
  142 + local exp = math.ceil(carbonData.exp / 5) * config.time * config.exp_clear
  143 + local itemReward = config.item_clear_special:toNumMap()
  144 + itemReward[ItemId.Gold] = (itemReward[ItemId.Gold] or 0) + money
  145 + itemReward[ItemId.Exp] = (itemReward[ItemId.Exp] or 0) + exp
  146 + if bigSuccess then
  147 + for key, value in pairs(itemReward) do
  148 + itemReward[key] = math.ceil(1.5 * value)
  149 + end
  150 + end
  151 +
  152 + local r, change = role:award(itemReward, {log = {desc = "radioQuest", int1 = id}})
  153 +
  154 + radioTask[id] = nil
  155 + role:updateProperty({field="radioTask", value=radioTask, notNotify = true})
  156 +
  157 + local msg = role:packReward(r, change)
  158 + msg["big"] = bigSuccess
  159 + msg["id"] = id
  160 + msg["heroFaith"] = heroFaithMap
  161 + SendPacket(actionCodes.Radio_finishQuestRpc, MsgPack.pack(msg))
  162 + return true
  163 +end
  164 +
  165 +return _M
0 166 \ No newline at end of file
... ...
src/actions/RoleAction.lua
... ... @@ -291,7 +291,7 @@ function _M.loginRpc( agent, data )
291 291  
292 292  
293 293 -- 玩家登陆做的一些操作
294   - role:saveHangTeam()
  294 + role:updateHangTeamInfo()
295 295 role:savePvpCTeam()
296 296 role:savePvpHTeam()
297 297  
... ... @@ -1255,4 +1255,28 @@ function _M.useSelectItemRpc(agent, data)
1255 1255 return true
1256 1256 end
1257 1257  
  1258 +function _M.renameTeamRpc(agent, data)
  1259 + local role = agent.role
  1260 + local msg = MsgPack.unpack(data)
  1261 + local title = msg.title
  1262 + local index = msg.index
  1263 + local ispve = msg.ispve
  1264 + if ispve then
  1265 + local teams = role:getProperty("hangTeams")
  1266 + local team = role:getTeamFormat(index)
  1267 + team.title = title
  1268 + teams[index] = team
  1269 + role:updateProperty({field = "hangTeams", value = teams, notNotify = false})
  1270 + else
  1271 + local teams = role:getProperty("advTeams")
  1272 + local team = role:getAdvTeamFormat(index)
  1273 + team.title = title
  1274 + teams[index] = team
  1275 + role:updateProperty({field = "advTeams", value = teams, notNotify = false})
  1276 + end
  1277 +
  1278 + SendPacket(actionCodes.Role_renameTeamRpc, "")
  1279 + return true
  1280 +end
  1281 +
1258 1282 return _M
1259 1283 \ No newline at end of file
... ...
src/actions/TowerAction.lua
... ... @@ -8,36 +8,6 @@ local MsgPack = MsgPack
8 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 12 local function getUpdateTime(lastCount, lastTime)
43 13 local nextCount, nextTime = lastCount, skynet.timex()
... ...
src/adv/Adv.lua
... ... @@ -102,6 +102,9 @@ function Adv:initByChapter(params)
102 102 self.cacheUnlock = self.cacheUnlock or {}
103 103 self.shopStatus = self.shopStatus or {}
104 104 self.support = self.support or {}
  105 + if self.battle then
  106 + self.battle:overBattle()
  107 + end
105 108 self.battle = nil -- 清掉 老的 battle
106 109 self.logid = self.owner:getActionUcode()
107 110  
... ... @@ -211,7 +214,7 @@ function Adv:saveDB(notNotify)
211 214 advInfo.logid = self.logid
212 215 advInfo.maps = {}
213 216  
214   - self.battle:saveDB()
  217 + self.battle:saveDB(advInfo)
215 218  
216 219 for id , map in ipairs(self.maps) do
217 220 advInfo.maps[id] = map:getDB()
... ... @@ -468,6 +471,11 @@ function Adv:initBattle(notDb)
468 471 if notDb and self.level ~= 1 then
469 472 self.battle.player:attrChangeCondBuffCheck(1)
470 473 end
  474 +
  475 + -- 初始化
  476 + if notDb then
  477 + self.battle:newBattle()
  478 + end
471 479 end
472 480  
473 481 function Adv:triggerPassive(condType, params)
... ... @@ -936,7 +944,7 @@ end
936 944  
937 945 -- log long1 字段被征用!!!
938 946 -- 在冒险中获得的物品都发放在冒险背包内
939   -function Adv:award(gift, params)
  947 +function Adv:award(gift, params, backRewardParams)
940 948 params = params or {}
941 949 local tgift = {}
942 950 if type(gift) == "string" then
... ... @@ -948,6 +956,8 @@ function Adv:award(gift, params)
948 956 end
949 957 local items = self.owner:getProperty("advItems")
950 958 local oldItems = items
  959 +
  960 + local autoUse = {}
951 961 for itemId, count in pairs(tgift) do
952 962 if count > 0 then
953 963 local buffAdd = self.battle.player:getRewardChange(itemId)
... ... @@ -956,41 +966,45 @@ function Adv:award(gift, params)
956 966 self:checkAchievement(Adv.AchievType.GetItem, count, itemId)
957 967 end
958 968 tgift[itemId] = count
959   - local origin = items:getv(itemId, 0)
960   - local nums = origin + count
961   -
962   - if csvdb["adv_artifactCsv"][itemId] then -- 获得神器
963   - self:awardArtifact(itemId, params)
964   - if not self.owner:checkOverGuide(55) then
965   - self.owner:saveGuide(55,1,true)
966   - end
  969 + if globalCsv.adv_auto_useItem[itemId] and count > 0 then
  970 + autoUse[itemId] = count
967 971 else
968   - if nums <= 0 then
969   - items = items:delk(itemId)
970   - nums = 0
  972 + local origin = items:getv(itemId, 0)
  973 + local nums = origin + count
  974 +
  975 + if csvdb["adv_artifactCsv"][itemId] then -- 获得神器
  976 + self:awardArtifact(itemId, params)
  977 + if not self.owner:checkOverGuide(55) then
  978 + self.owner:saveGuide(55,1,true)
  979 + end
971 980 else
972   - items = items:setv(itemId, nums)
973   - end
  981 + if nums <= 0 then
  982 + items = items:delk(itemId)
  983 + nums = 0
  984 + else
  985 + items = items:setv(itemId, nums)
  986 + end
974 987  
975   - if itemId == 16 and not self.owner:checkOverGuide(51,4) then
976   - self.owner:saveGuide(51,4)
977   - end
978   - if params.log then
979   - local log = clone(params.log)
980   - if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then
981   - print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())
  988 + if itemId == 16 and not self.owner:checkOverGuide(51,4) then
  989 + self.owner:saveGuide(51,4)
982 990 end
983   - log["cint1"] = itemId
984   - log["cint2"] = math.abs(count)
985   - log["cint3"] = self.chapterId
986   - log["long1"] = self.level
987   - if count >= 0 then
988   - self.owner:mylog("in_adv", log)
  991 + if params.log then
  992 + local log = clone(params.log)
  993 + if log["cint1"] or log["cint2"] or log["cint3"] or log["long1"] then
  994 + print("addAdvItem error log have cint1 or cint2 or cint3 ", debug.traceback())
  995 + end
  996 + log["cint1"] = itemId
  997 + log["cint2"] = math.abs(count)
  998 + log["cint3"] = self.chapterId
  999 + log["long1"] = self.level
  1000 + if count >= 0 then
  1001 + self.owner:mylog("in_adv", log)
  1002 + else
  1003 + self.owner:mylog("out_adv", log)
  1004 + end
989 1005 else
990   - self.owner:mylog("out_adv", log)
  1006 + print("addAdvItem no log ", debug.traceback())
991 1007 end
992   - else
993   - print("addAdvItem no log ", debug.traceback())
994 1008 end
995 1009 end
996 1010 end
... ... @@ -1001,10 +1015,48 @@ function Adv:award(gift, params)
1001 1015 if tgift[ItemId.OldCoin] then
1002 1016 self.battle.player:attrChangeCondBuffCheck(0)
1003 1017 end
  1018 +
  1019 + if backRewardParams then
  1020 + self:backReward(tgift, backRewardParams)
  1021 + end
  1022 +
  1023 + if next(autoUse) then
  1024 + for itemId, count in pairs(autoUse) do
  1025 + self:useItem(itemId, count)
  1026 + end
  1027 + self:backUse(autoUse, 1)
  1028 + end
1004 1029 return tgift
1005 1030 end
1006 1031  
1007 1032  
  1033 +function Adv:useItem(itemId, count, target)
  1034 + local itemData = csvdb["adv_itemCsv"][itemId]
  1035 + if not itemData then return end
  1036 +
  1037 + if itemData["function"] == 0 or itemData["function"] == 2 then count = 1 end
  1038 +
  1039 + if itemId == 5020 then
  1040 + self.owner:finishGuide(53)
  1041 + end
  1042 +
  1043 + self:checkAchievement(self.AchievType.UseItem, count, itemId)
  1044 + self:mylog({desc = "useItem", int1 = itemId, int2 = count})
  1045 +
  1046 + self.owner:log("mission_pick_use", {
  1047 + mission_threadid = self.chapterId, -- 大地图ID
  1048 + mission_threadname = (csvdb["adv_chapterCsv"][self.chapterId] or {})["chapter"] or "auto", -- 大地图名称
  1049 + mission_id = self.level, -- 关卡ID
  1050 + item_id = itemId, -- 道具ID
  1051 + mission_pick_use_num = count, -- 道具使用量
  1052 + mission_sequenceid = self.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志
  1053 + })
  1054 +
  1055 + for i = 1, count do
  1056 + self:doActive(itemData.effect, target) -- target
  1057 + end
  1058 +end
  1059 +
1008 1060 -- 消耗物品 优先冒险背包 --check 只是检查够不够
1009 1061 function Adv:cost(item, params, check)
1010 1062 local items = self.owner:getProperty("advItems")
... ... @@ -1040,7 +1092,9 @@ local function clickOut(self, room, block, params, isExit)
1040 1092 end
1041 1093  
1042 1094 if #self.mapStack > 1 then -- 处于夹层中
  1095 + local oldMapIdx = self:getCurMapIdx()
1043 1096 table.remove(self.mapStack) --退出夹层
  1097 + self.battle:iLayerChange(oldMapIdx)
1044 1098 self:backLayer(-1)
1045 1099 else --处于底层
1046 1100  
... ... @@ -1071,11 +1125,10 @@ local function clickOut(self, room, block, params, isExit)
1071 1125 self.battle.player:triggerPassive(Passive.DOWN_LAYER)
1072 1126  
1073 1127 if curFloorData then
1074   - self:backReward(self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}}))
  1128 + self:award({[ItemId.AdvPoint] = curFloorData.exp}, {log = {desc = "passReward", int1 = self.chapterId, int2 = self.level}}, {})
1075 1129 end
1076 1130 local isHaveRelay = self:isHaveRelay(self.level)
1077 1131  
1078   - self.owner:getProperty("advTeam").player = self.battle.player:getDB() -- 临时缓存住 battle 的player
1079 1132 if isHaveRelay and not self.isRelay then
1080 1133 self:initByChapter({
1081 1134 chapterId = self.chapterId,
... ... @@ -1255,7 +1308,7 @@ local function chooseCommon(self, room, block, chooseData, choose, tag)
1255 1308 skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id))
1256 1309 end
1257 1310 end
1258   - self:backReward(self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}), {roomId = room.roomId, blockId = block.blockId})
  1311 + self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId})
1259 1312 end,
1260 1313 [2] = function() --获得冒险buff
1261 1314 local layer = effect[3] or 1
... ... @@ -1419,14 +1472,12 @@ local function clickDrop(self, room, block, params)
1419 1472 if not self.battle or not self.battle.player then return end
1420 1473 self.battle.player:triggerPassive(Passive.CLICK_DROP)
1421 1474  
1422   - local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}})
1423   - -- local reward = self:award({[5801] = 1})
1424   - -- 获取绷带的引导
  1475 + local reward = self:award({[block.event.item[1]] = block.event.item[2]}, {log = {desc = "clickDrop"}}, {roomId = room.roomId, blockId = block.blockId})
  1476 +
1425 1477 if block.event.item[1] == 5020 and not self.owner:checkOverGuide(53,2) then
1426 1478 self.owner:saveGuide(53,2)
1427 1479 end
1428 1480 block:clear()
1429   - self:backReward(reward, {roomId = room.roomId, blockId = block.blockId})
1430 1481 return true
1431 1482 end
1432 1483  
... ... @@ -1447,7 +1498,7 @@ local function clickTrader(self, room, block, params)
1447 1498 local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100)
1448 1499 if not self:cost({[goodsData.currency] = costCount}, {log = {desc = "clickTrader", int1 = block.event.id}}) then return false, 6 end --不够
1449 1500 self:backCost({[goodsData.currency] = costCount})
1450   - local reward = self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}})
  1501 + self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}}, {})
1451 1502 if goodsData.restrict == 1 then
1452 1503 self.shopStatus[goodsData.goods] = (self.shopStatus[goodsData.goods] or 0) + 1
1453 1504 elseif goodsData.restrict == 2 then
... ... @@ -1459,7 +1510,6 @@ local function clickTrader(self, room, block, params)
1459 1510 buyCount = buyCount + 1
1460 1511 self:checkTask(Adv.TaskType.Shop, 1, block.event.id)
1461 1512 self:checkAchievement(Adv.AchievType.Shop, 1, block.event.id)
1462   - self:backReward(reward)
1463 1513  
1464 1514 if (traderData.purchasetime ~= 0 and traderData.purchasetime <= buyCount) or #block.event.shop <= buyCount then
1465 1515 block:clear()
... ... @@ -1501,7 +1551,7 @@ local function clickClick(self, room, block, params)
1501 1551 local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true)
1502 1552 reward[item[1]] = (reward[item[1]] or 0) + item[2]
1503 1553 end
1504   - self:backReward(self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}), {roomId = room.roomId, blockId = block.blockId})
  1554 + self:award(reward, {log = {desc = "clickClick", int1 = block.event.id}}, {roomId = room.roomId, blockId = block.blockId})
1505 1555 end,
1506 1556 [3] = function()
1507 1557 for _, buffId in ipairs(clickData.effect:toArray(true, "=")) do
... ... @@ -1521,6 +1571,7 @@ local function clickClick(self, room, block, params)
1521 1571 end
1522 1572  
1523 1573 local function clickLayer(self, room, block, params)
  1574 + local oldMapIdx = self:getCurMapIdx()
1524 1575 if block.event.mapIdx then
1525 1576 table.insert(self.mapStack, block.event.mapIdx) --进入夹层
1526 1577 else
... ... @@ -1536,6 +1587,7 @@ local function clickLayer(self, room, block, params)
1536 1587 self.maps[mapIdx]:initBattleAfter()
1537 1588 self:checkAchievement(Adv.AchievType.EnterILayer, 1, mapId)
1538 1589 end
  1590 + self.battle:iLayerChange(oldMapIdx)
1539 1591 self:backLayer(1)
1540 1592 return true
1541 1593 end
... ... @@ -1842,23 +1894,31 @@ end
1842 1894  
1843 1895 -- 地图上物品变化
1844 1896 function Adv:mapItemChange(ctype)
  1897 + local blocks = {}
  1898 + for roomId, room in pairs(self:getCurMap().rooms) do
  1899 + for blockId, block in pairs(room.blocks) do
  1900 + table.insert(blocks, block)
  1901 + end
  1902 + end
  1903 + self:blockDropChange(ctype, blocks)
  1904 +end
  1905 +
  1906 +function Adv:blockDropChange(ctype, blocks)
1845 1907 local clist = csvdb["transform_itemCsv"][ctype]
1846 1908 if clist then
1847   - for roomId, room in pairs(self:getCurMap().rooms) do
1848   - for blockId, block in pairs(room.blocks) do
1849   - if block:getEventType() == AdvEventType.Drop and block.event.item then
1850   - local id = block.event.item[1]
1851   - local count = block.event.item[2]
1852   - local changeTo = nil
1853   - if clist[id] then
1854   - changeTo = {clist[id].toId, math.ceil(count * clist[id].num)}
1855   - elseif clist[-1] then
1856   - changeTo = {clist[-1].toId, math.ceil(count * clist[-1].num)}
1857   - end
1858   - if changeTo and changeTo[1] ~= 0 and changeTo[2] ~= 0 then
1859   - block.event.item = changeTo
1860   - self:backBlockChange(roomId, blockId, ctype)
1861   - end
  1909 + for _, block in ipairs(blocks) do
  1910 + if block:getEventType() == AdvEventType.Drop and block.event.item then
  1911 + local id = block.event.item[1]
  1912 + local count = block.event.item[2]
  1913 + local changeTo = nil
  1914 + if clist[id] then
  1915 + changeTo = {clist[id].toId, math.ceil(count * clist[id].num)}
  1916 + elseif clist[-1] then
  1917 + changeTo = {clist[-1].toId, math.ceil(count * clist[-1].num)}
  1918 + end
  1919 + if changeTo and changeTo[1] ~= 0 and changeTo[2] ~= 0 then
  1920 + block.event.item = changeTo
  1921 + self:backBlockChange(block.room.roomId, block.blockId, ctype)
1862 1922 end
1863 1923 end
1864 1924 end
... ... @@ -1887,8 +1947,9 @@ function Adv:enemyDead(enemy, escape)
1887 1947 else
1888 1948 self:scoreChange(AdvScoreType.Kill, monsterData.advScore)
1889 1949 end
1890   - local changeV = self.battle.player:addExp(monsterData.exp)
1891   - self:backDead(enemyId, changeV)
  1950 + -- local changeV = self.battle.player:addExp(monsterData.exp)
  1951 + -- self:backDead(enemyId, changeV)
  1952 + self:backDead(enemyId)
1892 1953  
1893 1954 local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK)
1894 1955 if toClick then
... ... @@ -1989,10 +2050,13 @@ end
1989 2050 function Adv:pushBackEvent(btype, params)
1990 2051 table.insert(self.backEvents, {btype = btype, params = params})
1991 2052 end
1992   -
  2053 +--[=[
  2054 +tag
  2055 +1 自动拾取
  2056 +--]=]
1993 2057 function Adv:backReward(items, params)
1994 2058 params = params or {}
1995   - self:pushBackEvent(AdvBackEventType.Reward, {items = items, roomId = params.roomId, blockId = params.blockId})
  2059 + self:pushBackEvent(AdvBackEventType.Reward, {items = items, roomId = params.roomId, blockId = params.blockId, tag = params.tag})
1996 2060 end
1997 2061  
1998 2062 -- if is player enemyId is nil
... ... @@ -2009,8 +2073,8 @@ function Adv:backBlockChange(roomId, blockId, itemChangeType)
2009 2073 self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType})
2010 2074 end
2011 2075  
2012   -function Adv:backDead(enemyId, exp)
2013   - self:pushBackEvent(AdvBackEventType.Dead, {enemyId = enemyId, exp = exp})
  2076 +function Adv:backDead(enemyId)
  2077 + self:pushBackEvent(AdvBackEventType.Dead, {enemyId = enemyId})
2014 2078 end
2015 2079  
2016 2080 function Adv:backTrap()
... ... @@ -2033,8 +2097,12 @@ function Adv:backCost(items)
2033 2097 self:pushBackEvent(AdvBackEventType.Cost, {items = items})
2034 2098 end
2035 2099  
2036   -function Adv:backUse(items)
2037   - self:pushBackEvent(AdvBackEventType.Use, {items = items})
  2100 +--[=[
  2101 +tag
  2102 +1 自动使用
  2103 +--]=]
  2104 +function Adv:backUse(items, tag)
  2105 + self:pushBackEvent(AdvBackEventType.Use, {items = items, tag = tag})
2038 2106 end
2039 2107  
2040 2108  
... ... @@ -2044,21 +2112,11 @@ function Adv:scoreChange(scoreType, score)
2044 2112 end
2045 2113  
2046 2114 function Adv:getScore()
2047   - self.score[AdvScoreType.Level] = math.floor(self.score[AdvScoreType.Level] or 0)
2048   - self.score[AdvScoreType.Task] = math.floor(self.score[AdvScoreType.Task] or 0)
2049   - self.score[AdvScoreType.Kill] = math.floor(self.score[AdvScoreType.Kill] or 0)
2050   - self.score[AdvScoreType.KillBoss] = math.floor(self.score[AdvScoreType.KillBoss] or 0)
2051   - self.score[AdvScoreType.ItemBack] = math.floor(self.score[AdvScoreType.ItemBack] or 0)
2052   - self.score[AdvScoreType.Event] = math.floor(self.score[AdvScoreType.Event] or 0)
2053   - self.score[AdvScoreType.Story] = math.floor(self.score[AdvScoreType.Story] or 0)
2054   -
2055   - return self.score[AdvScoreType.Level]
2056   - + self.score[AdvScoreType.Task]
2057   - + self.score[AdvScoreType.Kill]
2058   - + self.score[AdvScoreType.KillBoss]
2059   - + self.score[AdvScoreType.ItemBack]
2060   - + self.score[AdvScoreType.Event]
2061   - + 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
2062 2120 end
2063 2121  
2064 2122 function Adv:popBackEvents()
... ...
src/adv/AdvBattle.lua
... ... @@ -8,6 +8,7 @@ function Battle:ctor(adv)
8 8 self.isNewPlayer = false
9 9 self.enemys = {} --怪
10 10 self.builds = {} -- 建筑
  11 + self.auras = {} -- 光环
11 12 self.cachePassiveEvent = {}
12 13 self:initPlayer()
13 14 self:initEnemys()
... ... @@ -67,17 +68,17 @@ function Battle:initPlayer()
67 68 local advAddAttrs = self.adv.owner:getAdvLvAddAttrs()
68 69  
69 70 player = {}
70   - player.level = 1
71   - if self.adv.level ~= 1 then
72   - local relayData = self.adv:isHaveRelay()
73   - if relayData then
74   - player.level = relayData.level
75   - end
76   - end
77   - player.exp = 0
  71 + -- player.level = 1
  72 + -- if self.adv.level ~= 1 then
  73 + -- local relayData = self.adv:isHaveRelay()
  74 + -- if relayData then
  75 + -- player.level = relayData.level
  76 + -- end
  77 + -- end
  78 + -- player.exp = 0
78 79 player.sp = getAdvLvAttrUp(advAddAttrs, "sp", 100)
79 80 player.spMax = player.sp
80   - player.growth = {}
  81 + -- player.growth = {}
81 82 player.passives = {}
82 83  
83 84 for slot, heroId in pairs(advTeam.heros) do
... ... @@ -100,8 +101,8 @@ function Battle:initPlayer()
100 101 player[attrName] = (player[attrName] or 0) + hero[attrName]
101 102 end
102 103 player[attrName] = getAdvLvAttrUp(advAddAttrs, attrName, player[attrName]) * (globalCsv.adv_battle_attr_ratio[attrName] or 1)
103   - player.growth[attrName] = player[attrName] * (globalCsv.adv_battle_attr_growth_ratio[attrName] or 1)
104   - player[attrName] = player[attrName] + player.growth[attrName] * (player.level - 1)
  104 + -- player.growth[attrName] = player[attrName] * (globalCsv.adv_battle_attr_growth_ratio[attrName] or 1)
  105 + -- player[attrName] = player[attrName] + player.growth[attrName] * (player.level - 1)
105 106 end
106 107  
107 108 player.hpMax = player.hp or 0
... ... @@ -198,8 +199,10 @@ function Battle:addEnemy(room, block, mapIdx, init)
198 199 end
199 200  
200 201 for _, buff in ipairs(buffs) do
201   - enemy:addBuff(buff)
  202 + player:addBuff(buff)
202 203 end
  204 + -- 新生成的怪 加上 已有的光环buff
  205 + player:checkAuraBuff(self:checkDiffAuraBuff({}, self:getAurasByMap()))
203 206 end
204 207 end
205 208 return player
... ... @@ -347,6 +350,8 @@ function Battle:afterRound()
347 350  
348 351 self.player:triggerPassive(Passive.AFTER_ROUND)
349 352  
  353 + self:checkAura()
  354 +
350 355 if self.player.isDead then
351 356 self.adv:over(false, nil, -2)
352 357 end
... ... @@ -435,8 +440,116 @@ function Battle:initMapEffect(ilayer)
435 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 553 for idx, mapEnemys in pairs(self.enemys) do
441 554 for _, enemy in ipairs(mapEnemys) do
442 555 local block = self.adv:getBlock(enemy.roomId, enemy.blockId, idx)
... ... @@ -453,6 +566,7 @@ function Battle:saveDB()
453 566 end
454 567 end
455 568 end
  569 + advInfo.auras = self.auras
456 570 end
457 571  
458 572 return Battle
459 573 \ No newline at end of file
... ...
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 -- 判断下类型是不是错的
... ... @@ -58,18 +60,49 @@ function Block:updateEvent(event, isInit)
58 60 end
59 61 self:randomEvent()
60 62 end
  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[newet] =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
61 83 end
62 84  
63 85 function Block:clear()
64   - if self:getEventType() == AdvEventType.Trap then
  86 + local et = self:getEventType()
  87 + if et == AdvEventType.Trap then
65 88 self.trapId = self.event.id
66   - elseif self:getEventType() == AdvEventType.Build then
  89 + elseif et == AdvEventType.Build then
67 90 local build = self.room.map.adv.battle:getBuild(self.room.roomId, self.blockId, self.room.map.mapIdx)
68 91 if build then
69 92 build.isDead = true
70 93 end
71 94 end
72 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
73 106 end
74 107  
75 108  
... ... @@ -90,8 +123,10 @@ function Block:randomEvent()
90 123 enemy:triggerPassive(Passive.BORN_ONCE)
91 124  
92 125 adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy})
  126 + adv.battle.player:attrChangeCondBuffCheck(3, enemy:getClassify())
93 127 for _, monster in pairs(adv.battle.player:getTeam(2)) do
94   - adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy})
  128 + monster:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy})
  129 + monster:attrChangeCondBuffCheck(3, enemy:getClassify())
95 130 end
96 131 end
97 132 randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster]
... ... @@ -208,6 +243,13 @@ function Block:randomEvent()
208 243 e:addBuff(buffId)
209 244 end
210 245 end
  246 + elseif data.target == 4 then
  247 + local enemys = self.room.map.adv:getCurMap():openBlocksIsMonsterByRoom(self.room.roomId)
  248 + for _, e in ipairs(enemys) do
  249 + for _, buffId in ipairs(buffs) do
  250 + e:addBuff(buffId)
  251 + end
  252 + end
211 253 end
212 254  
213 255 if data.specialEff ~= "" then
... ... @@ -263,10 +305,35 @@ function Block:open()
263 305 local adv = map.adv
264 306 self.isOpen = true
265 307 self:randomEvent()
  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
266 319 return true
267 320 end
268 321  
  322 +function Block:quickDrop()
  323 + if self:getEventType() == AdvEventType.Drop and self.event.item then
  324 + local itemId, count = table.unpack(self.event.item)
  325 + if globalCsv.adv_auto_collect[itemId] then
  326 + self.room.map.adv:award({[itemId] = count}, {log = {desc = "clickDrop"}}, {roomId = self.room.roomId, blockId = self.blockId, tag = 1})
  327 + self:clear()
  328 + end
  329 + end
  330 +end
  331 +
269 332 function Block:getObstacle()
  333 + if self:isMonster() then
  334 + local enemy = self.room.map.adv.battle:getEnemy(self.room.roomId, self.blockId)
  335 + return enemy:getObstacle()
  336 + end
270 337 local data = self:getEventData()
271 338 if not data then return 0 end
272 339 return data.obstacle or 0
... ...
src/adv/AdvBuff.lua
... ... @@ -20,7 +20,7 @@ Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效)
20 20 Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff
21 21 Buff.CHANGE_DROP = 18 -- 转换掉落
22 22 Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技
23   -Buff.EXP_ADD = 20 -- 增加exp(每回合)
  23 +-- Buff.EXP_ADD = 20 -- 增加exp(每回合)
24 24 Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击
25 25 Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记
26 26 Buff.SHOW_MONSTER_POS = 23 -- 蓝臂章训练场 感知
... ... @@ -34,6 +34,10 @@ Buff.Buff_EFFECT_CHANGE = 30 -- 改变 buff 效果
34 34 Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物
35 35 Buff.SNEAK = 32 --潜行
36 36 Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用
  37 +Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效
  38 +Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 0 - 1
  39 +Buff.DISABLE_AURA = 36 -- 禁用光环
  40 +Buff.GET_AURA = 37 -- 获得光环
37 41  
38 42  
39 43 --角色一些属性的变化
... ... @@ -87,13 +91,24 @@ local function commonAttCond(_Buff, attrName)
87 91 if buff then
88 92 effectCount = buff.layer
89 93 end
  94 + elseif self.buffData.effectValue4 == 3 then
  95 + local classify = tonumber(self.buffData.effectValue5) -- 怪标签
  96 + local enemy = self.owner.battle.player:getTeam(2)
  97 + for _, one in pairs(enemy) do
  98 + if one.isClassify and one:isClassify(classify) then
  99 + effectCount = effectCount + 1
  100 + end
  101 + end
  102 + elseif self.buffData.effectValue4 == 4 then
  103 + local eventType = tonumber(self.buffData.effectValue5) -- event 类型
  104 + effectCount = #self.owner.battle.adv:getCurMap():getEventTypeAllMap(eventType)
90 105 end
91 106 return self.buffData.effectValue2 * effectCount
92 107 end
93 108  
94 109 _Buff.getEffectBy = function(self)
95 110 local cond = nil
96   - if self.buffData.effectValue4 == 2 then
  111 + if self.buffData.effectValue4 == 2 or self.buffData.effectValue4 == 3 or self.buffData.effectValue4 == 4 then
97 112 cond = tonumber(self.buffData.effectValue5)
98 113 end
99 114 return self.buffData.effectValue4, attrName, cond
... ... @@ -302,18 +317,30 @@ local BuffFactory = {
302 317 end
303 318 end,
304 319  
305   - [Buff.EXP_ADD] = function(_Buff)
306   - _Buff._afterRound = function(self)
307   - local value = self:effect()
308   - self.owner.battle.player:addExp(value)
  320 + -- [Buff.EXP_ADD] = function(_Buff)
  321 + -- _Buff._afterRound = function(self)
  322 + -- local value = self:effect()
  323 + -- self.owner.battle.player:addExp(value)
  324 + -- end
  325 + -- _Buff._effectValue = function(self)
  326 + -- -- 经验值
  327 + -- return self.buffData.effectValue1 * self.layer
  328 + -- end
  329 + -- end,
  330 +
  331 + [Buff.DISABLE_BUFF] = function(_Buff)
  332 + _Buff._effectValue = function(self)
  333 + return self.buffData.effectValue1
309 334 end
  335 + end,
  336 +
  337 + [Buff.DISABLE_AURA] = function(_Buff)
310 338 _Buff._effectValue = function(self)
311   - -- 经验值
312   - return self.buffData.effectValue1 * self.layer
  339 + return self.buffData.effectValue1
313 340 end
314 341 end,
315 342  
316   - [Buff.DISABLE_BUFF] = function(_Buff)
  343 + [Buff.GET_AURA] = function(_Buff)
317 344 _Buff._effectValue = function(self)
318 345 return self.buffData.effectValue1
319 346 end
... ... @@ -378,6 +405,14 @@ local BuffFactory = {
378 405 self.layer = self.buffData.effectValue1
379 406 end
380 407 end,
  408 + [Buff.GET_PASSIVE] = function( _Buff )
  409 + _Buff._init = function(self)
  410 + self.owner:addPassive({id = self.buffData.effectValue1})
  411 + end
  412 + _Buff._endBuff = function(self)
  413 + self.owner:delPassiveById(self.buffData.effectValue1)
  414 + end
  415 + end
381 416 }
382 417  
383 418 -- 同样的返回 effectValue1, effectValue2 * self.layer 类型的buff
... ... @@ -439,7 +474,18 @@ function Buff:initNew(release, data)
439 474 end
440 475 end
441 476  
442   -function Buff:createAfter()
  477 +function Buff:createAfter(layer)
  478 + layer = layer or 1
  479 + local otype, maxLayer = self:getOverlay()
  480 + if otype then
  481 + self.layer = layer
  482 + if maxLayer ~= 0 then
  483 + self.layer = math.min(maxLayer, self.layer)
  484 + end
  485 + else
  486 + self.layer = 1
  487 + end
  488 +
443 489 if self._init then
444 490 self:_init()
445 491 end
... ... @@ -626,12 +672,13 @@ function Buff:getOverlay()
626 672 end
627 673  
628 674 -- 叠加
629   -function Buff:overlay(releaser, data)
  675 +function Buff:overlay(releaser, data, layer)
630 676 local otype, maxLayer = self:getOverlay()
631 677 if self.isDel or not otype then -- 新获得的 (不可叠加相当于新获得的)
632   - self.isDel = false
633 678 self:endBuff()
  679 + self.isDel = false
634 680 self:initNew(releaser, data)
  681 + self:createAfter(layer)
635 682 else
636 683 -- 重置回合 次数
637 684 self.roundSpace = 0
... ... @@ -644,7 +691,7 @@ function Buff:overlay(releaser, data)
644 691  
645 692 self.release = releaser or self.release
646 693 -- 叠加层数
647   - self.layer = self.layer + 1
  694 + self.layer = self.layer + layer
648 695 if maxLayer ~= 0 then
649 696 self.layer = math.min(maxLayer, self.layer)
650 697 end
... ... @@ -655,14 +702,32 @@ function Buff:overlay(releaser, data)
655 702 end
656 703  
657 704 -- 扣减层数
658   -function Buff:uncover()
659   - if self.layer <= 1 then
  705 +function Buff:uncover(layer, isAura)
  706 + layer = layer or 1
  707 + local oldLayer = self.layer
  708 +
  709 + self.layer = self.layer - layer
  710 +
  711 + if self.layer <= 0 then
660 712 self.isDel = true
661 713 end
662 714  
663   - self.layer = self.layer - 1
664   - if self._uncover then
665   - self:_uncover()
  715 + if isAura then
  716 + if layer == -1 then
  717 + self.layer = 0
  718 + self.isDel = true
  719 + else
  720 + self.layer = math.max(1, self.layer)
  721 + self.isDel = false
  722 + end
  723 + end
  724 +
  725 + if self.isDel then return end
  726 +
  727 + if oldLayer ~= self.layer then
  728 + if self._uncover then
  729 + self:_uncover()
  730 + end
666 731 end
667 732 end
668 733  
... ...
src/adv/AdvMap.lua
... ... @@ -256,7 +256,7 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack)
256 256  
257 257 if status then
258 258 if isPlayer then
259   - self.adv.battle:triggerPassive(Passive.OPEN_BLOCK)
  259 + self.adv.battle:triggerPassive(Passive.OPEN_BLOCK, {roomId = roomId, blockId = blockId})
260 260 self.adv.owner:checkTaskEnter("AdvOpenBlock")
261 261  
262 262 -- 潜行检查
... ... @@ -272,8 +272,8 @@ function Map:openBlock(roomId, blockId, isPlayer, ignoreBack)
272 272 if not ignoreBack then
273 273 self.adv:backBlockChange(roomId, blockId)
274 274 end
275   -
276 275 end
  276 + return status
277 277 end
278 278  
279 279 function Map:openBlocksBySize(roomId, blockId, size, isPlayer, ignoreBack)
... ... @@ -292,6 +292,41 @@ function Map:openBlocksByRoom(roomId, isPlayer, ignoreBack)
292 292 end
293 293 end
294 294  
  295 +function Map:openBlocksIsMonsterByRoom(roomId, count, isPlayer, ignoreBack)
  296 + local room = self.rooms[roomId]
  297 + if not room then return end
  298 +
  299 + local allBlock = {}
  300 + for blockId, block in pairs(room.blocks) do
  301 + if block:isMonster() and not block.isOpen then
  302 + table.insert(allBlock, blockId)
  303 + end
  304 + end
  305 +
  306 + local enemys = {}
  307 + local openBlock = function(blockId)
  308 + if self:openBlock(roomId, blockId, isPlayer, ignoreBack) then
  309 + local e = self.adv.battle:getEnemy(roomId, blockId)
  310 + if e then
  311 + table.insert(enemys, e)
  312 + end
  313 + end
  314 + end
  315 +
  316 + if not count or count == -1 or count >= len(allBlock) then
  317 + for _, blockId in ipairs(allBlock) do
  318 + openBlock(blockId)
  319 + end
  320 + else
  321 + for i = 1, count do
  322 + local idx = math.randomInt(1, len(allBlock))
  323 + openBlock(allBlock[idx])
  324 + table.remove(allBlock, idx)
  325 + end
  326 + end
  327 + return enemys
  328 +end
  329 +
295 330 function Map:openAllBlocks(isPlayer, ignoreBack)
296 331 for roomId, room in pairs(self.rooms) do
297 332 self:openBlocksByRoom(room.roomId, isPlayer, ignoreBack)
... ... @@ -309,6 +344,22 @@ function Map:getRBByPos(c, r)
309 344 end
310 345 end
311 346  
  347 +function Map:getDistance(froomId, fblockId, troomId, tblockId)
  348 + local distance = -1
  349 + local room1 = self.rooms[froomId]
  350 + local room2 = self.rooms[troomId]
  351 + if room1 and room2 then
  352 + local block1 = room1[fblockId]
  353 + local block2 = room2[tblockId]
  354 + if block1 and block2 then
  355 + local c1, r1 = room1:tranLtoG(block1.col, block1.row)
  356 + local c2, r2 = room2:tranLtoG(block2.col, block2.row)
  357 + distance = math.max(math.abs(c1 - c2), math.abs(r1 - r2))
  358 + end
  359 + end
  360 + return distance
  361 +end
  362 +
312 363 function Map:getAroundBlocks(room, block)
313 364 local blocks = {}
314 365 local range = {1, -1}
... ... @@ -412,6 +463,18 @@ function Map:getEnemysBySize(roomId, blockId, size)
412 463 return enemys
413 464 end
414 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
415 478 -----------------------------随机地图-----------------------------
416 479  
417 480 -- isEnter isNewRelay 区分中继层的类型 --是否是开始进入 是否是第一次进入
... ...
src/adv/AdvPassive.lua
... ... @@ -7,6 +7,8 @@ Filter.HP_LOW = 4 -- 血量&lt;value%
7 7 Filter.BUFF_BY_TYPE = 5 -- 指定类型buff
8 8 Filter.BUFF_BY_ID = 6 -- 指定id的buff
9 9 Filter.CAMP = 7 -- 玩家是指定阵营
  10 +Filter.RANGE = 8 -- 筛选范围 (触发是地块)
  11 +Filter.CLASSIFY = 9 -- 标签
10 12  
11 13 local FilterFactory = {}
12 14 FilterFactory[Filter.HP_UP_WITH_EQUAL] = function (_Filter)
... ... @@ -46,6 +48,21 @@ FilterFactory[Filter.CAMP] = function (_Filter)
46 48 end
47 49 end
48 50  
  51 +FilterFactory[Filter.RANGE] = function (_Filter)
  52 + _Filter._execute = function (self, target, params)
  53 + if self.owner.blockId and self.owner.roomId and params.blockId and params.roomId then
  54 + local distance = self.owner.battle.adv:getCurMap():getDistance(self.owner.roomId, self.owner.blockId, params.roomId, params.blockId)
  55 + return distance ~= -1 and distance <= self.value
  56 + end
  57 + return false
  58 + end
  59 +end
  60 +
  61 +FilterFactory[Filter.CLASSIFY] = function (_Filter)
  62 + _Filter._execute = function (self, target)
  63 + return target.isClassify and target:isClassify(self.value)
  64 + end
  65 +end
49 66  
50 67 function Filter:ctor(params)
51 68 self.owner = params.owner
... ... @@ -79,7 +96,7 @@ function Filter:execute(params)
79 96 return
80 97 end
81 98 if self:_execute(target) then
82   - return self:_execute(target)
  99 + return self:_execute(target, params)
83 100 end
84 101 end
85 102  
... ... @@ -120,6 +137,7 @@ Passive.GET_BUFF = 28 --获得指定buff
120 137 Passive.OPEN_BLOCK = 29 --翻开格子
121 138 Passive.OPEN_MONSTER = 30 --翻开怪物
122 139 Passive.PLAYER_BUFF = 31 --玩家获得buff
  140 +
123 141 Passive.PLAYER_BUFF_CLASSIFY = 35 -- 获得指定标签的buff
124 142  
125 143 -- 不同的开启条件
... ... @@ -442,6 +460,7 @@ end
442 460  
443 461 --3=翻开自己所在格子
444 462 function Passive:effect3(value)
  463 + if not self.owner.roomId or not self.owner.blockId then return end
445 464 if value == 0 then
446 465 self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId)
447 466 elseif value > 0 then
... ... @@ -494,7 +513,7 @@ function Passive:effect8(dropId)
494 513 skynet.error(string.format("CSVDATA Error adv_map_passive %s effect 8 not id %s in event_drop", self.id, dropId))
495 514 end
496 515 local item = dropData["range"]:randWeight(true)
497   - self.owner.battle.adv:backReward(self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId})
  516 + self.owner.battle.adv:award({[item[1]] = item[2]}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})
498 517  
499 518 end
500 519  
... ... @@ -509,7 +528,7 @@ function Passive:effect9(itemId, triggerPms, ratio, max)
509 528 return
510 529 end
511 530 if not cond then return end
512   - self.owner.battle.adv:backReward(self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}), {roomId = self.owner.roomId, blockId = self.owner.blockId})
  531 + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}, {log = {desc = "passive", int1 = self.id}}, {roomId = self.owner.roomId, blockId = self.owner.blockId})
513 532 end
514 533  
515 534 --10=战斗额外掉落次数
... ... @@ -561,5 +580,22 @@ function Passive:effect14(value, triggerPms, enemyId)
561 580 end
562 581 end
563 582  
  583 +--15=翻开房间内的count 个怪 并且增加一个buff
  584 +function Passive:effect15(count, triggerPms, buffId)
  585 + local roomId = self.owner.roomId
  586 + if not roomId then return end
  587 + local enemys = self.owner.battle.adv:getCurMap():openBlocksIsMonsterByRoom(roomId, count)
  588 + for _, e in ipairs(enemys) do
  589 + e:addBuff(buffId)
  590 + end
  591 +end
  592 +
  593 +--16=转变 value 范围内的掉落物 为 id count
  594 +function Passive:effect16(value, triggerPms, changeType)
  595 + if not self.owner.roomId or not self.owner.blockId then return end
  596 + local blocks = self.owner.battle.adv:getCurMap():getBlocksBySize(self.owner.roomId, self.owner.blockId, value)
  597 + self.owner.battle.adv:blockDropChange(changeType, blocks)
  598 +end
  599 +
564 600  
565 601 return Passive
566 602 \ No newline at end of file
... ...
src/adv/AdvPlayer.lua
... ... @@ -90,6 +90,12 @@ end
90 90 function BaseObject:clear()
91 91 self.buffs = {}
92 92 self.passives = {}
  93 + if self:is("Enemy") then
  94 + self.battle.player:attrChangeCondBuffCheck(3, self:getClassify())
  95 + for _, monster in pairs(self.battle.player:getTeam(2)) do
  96 + monster:attrChangeCondBuffCheck(3, self:getClassify())
  97 + end
  98 + end
93 99 end
94 100  
95 101 function BaseObject:addPassive(params)
... ... @@ -137,7 +143,21 @@ function BaseObject:getDisablePassiveCount()
137 143 return count
138 144 end
139 145  
140   -function BaseObject:addBuff(buffId, releaser)
  146 +function BaseObject:getDisableAuraCount()
  147 + local count
  148 + for _, buff in ipairs(self.buffs) do
  149 + if not buff:isHide() and buff:getType() == Buff.DISABLE_AURA then
  150 + if buff:effect() == 0 then
  151 + return 0
  152 + end
  153 + count = (count or 0) + buff:effect()
  154 + end
  155 + end
  156 + return count
  157 +end
  158 +
  159 +function BaseObject:addBuff(buffId, releaser, layer)
  160 + layer = layer or 1
141 161 local buffData = csvdb["adv_map_buffCsv"][buffId]
142 162 if not buffData then return end
143 163 for _, buff in ipairs(self.buffs) do
... ... @@ -151,7 +171,7 @@ function BaseObject:addBuff(buffId, releaser)
151 171 local oldBuff = self:getBuffById(buffId)
152 172 if oldBuff then
153 173 if not oldBuff:checkKeep() then return end
154   - oldBuff:overlay(releaser, {}) -- 叠加
  174 + oldBuff:overlay(releaser, {}, layer) -- 叠加
155 175 else
156 176 -- 不能保持的buff 也加不上去
157 177 if not Buff.checkKeep({
... ... @@ -161,10 +181,11 @@ function BaseObject:addBuff(buffId, releaser)
161 181 }) then return end
162 182 local buff = Buff.create(self, releaser, {id = buffId})
163 183 table.insert(self.buffs, buff)
164   - buff:createAfter()
  184 + buff:createAfter(layer)
165 185 end
166 186 self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId})
167 187 self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify})
  188 + self:attrChangeCondBuffCheck(2, buffId)
168 189 return true
169 190 end
170 191  
... ... @@ -217,6 +238,44 @@ end
217 238 function BaseObject:reSetSpMax()
218 239 end
219 240  
  241 +function BaseObject:checkAuraBuff(buffs)
  242 +end
  243 +
  244 +function BaseObject:getAuras()
  245 + local disable = self:getDisableAuraCount()
  246 + local auras = {}
  247 + local function addAura(one)
  248 + if disable > 0 then
  249 + disable = disable - 1
  250 + else
  251 + table.insert(auras, one)
  252 + end
  253 + end
  254 + if self:is("Enemy") then
  255 + local halo = csvdb["event_monsterCsv"][self.monsterId].halo
  256 + if halo then
  257 + for _, one in ipairs(halo:toArray(true, "=")) do
  258 + addAura(one)
  259 + end
  260 + end
  261 + elseif self:is("Build") then
  262 + local halo = csvdb["event_buildingCsv"][self.id].halo
  263 + if halo then
  264 + for _, one in ipairs(halo:toArray(true, "=")) do
  265 + addAura(one)
  266 + end
  267 + end
  268 + end
  269 +
  270 + for _, buff in ipairs(self.buffs) do
  271 + if not buff:isHide() and buff:getType() == Buff.GET_AURA then
  272 + addAura(buff:effect())
  273 + end
  274 + end
  275 +
  276 + return auras
  277 +end
  278 +
220 279  
221 280 -- 通用的buff 效果汇总 -- 0 固定 1百分比 两种分类
222 281 function BaseObject:getCommonBuffEffect(bType, otherCond)
... ... @@ -417,7 +476,7 @@ function BaseObject:hurt(value, releaser, params)
417 476 if self.hp == 0 then
418 477 self:triggerPassive(Passive.SELF_DEAD)
419 478 for _, team in ipairs(self:getTeam(1, true)) do
420   - team:triggerPassive(Passive.TEAM_DEAD)
  479 + team:triggerPassive(Passive.TEAM_DEAD, {trigger = self})
421 480 end
422 481  
423 482 if (params.hurtType == 6 or params.hurtType == 2) and self ~= self.battle.player then
... ... @@ -505,6 +564,50 @@ function BaseObject:getTeam(nType, noSelf, mapIdx, includeLock)
505 564 return team
506 565 end
507 566  
  567 +function BaseObject:attrChangeCondBuffCheck(etype, cond)
  568 + local effect = {}
  569 + if etype == 3 then
  570 + if type(cond) ~= "string" then
  571 + return
  572 + end
  573 + local temp = cond:toArray(true, " ")
  574 + cond = {}
  575 + for _, one in pairs(temp) do
  576 + cond[one] = 1
  577 + end
  578 + elseif etype == 4 then
  579 + if not cond then
  580 + cond = {}
  581 + end
  582 + if type(cond) == "number" then
  583 + cond = {[cond] = 1}
  584 + end
  585 + end
  586 + for _, buff in ipairs(self.buffs) do
  587 + if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then
  588 + local _et, _attr, _co = buff:getEffectBy()
  589 + if etype == _et then
  590 + if etype == 3 or etype == 4 then
  591 + if cond[_co] then
  592 + effect[_attr] = 1
  593 + end
  594 + else
  595 + if (not _co or _co == cond) then
  596 + effect[_attr] = 1
  597 + end
  598 + end
  599 + end
  600 + end
  601 + end
  602 + for attrName, _ in pairs(effect) do
  603 + if attrName == "hp" then
  604 + self:reSetHpMax()
  605 + else
  606 + self:reSetAttr(attrName)
  607 + end
  608 + end
  609 +end
  610 +
508 611 function BaseObject:getDB()
509 612 local db = {}
510 613 db.hp = self.hp
... ... @@ -557,6 +660,51 @@ function Enemy:isEnemy()
557 660 return true
558 661 end
559 662  
  663 +function Enemy:getObstacle()
  664 + local obstacle = csvdb["event_monsterCsv"][self.monsterId].obstacle
  665 + if obstacle == 0 and self:hadBuff(Buff.OBSTACLE_CHANGE) then
  666 + obstacle = 1
  667 + end
  668 + return obstacle
  669 +end
  670 +
  671 +function Enemy:isClassify(check)
  672 + local classify = self:getClassify()
  673 + return classify and classify:sismember(check, " ")
  674 +end
  675 +
  676 +function Enemy:getClassify()
  677 + return csvdb["event_monsterCsv"][self.monsterId].classify
  678 +end
  679 +
  680 +-- 0=所有 1=怪物 2=玩家
  681 +function Enemy:checkAuraBuff(buffs)
  682 + local needBuffs = {}
  683 +
  684 + for buffId, info in pairs(buffs[0] or {}) do
  685 + needBuffs[buffId] = needBuffs[buffId] or {}
  686 + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count
  687 + needBuffs[buffId].exist = info.exist
  688 + end
  689 +
  690 + for buffId, info in pairs(buffs[1] or {}) do
  691 + needBuffs[buffId] = needBuffs[buffId] or {}
  692 + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count
  693 + needBuffs[buffId].exist = info.exist
  694 + end
  695 +
  696 + for buffId, info in pairs(needBuffs) do
  697 + if info.count < 0 then
  698 + local buff = self:getBuffById(buffId)
  699 + if buff then
  700 + buff:uncover(info.exist and -info.count or -1, true)
  701 + end
  702 + elseif count > 0 then
  703 + self:addBuff(buffId, nil, info.count)
  704 + end
  705 + end
  706 +end
  707 +
560 708 function Enemy:kill()
561 709 self:hurt(self.hp, self.battle.player, {hurtType = 5})
562 710 end
... ... @@ -569,44 +717,44 @@ end
569 717  
570 718 function Player:initData(data)
571 719 Player.super.initData(self, data)
572   - self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr
  720 + -- self.level = data.level or 1 --level 每增加1级 属性增长 growth * baseAttr
573 721 self.growth = data.growth
574   - self.exp = data.exp or 0
  722 + -- self.exp = data.exp or 0
575 723 self.sp = data.sp or 100
576 724 self.spMax = data.spMax or 100
577 725 self._spMax = data._spMax or 100
578 726 end
579 727  
580   -function Player:addExp(value)
581   - -- buff 经验加成
582   - local up = self:getCommonBuffEffect(Buff.EXP_UP)
583   - value = math.ceil((value + up[0]) * (1 + up[1]))
584   -
585   - if value <= 0 then return end
586   - local newExp = self.exp + value
587   - local level = self.level
588   - if level >= #csvdb["adv_levelCsv"] then return end
589   - while true do
590   - local curData = csvdb["adv_levelCsv"][level]
591   - if newExp < curData.exp then break end
592   - level = level + 1
593   - newExp = newExp - curData.exp
594   - if level >= #csvdb["adv_levelCsv"] then break end
595   - end
596   - local delta = level - self.level
597   -
598   - self.battle.adv:pushBackEvent(AdvBackEventType.Exp, {delta = value})
599   -
600   - if delta > 0 then
601   - for attr, _ in pairs(AdvAttsEnum) do
602   - self:addBaseAttr(attr, self.growth[attr] * delta, 0, true)
603   - end
604   - self.battle.adv:pushBackEvent(AdvBackEventType.Level, {level = level, delta = delta})
605   - end
606   - self.level = level
607   - self.exp = newExp
608   - return value
609   -end
  728 +-- function Player:addExp(value)
  729 +-- -- buff 经验加成
  730 +-- local up = self:getCommonBuffEffect(Buff.EXP_UP)
  731 +-- value = math.ceil((value + up[0]) * (1 + up[1]))
  732 +
  733 +-- if value <= 0 then return end
  734 +-- local newExp = self.exp + value
  735 +-- local level = self.level
  736 +-- if level >= #csvdb["adv_levelCsv"] then return end
  737 +-- while true do
  738 +-- local curData = csvdb["adv_levelCsv"][level]
  739 +-- if newExp < curData.exp then break end
  740 +-- level = level + 1
  741 +-- newExp = newExp - curData.exp
  742 +-- if level >= #csvdb["adv_levelCsv"] then break end
  743 +-- end
  744 +-- local delta = level - self.level
  745 +
  746 +-- self.battle.adv:pushBackEvent(AdvBackEventType.Exp, {delta = value})
  747 +
  748 +-- if delta > 0 then
  749 +-- for attr, _ in pairs(AdvAttsEnum) do
  750 +-- self:addBaseAttr(attr, self.growth[attr] * delta, 0, true)
  751 +-- end
  752 +-- self.battle.adv:pushBackEvent(AdvBackEventType.Level, {level = level, delta = delta})
  753 +-- end
  754 +-- self.level = level
  755 +-- self.exp = newExp
  756 +-- return value
  757 +-- end
610 758 --vtype 0/1 值/%
611 759 function Player:addBaseAttr(attr, value, vtype, ignoreBack)
612 760 local attrName = attr
... ... @@ -696,7 +844,6 @@ end
696 844 function Player:addBuff(buffId, releaser)
697 845 local status = Player.super.addBuff(self, buffId, releaser)
698 846 if status then
699   - self.battle.player:attrChangeCondBuffCheck(2, buffId)
700 847 self.battle.adv:checkAchievement(self.battle.adv.AchievType.GetBuff, 1, buffId)
701 848 self.battle.adv:pushBackEvent(AdvBackEventType.Buff, {buffId = buffId})
702 849 self.battle:triggerPassive(Passive.PLAYER_BUFF, {buffId = buffId})
... ... @@ -707,23 +854,30 @@ function Player:addBuff(buffId, releaser)
707 854 end
708 855 return status
709 856 end
  857 +-- 0=所有 1=怪物 2=玩家
  858 +function Player:checkAuraBuff(buffs)
  859 + local needBuffs = {}
710 860  
711   -function Player:attrChangeCondBuffCheck(etype, cond)
712   - local effect = {}
713   - for _, buff in ipairs(self.buffs) do
714   - if not buff:isHide() and (buff:getType() == Buff.ATTR_CHANGE_COND) then
715   - local _et, _attr, _co = buff:getEffectBy()
716   - if etype == _et and (not _co or _co == cond) then
717   - effect[_attr] = 1
718   - end
719   -
720   - end
  861 + for buffId, info in pairs(buffs[0] or {}) do
  862 + needBuffs[buffId] = needBuffs[buffId] or {}
  863 + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count
  864 + needBuffs[buffId].exist = info.exist
721 865 end
722   - for attrName, _ in pairs(effect) do
723   - if attrName == "hp" then
724   - self:reSetHpMax()
725   - else
726   - self:reSetAttr(attrName)
  866 +
  867 + for buffId, info in pairs(buffs[2] or {}) do
  868 + needBuffs[buffId] = needBuffs[buffId] or {}
  869 + needBuffs[buffId].count = (needBuffs[buffId].count or 0) + info.count
  870 + needBuffs[buffId].exist = info.exist
  871 + end
  872 +
  873 + for buffId, info in pairs(needBuffs) do
  874 + if info.count < 0 then
  875 + local buff = self:getBuffById(buffId)
  876 + if buff then
  877 + buff:uncover(info.exist and -info.count or -1, true)
  878 + end
  879 + elseif info.count > 0 then
  880 + self:addBuff(buffId, nil, info.count)
727 881 end
728 882 end
729 883 end
... ... @@ -734,7 +888,8 @@ end
734 888  
735 889 function Player:getDB()
736 890 local db = Player.super.getDB(self)
737   - for _ , field in pairs({"level", "exp", "growth", "sp", "spMax"}) do
  891 + -- for _ , field in pairs({"level", "exp", "growth", "sp", "spMax"}) do
  892 + for _ , field in pairs({"level", "growth", "sp", "spMax"}) do
738 893 db[field] = self[field]
739 894 end
740 895 db["_spMax"] = self._spMax
... ...
1   -Subproject commit 02a9bbbb10bb99a91cc5d67f62dc7e5b49d8cb46
  1 +Subproject commit a2598231ccc5e16da1a27f976602871f30fcd035
... ...
src/models/Hero.lua
... ... @@ -15,6 +15,7 @@ Hero.schema = {
15 15 -- loveL = {"number", 0}, --好感度等级
16 16 equip = {"string",""}, --装备 type=level
17 17 rune = {"string",""}, --零件 type=id
  18 + faith = {"number", 0}, -- 信赖
18 19 }
19 20  
20 21 function Hero:ctor( properties )
... ... @@ -102,6 +103,7 @@ function Hero:data()
102 103 -- loveL = self:getProperty("loveL"),
103 104 equip = self:getProperty("equip"),
104 105 rune = self:getProperty("rune"),
  106 + faith = self:getProperty("faith")
105 107 }
106 108 end
107 109  
... ... @@ -113,4 +115,8 @@ function Hero:getRare()
113 115 return csvdb["unitCsv"][self:getProperty("type")].rare
114 116 end
115 117  
  118 +function Hero:getPosition()
  119 + return csvdb["unitCsv"][self:getProperty("type")].position
  120 +end
  121 +
116 122 return Hero
117 123 \ No newline at end of file
... ...
src/models/HeroPlugin.lua
... ... @@ -48,30 +48,29 @@ function HeroPlugin.bind(Hero)
48 48 local breakL = params.breakL or self:getProperty("breakL")
49 49 local wakeL = params.wakeL or self:getProperty("wakeL")
50 50 local talent = params.talent or self:getProperty("talent")
51   -
  51 + local heroCfgId = self:getProperty("type")
52 52 --天赋
53 53 local talentAttrS = {}
54 54  
55 55 -- 四个基础属性
56 56 local curData = csvdb["unit_talentCsv"][talent:getv(0, 1)]
  57 + local curTalentLvl = 0
57 58 if not curData then -- 已经满阶段了
58   - curData = csvdb["unit_talentCsv"][#csvdb["unit_talentCsv"]]
59   - local strength = curData[#curData].strength
60   - for i = 1, 4 do
61   - talentAttrS[TalentAttsEnumEx[i]] = (talentAttrS[TalentAttsEnumEx[i]] or 0) + strength
62   - end
  59 + local cfgName = "unit_talent_"..heroCfgId.."Csv"
  60 + curData = csvdb[cfgName][#csvdb[cfgName]]
63 61 else
64   - for i = 1, 4 do --4个天赋
65   - talentAttrS[TalentAttsEnumEx[i]] = (talentAttrS[TalentAttsEnumEx[i]] or 0) + curData[talent:getv(i, 0)].strength
66   - end
  62 + curTalentLvl = talent:getv(1, 1)
67 63 end
68   - --阶段属性
69   - for i = 1, (talent:getv(0, 1) - 1) do
70   - local curData = csvdb["unit_talentCsv"][i]
71   - local effect = curData[#curData].effect:toArray(true, "=")
72   - talentAttrS[AttsEnumEx[effect[1]]] = (talentAttrS[AttsEnumEx[effect[1]]] or 0) + effect[2]
  64 + for lvl, cfg in pairs(curData) do
  65 + if lvl < curTalentLvl or curTalentLvl == 0 then
  66 + if cfg.effect ~= 99 then
  67 + local curVal = talentAttrS[cfg.effect] or 0
  68 + if curVal < cfg.strength then
  69 + talentAttrS[cfg.effect] = cfg.strength
  70 + end
  71 + end
  72 + end
73 73 end
74   -
75 74  
76 75 for _, attrName in pairs(AttsEnumEx) do
77 76 if talentAttrS[attrName] then
... ... @@ -79,6 +78,22 @@ function HeroPlugin.bind(Hero)
79 78 end
80 79 end
81 80  
  81 + -- 信赖属性
  82 + local faithAttr = {}
  83 + local faith = self:getProperty("faith")
  84 + local faithConfig = csvdb["unit_trustCsv"]
  85 + for lvl = 1, #faithConfig do
  86 + if faith >= faithConfig[lvl].exp then
  87 + local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=")
  88 + faithAttr[add[1]] = (faithAttr[add[1]] or 0) + add[2]
  89 + end
  90 + end
  91 + for _, attrName in pairs(AttsEnumEx) do
  92 + if faithAttr[attrName] then
  93 + faithAttr[attrName] = addAttr(unitData[attrName], faithAttr[attrName], 1, attrName)
  94 + end
  95 + end
  96 +
82 97 local attrs = {}
83 98 for _, attName in pairs(AttsEnumEx) do
84 99 attrs[attName] = unitData[attName] or 0
... ... @@ -90,7 +105,7 @@ function HeroPlugin.bind(Hero)
90 105 for attr, value in pairs(attrs) do
91 106 attrs[attr] = attrs[attr] + addAttr(attrs[attr], lData[attr .. "Level"], 1, attr)
92 107 attrs[attr] = attrs[attr] + addAttr(attrs[attr], blData[attr .. "Level"], 1, attr)
93   - attrs[attr] = attrs[attr] + addAttr(attrs[attr], wData[attr .. "Level"], 1, attr) + (talentAttrS[attr] or 0)
  108 + attrs[attr] = attrs[attr] + addAttr(attrs[attr], wData[attr .. "Level"], 1, attr) + (talentAttrS[attr] or 0) + (faithAttr[attr] or 0)
94 109 end
95 110  
96 111 return attrs
... ... @@ -237,6 +252,37 @@ function HeroPlugin.bind(Hero)
237 252 return level
238 253 end
239 254  
  255 + -- 天赋获得的技能
  256 + function Hero:getTalentSkill()
  257 + local TalentEnum = {
  258 + [1] = 1, -- 血量
  259 + [2] = 2, -- 攻击
  260 + [3] = 3, -- 物理防御
  261 + [4] = 4, -- 命中
  262 + [5] = 5, -- 闪避
  263 + }
  264 + local talentCsv = csvdb["unit_talent_" .. self:getProperty("type") .. "Csv"]
  265 + local curLv = self:getProperty("talent"):getv(1,1) - 1
  266 + local curRan = self:getProperty("talent"):getv(0,1)
  267 + local skills = {}
  268 + for ran, data in ipairs(talentCsv) do
  269 + if ran <= curRan then
  270 + for lv, value in ipairs(data) do
  271 + if ran < curRan or lv <= curLv then
  272 + if not TalentEnum[value.effect] then
  273 + skills[value.strength] = true
  274 + end
  275 + else
  276 + break
  277 + end
  278 + end
  279 + else
  280 + break
  281 + end
  282 + end
  283 + return skills
  284 + end
  285 +
240 286 function Hero:getSkillData(idx)
241 287 local unitData = csvdb["unitCsv"][self:getProperty("type")]
242 288 if idx == 1 then
... ... @@ -296,6 +342,27 @@ function HeroPlugin.bind(Hero)
296 342 end
297 343 return
298 344 end
  345 +
  346 + -- 添加英雄信赖
  347 + function Hero:addHeroFaith(exp)
  348 + local faith = self:getProperty("faith")
  349 + local config = csvdb["unit_trustCsv"]
  350 + local star = self:getProperty("wakeL")
  351 + local tmpExp = faith + exp
  352 + for lvl = 1, #config do
  353 + if star < config[lvl].star then
  354 + break
  355 + end
  356 + if tmpExp < config[lvl].exp then
  357 + faith = tmpExp
  358 + break
  359 + else
  360 + faith = config[lvl].exp
  361 + end
  362 + end
  363 + self:setProperty("faith", faith)
  364 + end
  365 +
299 366 end
300 367  
301 368  
... ...
src/models/Role.lua
... ... @@ -103,7 +103,6 @@ Role.schema = {
103 103 --挂机相关
104 104 hangPass = {"table", {}}, -- 挂机通过的最大关卡
105 105 hangGift = {"table", {}}, -- 挂机奖励 {id = 1}
106   - hangTeam = {"table", {}}, -- 挂机队伍
107 106 hangTS = {"table", {}}, -- 挂机队伍他人可读的队伍信息
108 107 hangTB = {"table", {}}, -- 挂机队伍他人可用的战斗信息mao
109 108 hangTBV = {"number", 0}, -- 挂机队伍他人可用的战斗力
... ... @@ -111,8 +110,11 @@ Role.schema = {
111 110 hangInfo = {"table", {}}, -- 当前挂机信息
112 111 hangBag = {"table", {}}, -- 背包
113 112 hangBagLimit = {"number", globalCsv.idle_field_origin}, --背包上限
114   - bTeam = {"table", {}}, -- 奖励副本队伍
115   - heroFormate = {"table", {}}, -- 自选编队 {adv={}, hang={}}
  113 + hangTeams = {"table", {}}, -- pve自选编队
  114 + teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType
  115 + advTeams = {"table", {}}, -- 拾荒自选编队
  116 +
  117 + bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1
116 118  
117 119 --引导相关
118 120 newerGuide = {"string","1=1"}, -- 新手引导 master=slave
... ... @@ -143,7 +145,6 @@ Role.schema = {
143 145 boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}}
144 146  
145 147 towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey}
146   - towerF = {"table", {}}, -- 爬塔阵容
147 148  
148 149 spTask = {"table", {}}, -- 特殊任务 -- {id = status}
149 150  
... ... @@ -179,6 +180,7 @@ Role.schema = {
179 180 feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数
180 181  
181 182 calTask = {"table", {}}, -- 英雄令活动 日历任务活动
  183 + radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv
182 184 }
183 185  
184 186  
... ... @@ -354,11 +356,14 @@ function Role:data()
354 356  
355 357 hangPass = self:getProperty("hangPass"),
356 358 hangGift = self:getProperty("hangGift"),
357   - hangTeam = self:getProperty("hangTeam"),
358 359 hangInfo = self:getProperty("hangInfo"),
359 360 hangBag = self:getProperty("hangBag"),
360 361 hangBagLimit = self:getProperty("hangBagLimit"),
361   - bTeam = self:getProperty("bTeam"),
  362 + hangTeams = self:getProperty("hangTeams"),
  363 + teamIndex = self:getProperty("teamIndex"),
  364 + advTeams = self:getProperty("advTeams"),
  365 +
  366 + bonusStar = self:getProperty("bonusStar"),
362 367  
363 368 newerGuide = self:getProperty("newerGuide"),
364 369 funcGuide = self:getProperty("funcGuide"),
... ... @@ -374,7 +379,6 @@ function Role:data()
374 379 equips = self:getProperty("equips"),
375 380 boxL = self:getProperty("boxL"),
376 381 towerInfo = self:getProperty("towerInfo"),
377   - towerF = self:getProperty("towerF"),
378 382 spTask = self:getProperty("spTask"),
379 383 dTask = self:getProperty("dTask"),
380 384 wTask = self:getProperty("wTask"),
... ... @@ -401,6 +405,7 @@ function Role:data()
401 405 feedback = self:getProperty("feedback"),
402 406 ctime = self:getProperty("ctime"),
403 407 calTask = self:getProperty("calTask"),
  408 + radioTask = self:getProperty("radioTask"),
404 409 }
405 410 end
406 411  
... ...
src/models/RoleBattle.lua
... ... @@ -57,7 +57,7 @@ function Role:checkBattle(battleType, params)
57 57 end
58 58 end,
59 59 tower = function()
60   - local towerF = self:getProperty("towerF")
  60 + local towerF = self:getTeamFormatByType(TeamSystemType.Tower)
61 61 for slot, hero in pairs(self:getTeamHerosInfo(towerF.heros)) do
62 62 selflist[slot] = hero.type
63 63 end
... ... @@ -72,7 +72,7 @@ function Role:checkBattle(battleType, params)
72 72 end
73 73 end,
74 74 bonus = function()
75   - local bTeam = self:getProperty("bTeam")
  75 + local bTeam = self:getTeamFormatByType(TeamSystemType.BonusBattle)
76 76 for slot, hero in pairs(self:getTeamHerosInfo(bTeam.heros)) do
77 77 selflist[slot] = hero.type
78 78 end
... ...
src/models/RoleLog.lua
... ... @@ -107,6 +107,8 @@ local ItemReason = {
107 107 unlockPool = 1208, -- 解锁英雄定向抽卡池
108 108 downloadCv = 1209, -- 下载 cv包奖励
109 109 refer = 1210, -- 穿戴
  110 + itemCompose = 1211, -- 天赋道具合成
  111 + radioQuest = 1212, -- 电台任务奖励
110 112  
111 113 -- pvp
112 114 pvpCHead = 1301, -- pvp 跨服竞技场头像
... ...
src/models/RolePlugin.lua
... ... @@ -64,6 +64,9 @@ function RolePlugin.bind(Role)
64 64 [ItemId.PlayerExp] = function()
65 65 self:addPlayExp(count, pms)
66 66 end,
  67 + [ItemId.AdvPower] = function()
  68 + self:changeAdvCount(-count)
  69 + end,
67 70 }
68 71  
69 72 local itemTypeAward = {
... ... @@ -1132,7 +1135,7 @@ function RolePlugin.bind(Role)
1132 1135 local now = skynet.timex()
1133 1136 local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年
1134 1137 local ct = 10000 - ct -- 越早的排名越靠前
1135   - local towerTeam = self:getProperty("towerF")
  1138 + local towerTeam = self:getTeamFormatByType(TeamSystemType.Tower)
1136 1139 local battleV = self:getTeamBattleValue(towerTeam.heros)
1137 1140 local score = (level * 10000 + ct) * 10000000 + battleV
1138 1141  
... ... @@ -1279,11 +1282,13 @@ function RolePlugin.bind(Role)
1279 1282 info.specialLevel = hero:getSkillLevel(1)
1280 1283 info.passiveLevel = hero:getSkillLevel(3)
1281 1284 info.runeSkill = hero:getRuneSkill(102)
  1285 + info.talentSkills = hero:getTalentSkill()
1282 1286 teamInfo.heros[slot] = info
1283 1287 end
1284 1288 for slot, id in pairs(team.supports or {}) do
1285 1289 teamInfo.supports[slot] = {id, self.dinerData:getProperty("dishTree"):getv(id, 0)}
1286 1290 end
  1291 + teamInfo.tactics = globalCsv.tactics_skill_passive_cell[team.tactics] and team.tactics or nil
1287 1292 return teamInfo
1288 1293 end
1289 1294  
... ... @@ -1310,13 +1315,10 @@ function RolePlugin.bind(Role)
1310 1315 return self:getRealBattleValue(heros)
1311 1316 end
1312 1317  
1313   - -- 不传参数 只修改保存的阵容信息
1314   - function Role:saveHangTeam(team)
1315   - if not team then
1316   - team = self:getProperty("hangTeam")
1317   - else
1318   - self:updateProperty({field = "hangTeam", value = team})
1319   - end
  1318 + function Role:updateHangTeamInfo()
  1319 + local team = self:getTeamFormatByType(TeamSystemType.Hang)
  1320 + if not team then return end
  1321 +
1320 1322 self:setProperties({
1321 1323 hangTS = self:getTeamHerosInfo(team.heros),
1322 1324 hangTB = self:getTeamBattleInfo(team),
... ... @@ -1324,6 +1326,41 @@ function RolePlugin.bind(Role)
1324 1326 })
1325 1327 end
1326 1328  
  1329 + -- 设置pve阵容
  1330 + function Role:getTeamFormat(index)
  1331 + local teams = self:getProperty("hangTeams") or {}
  1332 + local team = teams[index] or {}
  1333 + return team
  1334 + end
  1335 +
  1336 + function Role:getTeamFormatByType(type)
  1337 + local teamIndex = self:getProperty("teamIndex") or {}
  1338 + local index = teamIndex[type]
  1339 + if not index then return {} end
  1340 +
  1341 + return self:getTeamFormat(index)
  1342 + end
  1343 +
  1344 + function Role:setTeamFormat(index, team)
  1345 + local teams = self:getProperty("hangTeams") or {}
  1346 + teams[index] = team
  1347 + self:updateProperty({field = "hangTeams", value = teams, notNotify = false})
  1348 + end
  1349 +
  1350 + -- 设置拾荒编队阵容
  1351 + function Role:getAdvTeamFormat(index)
  1352 + local teams = self:getProperty("advTeams") or {}
  1353 + local team = teams[index] or {}
  1354 + return team
  1355 + end
  1356 +
  1357 + function Role:setAdvTeamFormat(index, team)
  1358 + local teams = self:getProperty("advTeams") or {}
  1359 + teams[index] = team
  1360 + self:updateProperty({field = "advTeams", value = teams, notNotify = false})
  1361 + end
  1362 +
  1363 +
1327 1364 function Role:savePvpCTeam(team)
1328 1365 if not team then
1329 1366 team = self:getProperty("pvpTC")
... ...
src/models/RoleTask.lua
... ... @@ -33,7 +33,7 @@ local TaskType = {
33 33 HangQuick = 303, -- 快速挂机
34 34 HangBattle = 304, -- 挂机战斗 - id
35 35 HangGetGold = 305, -- 挂机获得齿轮 - count
36   - BonusPass = 306, -- 奖励副本通关 - id
  36 + BonusPass = 306, -- 奖励副本通关 - id count
37 37  
38 38 -- 冒险相关
39 39 AdvPass = 401, -- 冒险通过关 - id level score
... ... @@ -142,7 +142,7 @@ local CommonListener = {
142 142 [TaskType.GiveFriendP] = {{20, f("count")}},
143 143 [TaskType.UnionBoss] = {{21}},
144 144 [TaskType.GetFriendP] = {{22, f("count")}},
145   - [TaskType.BonusPass] = {{23}},
  145 + [TaskType.BonusPass] = {{23, f("count")}},
146 146 [TaskType.AdvStartSelf] = {{24}},
147 147 [TaskType.ShopAll] = {{25, f("count")}},
148 148 [TaskType.RuneUp] = {{26}},
... ... @@ -244,7 +244,7 @@ local CalendaTaskListener = {
244 244 func = "checkCalendaTask",
245 245 listen = {
246 246 [TaskType.DrawHero] = {{1, 1, f("count")}},
247   - [TaskType.BonusPass]= {{2, 1}},
  247 + [TaskType.BonusPass]= {{2, 1, f("count")}},
248 248 [TaskType.AdvStart]= {{3, 1}},
249 249 [TaskType.DinerLevelUp]= {{4, 2, f("level")}},
250 250 [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄
... ...