Commit d3c0d87f37d331944f32e02ef871b3bd2b64f040
1 parent
5697f9b3
零件 bug
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
src/models/Rune.lua
| ... | ... | @@ -63,14 +63,16 @@ end |
| 63 | 63 | |
| 64 | 64 | -- types 类型=权重"2=100 3=100 4=100" value最大值=最小值 "50=100 50=100 100=200" |
| 65 | 65 | local function getRandomValue(types,values) |
| 66 | - local typeMap = types:toNumMap() | |
| 66 | + local typeMap = types:toArray() | |
| 67 | 67 | local valueArry = values:toArray() |
| 68 | 68 | |
| 69 | - if table.nums(typeMap) ~= #valueArry then return nil end | |
| 69 | + if #typeMap ~= #valueArry then return nil end | |
| 70 | + | |
| 70 | 71 | local typ, value |
| 71 | 72 | local typTab = {} |
| 72 | - for t,w in pairs(typeMap) do | |
| 73 | - table.insert(typTab,{t=t,w=w}) | |
| 73 | + for _,w in ipairs(typeMap) do | |
| 74 | + w = w:toArray(true, "=") | |
| 75 | + table.insert(typTab,{t=w[1],w=w[2]}) | |
| 74 | 76 | end |
| 75 | 77 | |
| 76 | 78 | local tk = math.randWeight(typTab, "w") | ... | ... |