Class: BCDice::GameSystem::OneWayHeroics::BranchByDay
- Inherits:
-
Object
- Object
- BCDice::GameSystem::OneWayHeroics::BranchByDay
show all
- Defined in:
- lib/bcdice/game_system/one_way_heroics/random_event_table.rb
Instance Method Summary
collapse
Constructor Details
#initialize(text, less_than_equal, greater) ⇒ BranchByDay
Returns a new instance of BranchByDay.
39
40
41
42
43
|
# File 'lib/bcdice/game_system/one_way_heroics/random_event_table.rb', line 39
def initialize(text, less_than_equal, greater)
@text = text
@greater = greater
@less_than_equal = less_than_equal
end
|
Instance Method Details
#branch_result(value, day) ⇒ Object
70
71
72
|
# File 'lib/bcdice/game_system/one_way_heroics/random_event_table.rb', line 70
def branch_result(value, day)
raise NotImplementedError
end
|
#choice(value, day) ⇒ Object
66
67
68
|
# File 'lib/bcdice/game_system/one_way_heroics/random_event_table.rb', line 66
def choice(value, day)
raise NotImplementedError
end
|
#roll_with_day(day, randomizer) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/bcdice/game_system/one_way_heroics/random_event_table.rb', line 45
def roll_with_day(day, randomizer)
value = randomizer.roll_once(6)
chosen = choice(value, day)
chosen =
if chosen.respond_to?(:roll_with_day)
"#{chosen.key}#{day} > #{chosen.roll_with_day(day, randomizer)}"
elsif chosen.ascii_only?
[chosen, TABLES[chosen].roll(randomizer)].join(" > ")
else
chosen
end
result = <<~RESULT.chomp
#{@text} >
1D6 > #{value} > #{branch_result(value, day)} >
#{chosen}
RESULT
return result
end
|