You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
463 B
Lua
20 lines
463 B
Lua
3 years ago
|
local rng = {}
|
||
|
local tools = require("./tools.lua")
|
||
|
|
||
|
function rng.d20()
|
||
|
tools.reseed()
|
||
|
dice = math.random(20)
|
||
|
messagePart1 = ('You rolled a ' .. dice .. ' out of 20')
|
||
|
if dice==20 then
|
||
|
messagePart2 = ('Nat 20! Crititcal Hit')
|
||
|
else if dice==1 then
|
||
|
messagePart2 = ('Nat 1! Critical Shit!')
|
||
|
else
|
||
|
messagePart2 = ""
|
||
|
end
|
||
|
end
|
||
|
message = messagePart1 .. '\n' .. messagePart2
|
||
|
return message
|
||
|
end
|
||
|
|
||
|
return rng
|