Class: BCDice::GameSystem::BeginningIdol::TableWithAbnormality

Inherits:
DiceTable::Table
  • Object
show all
Includes:
WithAbnormality
Defined in:
lib/bcdice/game_system/beginning_idol/with_abnormality.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WithAbnormality

#kanji_to_i, #replace_abnormality

Methods inherited from DiceTable::Table

#choice

Constructor Details

#initialize(name, type, items, bad_status_table, locale) ⇒ TableWithAbnormality

Returns a new instance of TableWithAbnormality.



61
62
63
64
65
# File 'lib/bcdice/game_system/beginning_idol/with_abnormality.rb', line 61

def initialize(name, type, items, bad_status_table, locale)
  super(name, type, items)
  @bad_status_table = bad_status_table
  @locale = locale
end

Class Method Details

.from_i18n(key, bad_status_table, locale) ⇒ Object



56
57
58
59
# File 'lib/bcdice/game_system/beginning_idol/with_abnormality.rb', line 56

def self.from_i18n(key, bad_status_table, locale)
  table = I18n.t(key, locale: locale)
  new(table[:name], table[:type], table[:items], bad_status_table, locale)
end

Instance Method Details

#roll(randomizer) ⇒ Object



67
68
69
70
# File 'lib/bcdice/game_system/beginning_idol/with_abnormality.rb', line 67

def roll(randomizer)
  chosen = super(randomizer)
  replace_abnormality(chosen, randomizer)
end