Commit be24b6ad8b0ac8fb3a0bed1890dbe809679b7a86
1 parent
ce950b6e
传递 count
Showing
2 changed files
with
22 additions
and
12 deletions
Show diff stats
src/actions/HangAction.lua
... | ... | @@ -498,7 +498,8 @@ function _M.buyBonusCountRpc(agent, data) |
498 | 498 | return true |
499 | 499 | end |
500 | 500 | |
501 | -local function bonusWinReward(role, bonusData, bwin) | |
501 | +local function bonusWinReward(role, bonusData, bwin, count) | |
502 | + count = count or 1 | |
502 | 503 | local open, actId = role.activity:isOpen("BonusDouble") |
503 | 504 | local actData = csvdb["activity_ctrlCsv"][actId] |
504 | 505 | local extraCnt = role.storeData:getBonusExtraFightCount() |
... | ... | @@ -509,26 +510,33 @@ local function bonusWinReward(role, bonusData, bwin) |
509 | 510 | end |
510 | 511 | local bonusC = role.dailyData:getProperty("bonusC") |
511 | 512 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} |
512 | - if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] <= 0 then return false, 1 end | |
513 | - bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 | |
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 | |
514 | 515 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
515 | 516 | |
516 | 517 | local reward, change |
517 | 518 | reward = bonusData.reward:toNumMap() |
518 | - local chance = bonusData.chance:randWeight(true) | |
519 | - if chance[1] ~= 0 then | |
520 | - reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] | |
519 | + for itemId, c in pairs(reward) do | |
520 | + reward[itemId] = c * count | |
521 | 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 | + | |
522 | 529 | for k, v in pairs(reward) do |
523 | 530 | reward[k] = v * (coef > 1 and actData.condition or 1) |
524 | 531 | end |
532 | + | |
525 | 533 | if bwin then -- 满星 额外奖励 |
526 | 534 | for k, v in pairs(bonusData.perfect_reward:toNumMap()) do |
527 | 535 | reward[k] = (reward[k] or 0) + v |
528 | 536 | end |
529 | 537 | end |
530 | 538 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) |
531 | - role:checkTaskEnter("BonusPass", {id = id}) | |
539 | + role:checkTaskEnter("BonusPass", {id = id, count = count}) | |
532 | 540 | return true, reward, change |
533 | 541 | end |
534 | 542 | |
... | ... | @@ -536,6 +544,7 @@ function _M.startBonusBattleRpc(agent, data) |
536 | 544 | local role = agent.role |
537 | 545 | local msg = MsgPack.unpack(data) |
538 | 546 | local id = msg.id |
547 | + local count = msg.count or 1 | |
539 | 548 | |
540 | 549 | local open, actId = role.activity:isOpen("BonusDouble") |
541 | 550 | |
... | ... | @@ -560,11 +569,12 @@ function _M.startBonusBattleRpc(agent, data) |
560 | 569 | if open and actData then |
561 | 570 | coef = tonumber(actData.condition2) |
562 | 571 | end |
563 | - if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] <= 0 then return 7 end | |
572 | + | |
573 | + if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | |
564 | 574 | |
565 | 575 | local bonusStar = role:getProperty("bonusStar") |
566 | 576 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then |
567 | - local status, reward, change = bonusWinReward(role, bonusData) | |
577 | + local status, reward, change = bonusWinReward(role, bonusData, nil, count) | |
568 | 578 | if not status then return 10 * (reward or 0) end |
569 | 579 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
570 | 580 | else | ... | ... |
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级英雄 | ... | ... |