Class: GURPS

Inherits:
DiceBag::Roll show all
Defined in:
lib/dicebag/systems/gurps.rb

Overview

This models the standard GURPS 3d6 dice pool used for attribute/skill tests.

This will return an array of [status, result] where:

  • status is one of: :success, :failure, :critical_success, or :critical_failure

  • result is the actual dice roll total.

Instance Attribute Summary

Attributes inherited from DiceBag::Roll

#dstr, #tree

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DiceBag::Roll

#average, #maximum, #minimum, #notes, #notes_to_s, #result

Methods included from RollString

#inspect, #to_s

Constructor Details

#initializeGURPS

Returns a new instance of GURPS.



15
16
17
# File 'lib/dicebag/systems/gurps.rb', line 15

def initialize
  super('3d6')
end

Class Method Details

.roll(target, mod = 0) ⇒ Object



11
12
13
# File 'lib/dicebag/systems/gurps.rb', line 11

def self.roll(target, mod = 0)
  new.roll(target, mod)
end

Instance Method Details

#roll(target, mod = 0) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dicebag/systems/gurps.rb', line 19

def roll(target, mod = 0)
  mod = 0 unless mod.is_a?(Integer)

  @total_target = target + mod
  @total        = super().total

  figure_success
  figure_failure

  [figure_result, @total]
end