Commit e4a17692f08a2610340d7757974f7de17fa512b5

Authored by zhouhaihai
1 parent 3139a116

奖励关卡 满星奖励

Showing 1 changed file with 11 additions and 5 deletions   Show diff stats
src/actions/HangAction.lua
@@ -498,7 +498,7 @@ function _M.buyBonusCountRpc(agent, data) @@ -498,7 +498,7 @@ function _M.buyBonusCountRpc(agent, data)
498 return true 498 return true
499 end 499 end
500 500
501 -local function bonusWinReward(role, bonusData) 501 +local function bonusWinReward(role, bonusData, bwin)
502 local open, actId = role.activity:isOpen("BonusDouble") 502 local open, actId = role.activity:isOpen("BonusDouble")
503 local actData = csvdb["activity_ctrlCsv"][actId] 503 local actData = csvdb["activity_ctrlCsv"][actId]
504 local extraCnt = role.storeData:getBonusExtraFightCount() 504 local extraCnt = role.storeData:getBonusExtraFightCount()
@@ -522,6 +522,11 @@ local function bonusWinReward(role, bonusData) @@ -522,6 +522,11 @@ local function bonusWinReward(role, bonusData)
522 for k, v in pairs(reward) do 522 for k, v in pairs(reward) do
523 reward[k] = v * (coef > 1 and actData.condition or 1) 523 reward[k] = v * (coef > 1 and actData.condition or 1)
524 end 524 end
  525 + if bwin then -- 满星 额外奖励
  526 + for k, v in pairs(bonusData.perfect_reward:toNumMap()) do
  527 + reward[k] = (reward[k] or 0) + v
  528 + end
  529 + end
525 reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) 530 reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}})
526 role:checkTaskEnter("BonusPass", {id = id}) 531 role:checkTaskEnter("BonusPass", {id = id})
527 return true, reward, change 532 return true, reward, change
@@ -597,9 +602,6 @@ function _M.endBonusBattleRpc(agent, data) @@ -597,9 +602,6 @@ function _M.endBonusBattleRpc(agent, data)
597 if starNum and starNum > 0 then 602 if starNum and starNum > 0 then
598 -- 胜利扣除次数 603 -- 胜利扣除次数
599 604
600 - local status, reward, change = bonusWinReward(role, bonusData)  
601 - if not status then return 10 + (reward or 0) end  
602 -  
603 local bTeam = self:getTeamFormatByType(TeamSystemType.BonusBattle) 605 local bTeam = self:getTeamFormatByType(TeamSystemType.BonusBattle)
604 local herosInfo = self:getTeamHerosInfo(bTeam.heros) 606 local herosInfo = self:getTeamHerosInfo(bTeam.heros)
605 607
@@ -652,11 +654,15 @@ function _M.endBonusBattleRpc(agent, data) @@ -652,11 +654,15 @@ function _M.endBonusBattleRpc(agent, data)
652 return msg.info.atime and msg.info.atime <= cond 654 return msg.info.atime and msg.info.atime <= cond
653 end 655 end
654 curStar = 0 656 curStar = 0
655 - for i, cond in ipairs(bonusData.sweep_condition:toTableArray(true)) do 657 + local sweepConds = bonusData.sweep_condition:toTableArray(true)
  658 + for i, cond in ipairs(sweepConds) do
656 if check[cond[1]] and check[cond[1]](table.unpack(cond)) then 659 if check[cond[1]] and check[cond[1]](table.unpack(cond)) then
657 curStar = curStar + (1 << (i - 1)) 660 curStar = curStar + (1 << (i - 1))
658 end 661 end
659 end 662 end
  663 + local status
  664 + status, reward, change = bonusWinReward(role, bonusData, curStar >= (1 << #sweepConds) - 1)
  665 + if not status then return 10 + (reward or 0) end
660 else 666 else
661 curStar = 0 667 curStar = 0
662 end 668 end