Commit fa8ba58d90d81e75c82ab1d1fc325f8439f1d577
1 parent
f4bbb208
餐厅委托增加 出现概率
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
src/models/Diner.lua
@@ -52,14 +52,14 @@ function Diner:refreshDailyData(notify) | @@ -52,14 +52,14 @@ function Diner:refreshDailyData(notify) | ||
52 | end | 52 | end |
53 | end | 53 | end |
54 | if show then | 54 | if show then |
55 | - table.insert(pool, id) | 55 | + table.insert(pool, {id, data.chance}) |
56 | end | 56 | end |
57 | end | 57 | end |
58 | end | 58 | end |
59 | 59 | ||
60 | if #pool > 0 then | 60 | if #pool > 0 then |
61 | - local idx = math.randomInt(1, #pool) | ||
62 | - entrust[i] = pool[idx] | 61 | + local idx = math.randWeight(pool, 2) |
62 | + entrust[i] = pool[idx][1] | ||
63 | change = true | 63 | change = true |
64 | table.remove(pool, idx) | 64 | table.remove(pool, idx) |
65 | end | 65 | end |