1 |
well the good news is i dont think we need white lists so long as we target values above 1 tested no more crashes
|
1 |
well the good news is i dont think we need white lists so long as we target values above 1 tested no more crashes
|
|
|
2 |
\n
|
|
|
3 |
what about this?
|
|
|
4 |
\n
|
|
|
5 |
[spoiler]
|
|
|
6 |
{{{
|
|
|
7 |
local function normalrandom()
|
|
|
8 |
local u1 = math.random()
|
|
|
9 |
local u2 = math.random()
|
|
|
10 |
local z = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
|
|
|
11 |
return z
|
|
|
12 |
end
|
|
|
13 |
local function grp(minp, maxp)
|
|
|
14 |
local mid = (minp + maxp) / 2
|
|
|
15 |
local range = maxp - minp
|
|
|
16 |
local z = normalrandom()
|
|
|
17 |
local perc = mid + (z * (range / 4))
|
|
|
18 |
perc = math.max(minp, math.min(maxp, perc))
|
|
|
19 |
return perc / 100
|
|
|
20 |
end
|
|
|
21 |
for name, ud in pairs(UnitDefs) do
|
|
|
22 |
if ud.weapondefs then
|
|
|
23 |
for _, wd in pairs(ud.weapondefs) do
|
|
|
24 |
for key, value in pairs(wd) do
|
|
|
25 |
if type(value) == "number" and value > 1 then
|
|
|
26 |
local minp = 25
|
|
|
27 |
local maxp = 400
|
|
|
28 |
local rp = grp(minp, maxp)
|
|
|
29 |
wd[key] = math.floor(value * rp)
|
|
|
30 |
end
|
|
|
31 |
end
|
|
|
32 |
end
|
|
|
33 |
end
|
|
|
34 |
end
|
|
|
35 |
\n
|
|
|
36 |
}}}
|
|
|
37 |
[/spoiler]
|