Class: Astromapper::Builder::World
- Inherits:
-
Terrestrial
- Object
- Base
- Orbit
- Planet
- Terrestrial
- Astromapper::Builder::World
- Defined in:
- lib/astromapper/builder/orbit.rb
Overview
Big Dea
Instance Attribute Summary collapse
-
#factions ⇒ Object
Returns the value of attribute factions.
-
#gas_giant ⇒ Object
Returns the value of attribute gas_giant.
-
#temp ⇒ Object
Returns the value of attribute temp.
Attributes inherited from Orbit
#au, #id, #kid, #orbit_number, #xsize
Attributes inherited from Base
Instance Method Summary collapse
- #bases ⇒ Object
- #empty? ⇒ Boolean
- #environmental_tek_limits ⇒ Object
- #gravity ⇒ Object
-
#initialize(star, orbit_number) ⇒ World
constructor
A new instance of World.
- #port ⇒ Object
- #trade_codes ⇒ Object
- #travel_code ⇒ Object
Methods inherited from Planet
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) ⇒ World
Returns a new instance of World.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/astromapper/builder/orbit.rb', line 217 def initialize(star,orbit_number) super @port_roll = toss(2,0) @kid = 'W' @popx = toss() if ('firm' == config['genre'].downcase) @popx -= 1 if (@size < 3 or @size > 9) @popx += [-1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1][@atmo] @port_roll = (@port_roll - 7 + @popx.whole).whole end @popx = @popx.whole # Government & Law. MgT p. 173 @govm = (toss(2,7) + @popx).whole @law = (toss(2,7) + @govm).whole # Identify Factions. MgT p. 173 fax_r = 1.d3.max(3) fax_r += 1 if [0,7].include?(@law) fax_r -= 1 if @law > 9 rolls = [toss(2,0),toss(2,0),toss(2,0),toss(2,0),toss(2,0)] @factions = (@popx == 0) ? [] : fax_r.times.map { |r| %w{O O O O F F M M N N S S P}[rolls.shift] } # Set Technology die modifier based on World attributes. MgT p. 170 tek_dm = { 'A' => 6, 'B' => 4, 'C' => 2, 'D' => 0, 'E' => 0, 'X' => -4}[port] tek_dm += [2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0][@size] tek_dm += [1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1][@atmo] tek_dm += [1,0,0,0,0,0,0,0,0,1,2][@h20] tek_dm += [0,1,1,1,1,1,0,0,0,1,2,3,4][@popx] tek_dm += [1,0,0,0,0,1,0,2,0,0,0,0,0,-2,-2,0][@govm] tek_limit = environmental_tek_limits[@atmo] @tek = (toss(1,0) + tek_dm).min( tek_limit ) # MgT p. 179 Environmental Limits # For those who want to limit technology @tek = @tek.max(config['tech_cap']) unless config['tech_cap'].nil? @tek = @tek.min(tek_limit) @tek = @tek.min(@popx) @law = @govm = @tek = 0 if @popx == 0 # Fix temperature (Me) @temp = 'F' if (trade_codes.include?('IC') or trade_codes.include?('Va')) @temp = 'T' if ((trade_codes.include?('Ag') or trade_codes.include?('Ga') or trade_codes.include?('Ri') or trade_codes.include?('Wa')) and @temp != 'T') base = { "Navy" => { 'A' => 8, 'B' => 8, 'C' => 20, 'D' => 20, 'E' => 20, 'X' => 20 }[port], "Scout" => { 'A' => 10, 'B' => 8, 'C' => 8, 'D' => 7, 'E' => 20, 'X' => 20 }[port], "Consolate" => { 'A' => 6, 'B' => 8, 'C' => 10, 'D' => 20, 'E' => 20, 'X' => 20 }[port], "Pirate" => { 'A' => 20, 'B' => 12, 'C' => 10, 'D' => 12, 'E' => 20, 'X' => 20 }[port] } @base = {} base.keys.each {|key| @base[key] = (2.d6 > base[key] - 1) ? key[0] : '.'} end |
Instance Attribute Details
#factions ⇒ Object
Returns the value of attribute factions.
216 217 218 |
# File 'lib/astromapper/builder/orbit.rb', line 216 def factions @factions end |
#gas_giant ⇒ Object
Returns the value of attribute gas_giant.
216 217 218 |
# File 'lib/astromapper/builder/orbit.rb', line 216 def gas_giant @gas_giant end |
#temp ⇒ Object
Returns the value of attribute temp.
216 217 218 |
# File 'lib/astromapper/builder/orbit.rb', line 216 def temp @temp end |
Instance Method Details
#bases ⇒ Object
279 280 281 |
# File 'lib/astromapper/builder/orbit.rb', line 279 def bases return [@base['Navy'],@base['Scout'],@gas_giant,@base['Consolate'],@base['Pirate']].join('') end |
#empty? ⇒ Boolean
288 289 290 |
# File 'lib/astromapper/builder/orbit.rb', line 288 def empty? (uwp.include?('X000000')) end |
#environmental_tek_limits ⇒ Object
285 286 287 |
# File 'lib/astromapper/builder/orbit.rb', line 285 def environmental_tek_limits [8,8,5,5,3,0,0,3,0,8,9,10,5,8] end |
#gravity ⇒ Object
275 276 277 278 |
# File 'lib/astromapper/builder/orbit.rb', line 275 def gravity @gravity = [0,0.05,0.15,0.25,0.35,0.45,0.7,0.9,1.0,1.25,1.4][@size] if @gravity.nil? @gravity end |
#port ⇒ Object
282 283 284 |
# File 'lib/astromapper/builder/orbit.rb', line 282 def port %w{X X X E E D D C C B B A A A A A A A A A}[@port_roll.whole] end |
#trade_codes ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/astromapper/builder/orbit.rb', line 291 def trade_codes code = [] code << 'Ag' if ((4..9) === @atmo and (4..8) === @h20 and (5..7) === @popx) code << 'As' if (@size == 0 and @atmo == 0 and @h20 ==0) code << 'Ba' if (@popx == 0 and @govm == 0 and @law == 0) code << 'De' if (@atmo > 1 and @h20 == 0) code << 'Fl' if (@atmo > 9 and @h20 > 0) code << 'Ga' if (@size > 4 and (4..9) === @atmo and (4..8) === @hydro) code << 'Hi' if (@popx > 8) code << 'Ht' if (@tek > 12) code << 'IC' if (@atmo < 2 and @h20 > 0) code << 'In' if ([0,1,2,4,7,9].include?(@atmo) and @popx > 8) code << 'Lo' if ((1..3) === @popx) code << 'Lt' if (@tek < 6) code << 'Na' if ((0..3) === @atmo and (0..3) === @h20 and @popx > 5) code << 'NI' if ((4..6) === @popx) code << 'Po' if ((2..5) === @atmo and (0..3) === @h20) code << 'Ri' if ([6,8].include?(@atmo) and (6..8) === @popx) code << 'Va' if (@atmo == 0) code << 'Wa' if (@hydro == 10) code end |
#travel_code ⇒ Object
272 273 274 |
# File 'lib/astromapper/builder/orbit.rb', line 272 def travel_code @code = (@atmo > 9 or [0,7,10].include?(@govm) or [0,9,10,11,12,13].include?(@law)) ? 'AZ' : '..' end |