stattr 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stattr.rb +6 -6
- metadata +1 -1
data/lib/stattr.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
Statlist = ['STR', 'DEX', 'CHA', 'INT', 'WIS', 'CON']
|
2
2
|
|
3
3
|
# Roll a D(sides) size die.
|
4
4
|
def rolld(sides)
|
5
|
-
|
5
|
+
rand(sides) + 1
|
6
6
|
end
|
7
7
|
|
8
8
|
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
def rollmanyd(sides, dice)
|
11
11
|
rolls = 0
|
12
12
|
(1..dice).each do |i|
|
13
|
-
rolls = rolls +
|
13
|
+
rolls = rolls + rolld(sides)
|
14
14
|
end
|
15
15
|
rolls
|
16
16
|
end
|
@@ -39,7 +39,7 @@ modlist = []
|
|
39
39
|
else
|
40
40
|
puts "nothing"
|
41
41
|
end
|
42
|
-
|
42
|
+
modlist
|
43
43
|
end
|
44
44
|
|
45
45
|
|
@@ -47,8 +47,8 @@ end
|
|
47
47
|
#This iterates through the Stat list and turns each stat into a key. It then rolls 3 d6's to get the starting value for that stat.
|
48
48
|
def statroll
|
49
49
|
stathash = {}
|
50
|
-
|
51
|
-
stathash[stat] = modstat(
|
50
|
+
Statlist.each do |stat|
|
51
|
+
stathash[stat] = modstat(rollmanyd(6,3))
|
52
52
|
end
|
53
53
|
stathash
|
54
54
|
end
|