stattr 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/stattr.rb +29 -2
- metadata +1 -1
data/lib/stattr.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Normstats = ['STR', 'DEX', 'CHA', 'INT', 'WIS', 'CON']
|
2
2
|
|
3
3
|
# Roll a D(sides) size die.
|
4
4
|
def rolld(sides)
|
@@ -47,9 +47,36 @@ 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
|
-
|
50
|
+
Normstats.each do |stat|
|
51
51
|
stathash[stat] = modstat(rollmanyd(6,3))
|
52
52
|
end
|
53
53
|
stathash
|
54
54
|
end
|
55
55
|
|
56
|
+
|
57
|
+
#Classes
|
58
|
+
# Extend these to increase the overall functionality of your app/game!
|
59
|
+
|
60
|
+
|
61
|
+
class Statlist
|
62
|
+
attr_accessor :str, :dex, :cha, :con, :wis, :int
|
63
|
+
@@sides = 6
|
64
|
+
@@dicenum = 3
|
65
|
+
def initialize
|
66
|
+
@str = modstat(rollmanyd(@@sides, @@dicenum))
|
67
|
+
@dex = modstat(rollmanyd(@@sides, @@dicenum))
|
68
|
+
@cha = modstat(rollmanyd(@@sides, @@dicenum))
|
69
|
+
@con = modstat(rollmanyd(@@sides, @@dicenum))
|
70
|
+
@wis = modstat(rollmanyd(@@sides, @@dicenum))
|
71
|
+
@int = modstat(rollmanyd(@@sides, @@dicenum))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Playerchar
|
76
|
+
attr_accessor :stats, :name
|
77
|
+
|
78
|
+
def initialize(name)
|
79
|
+
@name = name
|
80
|
+
@stats = Statlist.new
|
81
|
+
end
|
82
|
+
end
|