Class: BCDice::CommonCommand::D66Dice

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/common_command/d66_dice.rb

Constant Summary collapse

PREFIX_PATTERN =
/D66/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret:, sort_type:, suffix:) ⇒ D66Dice

Returns a new instance of D66Dice.

Parameters:

  • secret (Boolean)
  • sort_type (Symbol)
  • suffix (String, nil)


48
49
50
51
52
# File 'lib/bcdice/common_command/d66_dice.rb', line 48

def initialize(secret:, sort_type:, suffix:)
  @secret = secret
  @sort_type = sort_type
  @suffix = suffix
end

Class Method Details

.eval(command, game_system, randomizer) ⇒ Result?

Parameters:

Returns:



13
14
15
16
# File 'lib/bcdice/common_command/d66_dice.rb', line 13

def eval(command, game_system, randomizer)
  cmd = parse(command, game_system)
  cmd&.eval(randomizer)
end

Instance Method Details

#eval(randomizer) ⇒ Result

Parameters:

Returns:



56
57
58
59
60
61
62
63
# File 'lib/bcdice/common_command/d66_dice.rb', line 56

def eval(randomizer)
  value = roll(randomizer)

  Result.new.tap do |r|
    r.secret = @secret
    r.text = "(D66#{@suffix}) > #{value}"
  end
end