Class: Stattr::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/stattr.rb

Overview

The Class that defines, in other applications, the “rules” of that game - the stats, the sides of a given die, and so on.

Class Method Summary collapse

Class Method Details

.dice_numInteger

The number of dice required to create a stat in this game

Returns:

  • (Integer)


23
24
25
# File 'lib/stattr.rb', line 23

def self.dice_num
  3
end

.dice_sidesInteger

How many sides the generating dice have in this game.

Returns:

  • (Integer)


15
16
17
# File 'lib/stattr.rb', line 15

def self.dice_sides
  6
end

.make_stat(val = 1) ⇒ Object

The math for generating a stat.

Returns:

  • (Object)


31
32
33
# File 'lib/stattr.rb', line 31

def self.make_stat(val=1)
  Stat.new(DiceRoll.new_roll(Game.dice_sides, Game.dice_num))
end

.statsArray

The list of stats for this game.

Returns:

  • (Array)


39
40
41
# File 'lib/stattr.rb', line 39

def self.stats
  ["str", "con", "wis", "int", "cha", "dex"]
end