Class: CARPS::RolePlayInterface
- Inherits:
-
QuitInterface
- Object
- Interface
- QuitInterface
- CARPS::RolePlayInterface
- Defined in:
- lib/carps/mod/interface.rb
Overview
Interface for roleplaying
Direct Known Subclasses
Instance Method Summary collapse
- #d(n) ⇒ Object
- #dec(min, max) ⇒ Object
-
#initialize ⇒ RolePlayInterface
constructor
A new instance of RolePlayInterface.
- #int(min, max) ⇒ Object
Methods inherited from Interface
Constructor Details
#initialize ⇒ RolePlayInterface
Returns a new instance of RolePlayInterface.
29 30 31 32 33 34 |
# File 'lib/carps/mod/interface.rb', line 29 def initialize super add_command "d", "Roll a dice with a given number of sides.", "SIDES" add_command "int", "An random integer between MIN and MAX.", "MIN", "MAX" add_command "dec", "A decimal between MIN and MAX.", "MIN", "MAX" end |
Instance Method Details
#d(n) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/carps/mod/interface.rb', line 36 def d n i = n.to_i if i <= 1 UI::put_error "A dice must have more than 1 side." else puts Dice::rint(1, i) end end |