class FTLTools::Planet
Attributes
name[R]
Public Class Methods
new(data = {})
click to toggle source
# File lib/ftl_tools/planet.rb, line 7 def initialize(data = {}) @data = data @dice = FTLTools::Dice.new set_data end
Public Instance Methods
generate_name()
click to toggle source
# File lib/ftl_tools/planet.rb, line 18 def generate_name "Guido" end
generate_uwp()
click to toggle source
# File lib/ftl_tools/planet.rb, line 22 def generate_uwp uwp = Hash.new standard_roll = '2d6-2' uwp[:starport] = ['A', 'B', 'C', 'D', 'E', 'X'].sample uwp[:size] = @dice.roller(standard_roll) uwp[:atmo] = @dice.roller(standard_roll) uwp[:hydro] = @dice.roller(standard_roll) uwp[:pop] = @dice.roller(standard_roll) uwp[:gov] = @dice.roller(standard_roll) uwp[:law] = @dice.roller(standard_roll) uwp[:tech] = @dice.roller(standard_roll) uwp end
set_data()
click to toggle source
# File lib/ftl_tools/planet.rb, line 13 def set_data @name = @data.fetch(:name, generate_name) @uwp = @data.fetch(:uwp, generate_uwp) end
uwp_s()
click to toggle source
# File lib/ftl_tools/planet.rb, line 36 def uwp_s uwp_string = @uwp[:starport] uwp_string += @uwp[:size].to_s(16).upcase uwp_string += @uwp[:atmo].to_s(16).upcase uwp_string += @uwp[:hydro].to_s(16).upcase uwp_string += @uwp[:pop].to_s(16).upcase uwp_string += @uwp[:gov].to_s(16).upcase uwp_string += @uwp[:law].to_s(16).upcase uwp_string += '-' uwp_string += @uwp[:tech].to_s(16).upcase uwp_string end