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,7 +498,8 @@ function _M.buyBonusCountRpc(agent, data) | ||
| 498 | return true | 498 | return true |
| 499 | end | 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 | local open, actId = role.activity:isOpen("BonusDouble") | 503 | local open, actId = role.activity:isOpen("BonusDouble") |
| 503 | local actData = csvdb["activity_ctrlCsv"][actId] | 504 | local actData = csvdb["activity_ctrlCsv"][actId] |
| 504 | local extraCnt = role.storeData:getBonusExtraFightCount() | 505 | local extraCnt = role.storeData:getBonusExtraFightCount() |
| @@ -509,26 +510,33 @@ local function bonusWinReward(role, bonusData, bwin) | @@ -509,26 +510,33 @@ local function bonusWinReward(role, bonusData, bwin) | ||
| 509 | end | 510 | end |
| 510 | local bonusC = role.dailyData:getProperty("bonusC") | 511 | local bonusC = role.dailyData:getProperty("bonusC") |
| 511 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | 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 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 515 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
| 515 | 516 | ||
| 516 | local reward, change | 517 | local reward, change |
| 517 | reward = bonusData.reward:toNumMap() | 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 | end | 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 | for k, v in pairs(reward) do | 529 | for k, v in pairs(reward) do |
| 523 | reward[k] = v * (coef > 1 and actData.condition or 1) | 530 | reward[k] = v * (coef > 1 and actData.condition or 1) |
| 524 | end | 531 | end |
| 532 | + | ||
| 525 | if bwin then -- 满星 额外奖励 | 533 | if bwin then -- 满星 额外奖励 |
| 526 | for k, v in pairs(bonusData.perfect_reward:toNumMap()) do | 534 | for k, v in pairs(bonusData.perfect_reward:toNumMap()) do |
| 527 | reward[k] = (reward[k] or 0) + v | 535 | reward[k] = (reward[k] or 0) + v |
| 528 | end | 536 | end |
| 529 | end | 537 | end |
| 530 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) | 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 | return true, reward, change | 540 | return true, reward, change |
| 533 | end | 541 | end |
| 534 | 542 | ||
| @@ -536,6 +544,7 @@ function _M.startBonusBattleRpc(agent, data) | @@ -536,6 +544,7 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 536 | local role = agent.role | 544 | local role = agent.role |
| 537 | local msg = MsgPack.unpack(data) | 545 | local msg = MsgPack.unpack(data) |
| 538 | local id = msg.id | 546 | local id = msg.id |
| 547 | + local count = msg.count or 1 | ||
| 539 | 548 | ||
| 540 | local open, actId = role.activity:isOpen("BonusDouble") | 549 | local open, actId = role.activity:isOpen("BonusDouble") |
| 541 | 550 | ||
| @@ -560,11 +569,12 @@ function _M.startBonusBattleRpc(agent, data) | @@ -560,11 +569,12 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 560 | if open and actData then | 569 | if open and actData then |
| 561 | coef = tonumber(actData.condition2) | 570 | coef = tonumber(actData.condition2) |
| 562 | end | 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 | local bonusStar = role:getProperty("bonusStar") | 575 | local bonusStar = role:getProperty("bonusStar") |
| 566 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then | 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 | if not status then return 10 * (reward or 0) end | 578 | if not status then return 10 * (reward or 0) end |
| 569 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 579 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
| 570 | else | 580 | else |
src/models/RoleTask.lua
| @@ -33,7 +33,7 @@ local TaskType = { | @@ -33,7 +33,7 @@ local TaskType = { | ||
| 33 | HangQuick = 303, -- 快速挂机 | 33 | HangQuick = 303, -- 快速挂机 |
| 34 | HangBattle = 304, -- 挂机战斗 - id | 34 | HangBattle = 304, -- 挂机战斗 - id |
| 35 | HangGetGold = 305, -- 挂机获得齿轮 - count | 35 | HangGetGold = 305, -- 挂机获得齿轮 - count |
| 36 | - BonusPass = 306, -- 奖励副本通关 - id | 36 | + BonusPass = 306, -- 奖励副本通关 - id count |
| 37 | 37 | ||
| 38 | -- 冒险相关 | 38 | -- 冒险相关 |
| 39 | AdvPass = 401, -- 冒险通过关 - id level score | 39 | AdvPass = 401, -- 冒险通过关 - id level score |
| @@ -142,7 +142,7 @@ local CommonListener = { | @@ -142,7 +142,7 @@ local CommonListener = { | ||
| 142 | [TaskType.GiveFriendP] = {{20, f("count")}}, | 142 | [TaskType.GiveFriendP] = {{20, f("count")}}, |
| 143 | [TaskType.UnionBoss] = {{21}}, | 143 | [TaskType.UnionBoss] = {{21}}, |
| 144 | [TaskType.GetFriendP] = {{22, f("count")}}, | 144 | [TaskType.GetFriendP] = {{22, f("count")}}, |
| 145 | - [TaskType.BonusPass] = {{23}}, | 145 | + [TaskType.BonusPass] = {{23, f("count")}}, |
| 146 | [TaskType.AdvStartSelf] = {{24}}, | 146 | [TaskType.AdvStartSelf] = {{24}}, |
| 147 | [TaskType.ShopAll] = {{25, f("count")}}, | 147 | [TaskType.ShopAll] = {{25, f("count")}}, |
| 148 | [TaskType.RuneUp] = {{26}}, | 148 | [TaskType.RuneUp] = {{26}}, |
| @@ -244,7 +244,7 @@ local CalendaTaskListener = { | @@ -244,7 +244,7 @@ local CalendaTaskListener = { | ||
| 244 | func = "checkCalendaTask", | 244 | func = "checkCalendaTask", |
| 245 | listen = { | 245 | listen = { |
| 246 | [TaskType.DrawHero] = {{1, 1, f("count")}}, | 246 | [TaskType.DrawHero] = {{1, 1, f("count")}}, |
| 247 | - [TaskType.BonusPass]= {{2, 1}}, | 247 | + [TaskType.BonusPass]= {{2, 1, f("count")}}, |
| 248 | [TaskType.AdvStart]= {{3, 1}}, | 248 | [TaskType.AdvStart]= {{3, 1}}, |
| 249 | [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, | 249 | [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, |
| 250 | [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 | 250 | [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 |