Class: BCDice::GameSystem::MagicaLogia::FallenAfterTable
- Inherits:
-
Object
- Object
- BCDice::GameSystem::MagicaLogia::FallenAfterTable
- Defined in:
- lib/bcdice/game_system/MagicaLogia.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, items_lower, items_higher) ⇒ FallenAfterTable
constructor
A new instance of FallenAfterTable.
- #roll(randomizer) ⇒ Object
Constructor Details
#initialize(name, items_lower, items_higher) ⇒ FallenAfterTable
Returns a new instance of FallenAfterTable.
159 160 161 162 163 |
# File 'lib/bcdice/game_system/MagicaLogia.rb', line 159 def initialize(name, items_lower, items_higher) @name = name @lower = items_lower @higher = items_higher end |
Class Method Details
.from_i18n(key, locale) ⇒ Object
154 155 156 157 |
# File 'lib/bcdice/game_system/MagicaLogia.rb', line 154 def self.from_i18n(key, locale) table = I18n.t(key, locale: locale, raise: true) new(table[:name], table[:items_lower], table[:items_higher]) end |
Instance Method Details
#roll(randomizer) ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/bcdice/game_system/MagicaLogia.rb', line 165 def roll(randomizer) val1, val2 = randomizer.(2, 6) table = val1 <= 3 ? @lower : @higher "#{@name}(#{val1},#{val2}) > #{table[val2 - 1]}" end |