Class: BCDice::GameSystem::CyberpunkRed::ShopPeopleTable

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/game_system/cyberpunk_red/tables.rb

Instance Method Summary collapse

Constructor Details

#initialize(locale:, staff_table:, people_a_table:, people_b_table:) ⇒ ShopPeopleTable

Returns a new instance of ShopPeopleTable.



54
55
56
57
58
59
# File 'lib/bcdice/game_system/cyberpunk_red/tables.rb', line 54

def initialize(locale:, staff_table:, people_a_table:, people_b_table:)
  @locale = locale
  @staff_table = staff_table
  @people_a_table = people_a_table
  @people_b_table = people_b_table
end

Instance Method Details

#roll(randomizer) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/bcdice/game_system/cyberpunk_red/tables.rb', line 61

def roll(randomizer)
  result = I18n.translate("CyberpunkRed.ShopPeopleTableText.intro", locale: @locale, raise: true)

  dice = randomizer.roll_once(6)
  staff = @staff_table.choice(dice).body
  staff = staff[0..-2]
  result += staff
  result += I18n.translate("CyberpunkRed.ShopPeopleTableText.shop_staff", locale: @locale, raise: true)

  dice = randomizer.roll_once(6)
  people = @people_a_table.choice(dice).body
  people = people[0..-2]
  result += people
  result += I18n.translate("CyberpunkRed.ShopPeopleTableText.people_a", locale: @locale, raise: true)

  dice = randomizer.roll_once(6)
  people = @people_b_table.choice(dice).body
  people = people[0..-2]
  result += people
  result += I18n.translate("CyberpunkRed.ShopPeopleTableText.people_b", locale: @locale, raise: true)
  result += I18n.translate("CyberpunkRed.ShopPeopleTableText.outro", locale: @locale, raise: true)

  return result
end