Class: Stattr::Stat
- Inherits:
-
Object
- Object
- Stattr::Stat
- Defined in:
- lib/stattr.rb
Overview
Representing a stat in a game.
Instance Attribute Summary collapse
-
#mod ⇒ Object
The Calculated modifier of the stat.
-
#val ⇒ Object
The value of the stat.
Instance Method Summary collapse
-
#initialize(value) ⇒ Stat
constructor
A new instance of Stat.
-
#modstat(r) ⇒ Integer
Creates stat/mod array.
Constructor Details
#initialize(value) ⇒ Stat
Returns a new instance of Stat.
128 129 130 131 |
# File 'lib/stattr.rb', line 128 def initialize(value) @val= value @mod= modstat(value) end |
Instance Attribute Details
#mod ⇒ Object
The Calculated modifier of the stat
126 |
# File 'lib/stattr.rb', line 126 attr_accessor :val, :mod |
#val ⇒ Object
The value of the stat
126 127 128 |
# File 'lib/stattr.rb', line 126 def val @val end |
Instance Method Details
#modstat(r) ⇒ Integer
Creates stat/mod array.
136 137 138 |
# File 'lib/stattr.rb', line 136 def modstat(r) modr = ((r-10)/2).to_int end |