Commit e22ded1bb23b14cc8e894a9ea692281d20301486

Authored by zhouhaihai
1 parent e7c3d3da

被动技奖励

Showing 1 changed file with 13 additions and 6 deletions   Show diff stats
src/adv/Adv.lua
... ... @@ -642,16 +642,13 @@ function Adv:over(success, rewardRatio, overType)
642 642 end
643 643 local chapterData = csvdb["adv_chapterCsv"][self.chapterId]
644 644 -- 扣除的东西给积分
645   - local reward = self.owner:getProperty("advItems"):toNumMap()
646 645 local addScore = 0
647   - for itemId, count in pairs(reward) do
  646 + for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do
648 647 local itemCsv = csvdb["itemCsv"][itemId]
649 648 if not itemCsv then
650 649 print("ERROR: no itemId in ItemCsv : ", itemId)
651 650 elseif itemCsv.type == ItemType.AdvItem then
652 651 addScore = addScore + count * itemCsv.advScore
653   - else
654   - reward[itemId] = math.ceil(count * rewardRatio / 100)
655 652 end
656 653 end
657 654 self:scoreChange(AdvScoreType.ItemBack, addScore)
... ... @@ -662,10 +659,20 @@ function Adv:over(success, rewardRatio, overType)
662 659 local scoreReward = math.floor(score / chapterData.scoreAward)
663 660 self.owner:award({[ItemId.OldCoin] = scoreReward})
664 661  
665   - reward = self.owner:award(reward)
666   -
  662 + -- 被动技会影响奖励
667 663 self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level})
668 664  
  665 + local reward = {}
  666 + for itemId, count in pairs(self.owner:getProperty("advItems"):toNumMap()) do
  667 + local itemCsv = csvdb["itemCsv"][itemId]
  668 + if not itemCsv then
  669 + print("ERROR: no itemId in ItemCsv : ", itemId)
  670 + elseif itemCsv.type ~= ItemType.AdvItem then
  671 + reward[itemId] = math.ceil(count * rewardRatio / 100)
  672 + end
  673 + end
  674 + reward = self.owner:award(reward)
  675 +
669 676 if success then
670 677 self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score})
671 678  
... ...