Class: Astromapper::Builder::Moon
- Defined in:
- lib/astromapper/builder/orbit.rb
Overview
End World (Mainworld)
Constant Summary collapse
- @@orbits =
{ 'C' => (1..14).to_a, 'R' => [1,1,1,2,2,3] }
Instance Attribute Summary collapse
-
#h20 ⇒ Object
Returns the value of attribute h20.
-
#orbit ⇒ Object
Returns the value of attribute orbit.
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(planet, i = 0) ⇒ Moon
constructor
A new instance of Moon.
- #to_ascii ⇒ Object
- #uwp ⇒ Object
Methods inherited from Base
#config, constitute, #names, #spawn_command, #toss
Constructor Details
#initialize(planet, i = 0) ⇒ Moon
Returns a new instance of Moon.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# 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 |
Instance Attribute Details
#h20 ⇒ Object
Returns the value of attribute h20.
316 317 318 |
# File 'lib/astromapper/builder/orbit.rb', line 316 def h20 @h20 end |
#orbit ⇒ Object
Returns the value of attribute orbit.
316 317 318 |
# File 'lib/astromapper/builder/orbit.rb', line 316 def orbit @orbit end |
#size ⇒ Object
Returns the value of attribute size.
316 317 318 |
# File 'lib/astromapper/builder/orbit.rb', line 316 def size @size end |
Instance Method Details
#to_ascii ⇒ Object
355 356 357 |
# File 'lib/astromapper/builder/orbit.rb', line 355 def to_ascii "\n%28s/ %3d rad. %s" % ['', @orbit, uwp] end |
#uwp ⇒ Object
358 359 360 361 362 363 364 365 366 |
# 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 |