Class: Astromapper::Builder::Terrestrial

Inherits:
Planet show all
Defined in:
lib/astromapper/builder/orbit.rb

Direct Known Subclasses

World

Instance Attribute Summary

Attributes inherited from Orbit

#au, #id, #kid, #orbit_number, #port, #xsize

Attributes inherited from Base

#root_dir

Instance Method Summary collapse

Methods inherited from Planet

#make_moons, #uwp

Methods inherited from Orbit

#biozone?, #distant?, #inner?, #km, #limit?, #outer?, #period, #populate, #populate_biozone, #populate_inner, #populate_outer, #radii, #to_ascii, #to_s, #uwp

Methods inherited from Base

#config, constitute, #names, #spawn_command, #toss

Constructor Details

#initialize(star, orbit_number) ⇒ Terrestrial

Returns a new instance of Terrestrial.



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/astromapper/builder/orbit.rb', line 168

def initialize(star,orbit_number)
  super
  @kid       = 'R'
  
  # Size, Climate & Biosphere. MgT 170--71.
  @size      = toss(2,1)
  @atmo      = toss()
                          # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F 
  temp_dice  = toss(2,0) + [0, 0,-2,-2,-1,-1, 0, 0, 1, 1, 2, 6, 6, 2,-1, 2][@atmo]
  
  @temp      = %w{F F F C C T T T T T H H R R R R R }[temp_dice]
  
  # Hydrographics. MgT p. 172
  @h20 = case 
    when (@size < 2 or !biozone?) then 0
    when ([0,1,10,11,12].include?(@atmo)) then (toss(2,11) + @size).max(10)
    else @h20  = (toss(2,7) + @size).max(10)
  end
  @h20 -= 2 if @temp == 'H'
  @h20 -= 6 if @temp == 'R'
  @h20 = @h20.whole
  
  # Adjust Atmosphere and Hydrographics when not Normal. MgT p. 180.
  if (%{opera firm}.include?(config['genre'].downcase))
    @atmo = case
      when (@size < 3 or (@size < 4 and @atmo < 3)) then 0
      when ([3,4].include?(@size) and (3..5).include?(@atmo)) then 1
      when ([3,4].include?(@size) and @atmo > 5) then 10
      else @atmo
    end
    @h20 -= 6 if (((3..4).include?(@size) and @atmo == 'A' ) or @atmo < 2)
    @h20 -= 4 if ([2,3,11,12].include?(@atmo))
  end
end