Commit 78139af831022880a557b41cde0a28eafddbe39c
1 parent
c0c49098
ssr增加硬性保底
Showing
1 changed file
with
35 additions
and
13 deletions
Show diff stats
src/actions/HeroAction.lua
| @@ -865,6 +865,11 @@ function _M.drawHeroRpc(agent, data) | @@ -865,6 +865,11 @@ function _M.drawHeroRpc(agent, data) | ||
| 865 | 865 | ||
| 866 | local unitPool = csvdb["build_unitCsv"][poolId] | 866 | local unitPool = csvdb["build_unitCsv"][poolId] |
| 867 | if not unitPool then return 7 end | 867 | if not unitPool then return 7 end |
| 868 | + -- ssr硬性保底 | ||
| 869 | + local isSSRup = false | ||
| 870 | + if unitPool["rare_"..HeroQuality.SSR] or 0 > 0 then | ||
| 871 | + isSSRup = true | ||
| 872 | + end | ||
| 868 | 873 | ||
| 869 | -- 开始抽 | 874 | -- 开始抽 |
| 870 | local resultPool = {} | 875 | local resultPool = {} |
| @@ -872,21 +877,38 @@ function _M.drawHeroRpc(agent, data) | @@ -872,21 +877,38 @@ function _M.drawHeroRpc(agent, data) | ||
| 872 | local condition = {"rare"} | 877 | local condition = {"rare"} |
| 873 | local values = {} | 878 | local values = {} |
| 874 | 879 | ||
| 880 | + -- check ssr up | ||
| 881 | + if isSSRup then | ||
| 882 | + local ssrUpMap = role:getProperty("ssrUp") or {} | ||
| 883 | + local ssrFloorCnt = ssrUpMap[poolId] or 0 | ||
| 884 | + if ssrFloorCnt >= (globalCsv.draw_ssr_guarantee or 40) - 1 then | ||
| 885 | + values[1] = HeroQuality.SSR | ||
| 886 | + ssrUpMap[poolId] = 0 | ||
| 887 | + else | ||
| 888 | + for idx, field in ipairs(condition) do | ||
| 889 | + if not values[idx] then | ||
| 890 | + local lpool = {} | ||
| 891 | + local curIdx = 1 | ||
| 892 | + while unitPool[field .. "_" .. curIdx] do | ||
| 893 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
| 894 | + curIdx = curIdx + 1 | ||
| 895 | + end | ||
| 896 | + | ||
| 897 | + if next(lpool) then | ||
| 898 | + values[idx] = math.randWeight(lpool, 1) | ||
| 899 | + end | ||
| 900 | + end | ||
| 901 | + end | ||
| 902 | + if values[1] == HeroQuality.SSR then | ||
| 903 | + ssrUpMap[poolId] = 0 | ||
| 904 | + else | ||
| 905 | + ssrUpMap[poolId] = ssrFloorCnt + 1 | ||
| 906 | + end | ||
| 907 | + end | ||
| 908 | + role:updateProperty({field="ssrUp", value = ssrUpMap, notNotify = true}) | ||
| 909 | + end | ||
| 875 | 910 | ||
| 876 | - for idx, field in ipairs(condition) do | ||
| 877 | - if not values[idx] then | ||
| 878 | - local lpool = {} | ||
| 879 | - local curIdx = 1 | ||
| 880 | - while unitPool[field .. "_" .. curIdx] do | ||
| 881 | - lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
| 882 | - curIdx = curIdx + 1 | ||
| 883 | - end | ||
| 884 | 911 | ||
| 885 | - if next(lpool) then | ||
| 886 | - values[idx] = math.randWeight(lpool, 1) | ||
| 887 | - end | ||
| 888 | - end | ||
| 889 | - end | ||
| 890 | 912 | ||
| 891 | local weight = 0 | 913 | local weight = 0 |
| 892 | local up_pool = nil | 914 | local up_pool = nil |