class Astromapper::Builder::Moon

Attributes

h20[RW]
orbit[RW]
size[RW]

Public Class Methods

new(planet,i=0) click to toggle source
# File lib/astromapper/builder/orbit.rb, line 321
def initialize(planet,i=0)
  @planet = planet
  @popx = 0
  @law  = 0
  @tek  = 0
  @govm = 0
  @size = case
    when @planet.xsize = 'L' then toss(2,4)
    when @planet.xsize = 'S' then toss(2,6)
    else @planet.size - toss(1,0)
  end
  orbit = toss(2,i)
  @orbit = (case
    when (@size < 1) then @@orbits['R'][toss(1,1)]
    when (orbit == 12 and @planet.xsize == 'L') then @@orbits['E'][toss(2,0)]
    when (orbit < 8) then @@orbits['C'][toss(2,0)]
    when (orbit > 7) then @@orbits['C'][toss(2,0)]
    else 0
  end).whole
  @h20 = (case
    when (@planet.inner?) then 0
    when (@size == 0)    then 0
    when (@planet.outer?) then toss(2,4)
    when (@planet.biozone?) then toss(2,7)
    else 0
  end).whole
  @atmo = toss(2,7) + @size
  @atmo = (case
    when (@size == 0) then 0
    when (@planet.inner?) then @atmo - 4
    when (@planet.outer?) then @atmo - 4 
    else 0
  end).whole
end

Public Instance Methods

to_ascii() click to toggle source
# File lib/astromapper/builder/orbit.rb, line 355
def to_ascii
  "\n%28s/  %3d rad. %s" % ['', @orbit, uwp]
end
uwp() click to toggle source
# File lib/astromapper/builder/orbit.rb, line 358
def uwp
  size = case
    when @size < 0 then 'S'
    when @size == 0 then 'R'
    else @size.hexd
  end
  # size = (@size == 0) ? 'R' : @size.hexd
  "%s%s%s%s%s%s%s" % ['X', size,@atmo.hexd,@h20.hexd,@popx.hexd,@govm.hexd,@law.hexd]
end