Commit 216fb30d4bb95089c23fbfb024c7a04ccba8e939

Authored by zhouhaihai
1 parent 6433fe76

连抽 bug

Showing 1 changed file with 19 additions and 15 deletions   Show diff stats
src/actions/HeroAction.lua
@@ -765,25 +765,29 @@ function _M.drawHeroRpc(agent, data) @@ -765,25 +765,29 @@ function _M.drawHeroRpc(agent, data)
765 end, 765 end,
766 } 766 }
767 767
768 - if not fillPoolFunc[rateTypes[rateType]] then return 4 end  
769 - fillPoolFunc[rateTypes[rateType]]()  
770 - if not next(resultPool) then return 5 end  
771 role:costItems(cost) 768 role:costItems(cost)
772 769
773 local reward = {} 770 local reward = {}
774 for i = 1, drawCount[drawType] do 771 for i = 1, drawCount[drawType] do
775 - local idx = math.randWeight(resultPool, 3)  
776 - local temp = resultPool[idx]  
777 - local itemData = csvdb["itemCsv"][temp[1]]  
778 - if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then  
779 - local fragId = itemData.id - ItemStartId.Hero  
780 - local heroData = csvdb["unitCsv"][fragId]  
781 - local count = globalCsv.draw_unit_tofragment[heroData.rare] * temp[2]  
782 - role:award({[fragId] = count})  
783 - table.insert(reward, {id = fragId, count = count, from = temp[1], fcount = temp[2]})  
784 - else  
785 - role:award({[temp[1]] = temp[2]})  
786 - table.insert(reward, {id = temp[1], count = temp[2]}) 772 +
  773 + resultPool = {}
  774 + if not fillPoolFunc[rateTypes[rateType]] then return 4 end
  775 + fillPoolFunc[rateTypes[rateType]]()
  776 +
  777 + if next(resultPool) then
  778 + local idx = math.randWeight(resultPool, 3)
  779 + local temp = resultPool[idx]
  780 + local itemData = csvdb["itemCsv"][temp[1]]
  781 + if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then
  782 + local fragId = itemData.id - ItemStartId.Hero
  783 + local heroData = csvdb["unitCsv"][fragId]
  784 + local count = globalCsv.draw_unit_tofragment[heroData.rare] * temp[2]
  785 + role:award({[fragId] = count})
  786 + table.insert(reward, {id = fragId, count = count, from = temp[1], fcount = temp[2]})
  787 + else
  788 + role:award({[temp[1]] = temp[2]})
  789 + table.insert(reward, {id = temp[1], count = temp[2]})
  790 + end
787 end 791 end
788 end 792 end
789 793