/
terrestrial.py
847 lines (792 loc) · 29.7 KB
/
terrestrial.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
import dice
import world
import orbit
import math
def GetWorldSubtype(mainType, blackBodyTemperature):
if mainType == "Tiny":
if blackBodyTemperature <= 140:
return "Ice" #May turn out to be Sulfur later
return "Rock"
if mainType == "Small":
if blackBodyTemperature <= 80:
return "Hadean"
if blackBodyTemperature <= 140:
return "Ice"
return "Rock"
if mainType == "Standard" or mainType == "Large":
if blackBodyTemperature <= 80:
return "Hadean"
if blackBodyTemperature <= 150:
return "Ice"
if blackBodyTemperature <= 230:
return "Ammonia" #May turn out to be Ice later
if blackBodyTemperature <= 240:
return "Ice"
if blackBodyTemperature <= 320:
return "Ocean" #May turn out to be Garden later
if blackBodyTemperature <= 500:
return "Greenhouse"
return "Chthonian"
return "N/a"
def GenerateAtmosphericMass(mainType, subType):
if mainType == "Small" and subType == "Ice":
disqualified = False
elif mainType == "Standard":
if subType == "Hadean" or subType == "Chthonian":
disqualified = True
else:
disqualified = False
elif mainType == "Large":
if subType == "Chthonian":
disqualified = True
else:
disqualified = False
else:
disqualified = True
if disqualified:
return 0.0
if mainType == "Standard" and subType == "Garden":
r = dice.roll(3, 12) - 9
else:
r = dice.roll(3, 6)
mass = float(r) / 10
r = dice.roll(1, 20) - 10
var = float(r) / 200
return mass + var
def GenerateHydrosphere(mainType, subType):
hydro = 0
if mainType == "Small" and subType == "Ice":
hydro = (dice.roll(1, 6) + 2) * 10
if mainType == "Standard" or mainType == "Large":
if subType == "Ammonia":
hydro = (dice.roll(2, 6)) * 10
if subType == "Ice":
hydro = (dice.roll(2, 6) - 10) * 10
if subType == "Ocean" or subType == "Garden":
if mainType == "Standard":
var = 4
else:
var = 6
hydro = (dice.roll(1, 6) + var) * 10
if subType == "Greenhouse":
hydro = (dice.roll(2, 6) - 7) * 10
if hydro > 0:
r = dice.roll(1, 10) - 5
hydro = hydro + r
return min(hydro, 100)
return 0
def GetBlackBodyCorrection(mainType, subType, hydrosphere, atmosphericMass):
if mainType == "Belt" or mainType == "Moonlet":
AF = 0.97
GF = 0.0
elif mainType == "Tiny":
if subType == "Ice":
AF = 0.86
GF = 0.0
elif subType == "Sulfur":
AF = 0.77
GF = 0.0
else: #Rock
AF = 0.97
GF = 0.00
elif mainType == "Small":
if subType == "Hadean":
AF = 0.67
GF = 0.0
elif subType == "Ice":
AF = 0.93
GF = 0.10
else: #Rock
AF = 0.96
GF = 0.0
elif mainType == "Standard" or mainType == "Large":
if subType == "Ammonia":
AF = 0.84
GF = 0.20
elif subType == "Ice":
AF = 0.86
GF = 0.20
elif subType == "Ocean" or subType == "Garden":
GF = 0.16
if hydrosphere >= 20:
AF = 0.95
elif hydrosphere >= 50:
AF = 0.92
elif hydrosphere >= 90:
AF = 0.88
else:
AF = 0.84
elif subType == "Greenhouse":
AF = 0.77
GF = 2.0
else: #Chthonian
AF = 0.97
GF = 0.0
else:
return 1.0
return AF * (1 + (atmosphericMass * GF))
def GetInitialLargeIronCoreDensity(r):
if r <= 6:
return 0.8
if r <= 10:
return 0.9
if r <= 14:
return 1.0
if r <= 17:
return 1.1
return 1.2
def GetInitialSmallIronCoreDensity(r):
if r <= 6:
return 0.6
if r <= 10:
return 0.7
if r <= 14:
return 0.8
if r <= 17:
return 0.9
return 1.0
def GetInitialIcyCoreDensity(r):
if r <= 6:
return 0.3
if r <= 10:
return 0.4
if r <= 14:
return 0.5
if r <= 17:
return 0.6
return 0.7
def GenerateDensity(mainType, subType):
core = "Large"
if mainType == "Tiny":
if subType == "Ice" or subType == "Sulfur":
core = "Icy"
else:
core = "Small"
elif mainType == "Small":
if subType == "Ice" or subType == "Hadean":
core = "Icy"
else:
core = "Small"
elif mainType == "Standard":
if subType == "Hadean" or subType == "Ammonia":
core = "Icy"
elif mainType == "Large":
if subType == "Ammonia":
core == "Icy"
r = dice.roll(3, 6)
if core == "Large":
initial = GetInitialLargeIronCoreDensity(r)
elif core == "Small":
initial = GetInitialSmallIronCoreDensity(r)
else:
initial = GetInitialIcyCoreDensity(r)
r = dice.roll(1, 20) - 10
var = float(r) / 200
return initial + var
def GenerateDiameter(mainType, blackBodyTemperature, density):
if mainType == "Large":
minimum = 0.065
maximum = 0.091
elif mainType == "Standard":
minimum = 0.030
maximum = 0.065
elif mainType == "Small":
minimum = 0.024
maximum = 0.030
else:
minimum = 0.004
maximum = 0.024
var = math.sqrt(blackBodyTemperature / density)
myMin = minimum * var
myMax = maximum * var
step = (myMax - myMin) / 10
r = dice.roll(2, 6) - 2
step = step * float(r)
r = dice.roll(1, 20) - 10
var = float(r) / 200
step = step * (1.0 + var)
return myMin + step
def GetAtmosphericPressure(mainType, subType, atmosphericMass, gravity):
""" No Atmosphere """
if mainType == "Tiny":
return 0.0
if mainType == "Small" and subType == "Hadean":
return 0.0
""" Trace Atmosphere """
""" Gurps gives no means to work this out. """
""" Just says it's less than 0.01 """
if mainType == "Small" and subType == "Rock":
r = dice.roll(1, 100) - 1
return float(r) / 10000
if mainType == "Standard" and subType == "Chthonian":
r = dice.roll(1, 100) - 1
return float(r) / 10000
if mainType == "Large" and subType == "Chthonian":
r = dice.roll(1, 100) - 1
return float(r) / 10000
if mainType == "Small" and subType == "Ice":
PF = 10
if mainType == "Standard":
if subType == "Greenhouse":
PF = 100
else:
PF = 1
if mainType == "Large":
if subType == "Greenhouse":
PF = 500
else:
PF = 5
return PF * atmosphericMass * gravity
def GetAtmosphericCategory(pressure):
if pressure == 0.0:
return "Vacuum"
if pressure <= 0.01:
return "Trace"
if pressure <= 0.5:
return "Very Thin"
if pressure <= 0.8:
return "Thin"
if pressure <= 1.2:
return "Standard"
if pressure <= 1.5:
return "Dense"
if pressure <= 10.0:
return "Very Dense"
return "Superdense"
""" TODO make a terrestrial body class, and make planets and moons subclasses of this """
class Planet(world.World):
def __init__(self, mainType, parentStar, parentWorld = None):
world.World.__init__(self, mainType, parentStar)
self.parentWorld = parentWorld
def ShowUWP(self):
ret = "X"
ret = ret + self.GetUWPSize()
ret = ret + self.GetUWPAtmosphere()
ret = ret + self.GetUWPHydrosphere()
ret = ret + "000-0"
return ret
def GetUWPSize(self):
km = self.diameter * 12742
if km <= 800:
return "S"
if km <= 2399:
return "1"
if km <= 3999:
return "2"
if km <= 5599:
return "3"
if km <= 7199:
return "4"
if km <= 8799:
return "5"
if km <= 10399:
return "6"
if km <= 11999:
return "7"
if km <= 13599:
return "8"
if km <= 15199:
return "9"
if km <= 16799:
return "A"
return "B"
def GetUWPHydrosphere(self):
if self.hydrosphere <= 4:
return "0"
if self.hydrosphere <= 14:
return "1"
if self.hydrosphere <= 24:
return "2"
if self.hydrosphere <= 34:
return "3"
if self.hydrosphere <= 44:
return "4"
if self.hydrosphere <= 54:
return "5"
if self.hydrosphere <= 64:
return "6"
if self.hydrosphere <= 74:
return "7"
if self.hydrosphere <= 84:
return "8"
if self.hydrosphere <= 94:
return "9"
return "A"
def GetUWPAtmosphere(self):
if self.atmosphericPressure <= 0.001:
return "0"
if self.atmosphericPressure <= 0.1:
return "1"
if "Suffocating" in self.atmosphericComposition:
if "Corrosive" in self.atmosphericComposition:
if self.atmosphericPressure <= 10:
return "B"
else:
return "C"
else:
return "A"
if self.atmosphericPressure <= 0.42:
if "Marginal" in self.atmosphericComposition:
return "2"
else:
return "3"
if self.atmosphericPressure <= 0.7:
if "Marginal" in self.atmosphericComposition:
return "4"
else:
return "5"
if self.atmosphericPressure <= 1.49:
if "Marginal" in self.atmosphericComposition:
return "7"
else:
return "6"
if self.atmosphericPressure <= 2.49:
if "Marginal" in self.atmosphericComposition:
return "9"
else:
return "8"
if self.atmosphericPressure <= 10:
return "A"
return "B"
def ShowBasic(self):
return self.GetSymbol() + " " + self.mainType + " " + self.subType
def ShowDetails(self):
ret = "%-10s %-10d %-10s %-10d%- 10.3f %- 10.3f %- 10.3f %- 10.3f %- 10.3f %-10s %-10s %- 10d %-10s %-10s %-3d %-3d %-3d " % \
(self.atmosphericCategory, self.hydrosphere, self.climate, self.averageTemperature, \
self.diameter, self.mass, self.density, self.gravity, self.atmosphericPressure, \
world.PrettyPeriod(self.orbitalPeriod), world.PrettyPeriod(self.rotationalPeriod), self.axialTilt, \
self.vulcanism, self.tectonics, self.habitability, self.resourceValue, self.affinity)
ret = ret + self.ShowAtmosphericComposition()
return ret
def ShowAtmosphericComposition(self):
ret = ""
for component in self.atmosphericComposition:
ret = ret + component + " "
return ret
def GenerateBasic(self):
if self.parentWorld:
solarRadius = self.parentWorld.GetOrbit().GetRadius()
else:
solarRadius = self.GetOrbit().GetRadius()
blackBodyTemperature = 278 * ( pow(self.parentStar.GetLuminosity(), 0.25) / pow(solarRadius, 0.5) )
self.subType = GetWorldSubtype(self.mainType, blackBodyTemperature)
""" Corrections """
""" Fix Ammonia worlds now """
if self.subType == "Ammonia" and self.parentStar.GetMass() > 0.65:
self.subType = "Ice"
""" Find Sulfur World now """
if self.mainType == "Tiny" and self.subType == "Ice" and self.parentWorld and self.parentWorld.GetType() == "Gas Giant" and self.parentWorld.GetNumSulfurWorlds() == 0:
r = dice.roll(1, 6)
if r <= 3:
self.subType = "Sulfur"
self.parentWorld.IncNumSulfurWorlds()
""" Find Garden World Now """
""" TODO: Use First In method """
if not self.parentStar.GetType() == "L" and not self.parentStar.GetType() == "T" and not self.parentStar.GetType() == "Y":
if self.mainType == "Standard" and self.subType == "Ocean":
r = dice.roll(3, 6)
mod = int(self.parentStar.GetAge() / 0.5)
mod = max(mod, 10)
r = r + mod
if r > 18:
self.subType = "Garden"
if self.mainType == "Large" and self.subType == "Ocean":
r = dice.roll(3, 6)
mod = int(self.parentStar.GetAge() / 0.5)
mod = max(mod, 5)
r = r + mod
if r > 18:
self.subType = "Garden"
self.density = GenerateDensity(self.mainType, self.subType)
if blackBodyTemperature < 3.0:
""" Damn White Dwarves """
""" TODO: Maybe use the III temperature instead """
originalBlackBodyTemperature = 278 * ( pow(self.parentStar.GetInitialLuminosity(), 0.25) / pow(solarRadius, 0.5) )
self.diameter = GenerateDiameter(self.mainType, originalBlackBodyTemperature, self.density)
else:
self.diameter = GenerateDiameter(self.mainType, blackBodyTemperature, self.density)
self.gravity = world.GetGravity(self.density, self.diameter)
self.mass = world.GetMass(self.density, self.diameter)
atmosphericMass = GenerateAtmosphericMass(self.mainType, self.subType)
self.hydrosphere = GenerateHydrosphere(self.mainType, self.subType)
blackBodyCorrection = GetBlackBodyCorrection(self.mainType, self.subType, self.hydrosphere, atmosphericMass)
self.averageTemperature = blackBodyTemperature * blackBodyCorrection
self.climate = world.GetClimate(self.averageTemperature)
self.atmosphericPressure = GetAtmosphericPressure(self.mainType, self.subType, atmosphericMass, self.gravity)
self.atmosphericCategory = GetAtmosphericCategory(self.atmosphericPressure)
def GenerateDynamics(self):
""" Orbital period in days """
parentLock = False
lunarLock = False
possibleLunarLock = False
possibleSolarLock = False
potentialRotationalPeriod = 0
self.orbitalPeriod = self.orbit.GetPeriod()
if self.parentWorld:
tide = (2230000 * self.parentWorld.GetMass() * self.diameter) / pow(self.orbit.GetRadius(), 3)
if tide > 50:
parentLock = True
else:
tide = (0.47 * self.parentStar.GetMass() * self.diameter) / pow(self.orbit.GetRadius(), 3)
for o in self.orbiters:
m = o.GetOrbiter()
if not m.GetType() == "Moonlet":
if not possibleLunarLock:
possibleLunarLock = True
potentialRotationalPeriod = math.sqrt(pow(o.GetRadius(), 3) / self.GetMass()) * 0.166
tide = tide + (2230000 * m.GetMass() * self.diameter) / pow(o.GetRadius(), 3)
tidalEffect = (tide * self.parentStar.GetAge()) / self.mass
if tidalEffect > 50:
if possibleLunarLock:
lunarLock = True
self.rotationalPeriod = potentialRotationalPeriod
else:
parentLock = True
self.rotationalPeriod = self.orbitalPeriod
if not self.parentWorld:
possibleSolarLock = True
else:
self.rotationalPeriod = world.GenerateRotationalPeriod(self.mainType, None, tidalEffect)
if possibleLunarLock and self.rotationalPeriod > potentialRotationalPeriod:
lunarLock = True
self.rotationalPeriod = self.orbitalPeriod
elif self.rotationalPeriod > self.orbitalPeriod:
parentLock = True
self.rotationalPeriod = self.orbitalPeriod
if not self.parentWorld:
possibleSolarLock = True
self.axialTilt = world.GenerateAxialTilt()
if possibleSolarLock:
if self.orbit.GetEccentricity() >= 0.1:
r = dice.roll(3, 6)
if r >= 12:
possibleSolarLock = False
self.rotationalPeriod = self.orbitalPeriod * (3.0/2.0)
if possibleSolarLock:
self.SolarLockCorrection()
def SolarLockCorrection(self):
DF = 1.0
NF = 1.0
p = self.atmosphericPressure
if self.atmosphericCategory == "Vacuum" or self.atmosphericCategory == "Trace":
self.atmosphericCategory = "Vacuum"
self.hydrosphere = 0
DF = 1.2
NF = 0.1
self.atmosphericPressure = 0.0
elif self.atmosphericCategory == "Very Thin":
self.atmosphericCategory = "Trace"
self.hydrosphere = 0
DF = 1.2
NF = 0.1
p = p - 0.01
p = p / 49
self.atmosphericPressure = p
if self.subType == "Ocean" or self.subType == "Garden":
self.subType = "Chthonian"
elif self.atmosphericCategory == "Thin":
self.atmosphericCategory = "Very Thin"
self.hydrosphere = max(self.hydrosphere - 50, 0)
DF = 1.16
NF = 0.67
p = p - 0.5
p = p * (49/30)
p = p + 0.01
self.atmosphericPressure = p
elif self.atmosphericCategory == "Standard":
self.atmosphericCategory = "Thin"
self.hydrosphere = max(self.hydrosphere - 25, 0)
DF = 1.12
NF = 0.8
p = p - 0.8
p = p * 0.75
p = p + 0.5
self.atmosphericPressure = p
elif self.atmosphericCategory == "Dense":
self.hydrosphere = max(self.hydrosphere - 10, 0)
DF = 1.09
NF = 0.88
elif self.atmosphericCategory == "Very Dense":
DF = 1.05
NF = 0.95
self.avTempDayFace = self.averageTemperature * DF
self.avTempNightFace = self.averageTemperature * NF
self.dayFaceClimate = world.GetClimate(self.avTempDayFace)
self.nightFaceClimate = world.GetClimate(self.avTempNightFace)
def GetNumMajorMoons(self):
majorMoons = 0
for o in self.orbiters:
m = o.GetOrbiter()
if not m.GetType() == "Moonlet":
majorMoons = majorMoons + 1
return majorMoons
def GenerateVulcanism(self):
if self.parentStar.GetAge() == 0:
mod = 40
else:
mod = int((self.gravity / self.parentStar.GetAge()) * 40)
majorMoons = self.GetNumMajorMoons()
if majorMoons == 1:
mod = mod + 5
elif majorMoons > 1:
mod = mod + 10
if self.subType == "Sulfur":
mod = mod + 60
elif self.parentWorld:
if self.parentWorld.GetType == "Gas Giant":
mod = mod + 5
r = dice.roll(3, 6) + mod
if r <= 16:
self.vulcanism = "None"
elif r <= 20:
self.vulcanism = "Light"
elif r <= 26:
self.vulcanism = "Moderate"
elif r <= 70:
self.vulcanism = "Heavy"
else:
self.vulcanism = "Extreme"
""" TODO figure out if atmosphere is marginal """
def GenerateTectonicActivity(self):
if self.mainType == "Tiny" or self.mainType == "Small":
self.tectonics = "None"
return
mod = 0
if self.vulcanism == "None":
mod = mod - 8
elif self.vulcanism == "Light":
mod = mod - 4
elif self.vulcanism == "Heavy":
mod = mod + 4
elif self.vulcanism == "Extreme":
mod = mod + 8
if self.hydrosphere == 0:
mod = mod - 4
elif self.hydrosphere <= 50:
mod = mod - 2
majorMoons = self.GetNumMajorMoons()
if majorMoons == 1:
mod = mod + 2
elif majorMoons > 1:
mod = mod + 4
r = dice.roll(3, 6) + mod
if r <= 6:
self.tectonics = "None"
elif r <= 10:
self.tectonics = "Light"
elif r <= 14:
self.tectonics = "Moderate"
elif r <= 18:
self.tectonics = "Heavy"
else:
self.tectonics = "Extreme"
def GenerateMarginalComponents(self):
self.atmosphericComposition.append("Marginal")
r = dice.roll(3, 6)
if r <= 3:
self.atmosphericComposition.append("Flourine")
self.atmosphericComposition.append("Highly Toxic")
return
if r <= 4:
self.atmosphericComposition.append("Chlorine")
self.atmosphericComposition.append("Highly Toxic")
return
if r <= 6:
self.atmosphericComposition.append("Sulfur Compounds")
self.atmosphericComposition.append("Mildly Toxic")
return
if r <= 7:
self.atmosphericComposition.append("Nitrogen Compounds")
self.atmosphericComposition.append("Mildly Toxic")
return
if r <= 9:
self.atmosphericComposition.append("Organic Toxins")
self.atmosphericComposition.append("Mildly Toxic")
return
if r <= 11:
self.atmosphericComposition.append("Low Oxygen")
return
if r <= 13:
self.atmosphericComposition.append("Pollutants")
self.atmosphericComposition.append("Mildly Toxic")
return
if r <= 14:
self.atmosphericComposition.append("High Carbon Dioxide")
self.atmosphericComposition.append("Mildly Toxic")
return
if r <= 16:
self.atmosphericComposition.append("High Oxygen")
self.atmosphericComposition.append("Mildly Toxic")
return
self.atmosphericComposition.append("Inert Gasses")
return
def GenerateVolcanicPollutants(self):
r = dice.roll(3, 6)
target = 0
if self.vulcanism == "Heavy":
target = 8
if self.vulcanism == "Extreme":
target = 14
if r <= target:
self.atmosphericComposition.append("Marginal")
r = dice.roll(1, 6)
if r <= 3:
self.atmosphericComposition.append("Pollutants")
self.atmosphericComposition.append("Mildly Toxic")
else:
self.atmosphericComposition.append("Sulfur Compounds")
self.atmosphericComposition.append("Mildly Toxic")
def GenerateAtmosphericComposition(self):
self.atmosphericComposition = []
if self.atmosphericCategory == "Vacuum" or self.atmosphericCategory == "Trace":
self.atmosphericComposition.append("None")
return
if self.mainType == "Small" and self.subType == "Ice":
r = dice.roll(3, 6)
if r <= 15:
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Mildly Toxic")
return
else:
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Highly Toxic")
return
if self.mainType == "Standard":
if self.subType == "Ammonia" or self.subType == "Greenhouse":
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Lethally Toxic")
self.atmosphericComposition.append("Corrosive")
return
if self.subType == "Ice" or self.subType == "Ocean":
r = dice.roll(3, 6)
if r <= 12:
self.atmosphericComposition.append("Suffocating")
return
else:
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Mildly Toxic")
return
if self.subType == "Garden":
r = dice.roll(3, 6)
if r <= 11:
self.atmosphericComposition.append("Breatheable")
self.GenerateVolcanicPollutants()
return
else:
self.atmosphericComposition.append("Breatheable")
self.GenerateMarginalComponents()
return
if self.mainType == "Large":
if self.subType == "Ammonia" or self.subType == "Greenhouse":
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Lethallly Toxic")
self.atmosphericComposition.append("Corrosive")
return
if self.subType == "Ice" or self.subType == "Ocean" or self.subType == "Hadean":
self.atmosphericComposition.append("Suffocating")
self.atmosphericComposition.append("Highly Toxic")
return
if self.subType == "Garden":
r = dice.roll(3, 6)
if r <= 11:
self.atmosphericComposition.append("Breatheable")
self.GenerateVolcanicPollutants()
return
else:
self.atmosphericComposition.append("Breatheable")
self.GenerateMarginalComponents()
return
print "Shouldn't get here %s %s %d" % (self.mainType, self.subType, self.averageTemperature)
def GenerateResourceValue(self):
mod = 0
if self.vulcanism == "None":
mod = -2
elif self.vulcanism == "Light":
mod = -1
elif self.vulcanism == "Heavy":
mod = 1
elif self.vulcanism == "Extreme":
mod = 2
r = dice.roll(3, 6) + mod
if r <= 2:
self.overallValue = "Scant"
self.resourceValue = -3
elif r <= 4:
self.overallValue = "Very Poor"
self.resourceValue = -2
elif r <= 7:
self.overallValue = "Poor"
self.resourceValue = -1
elif r <= 13:
self.overallValue = "Average"
self.resourceValue = 0
elif r <= 16:
self.overallValue = "Abundant"
self.resourceValue = 1
elif r <= 18:
self.overallValue = "Very Abundant"
self.resourceValue = 2
else:
self.overallValue = "Rich"
self.resourceValue = 3
def GetHabitabilityAndAffinity(self):
self.habitability = 0
""" Vulcanism and Tectonics """
if self.vulcanism == "Heavy":
self.habitability = self.habitability - 1
elif self.vulcanism == "Extreme":
self.habitability = self.habitability - 2
if self.tectonics == "Heavy":
self.habitability = self.habitability - 1
elif self.tectonics == "Extreme":
self.habitability = self.habitability - 2
""" Atmosphere """
if "Breatheable" in self.atmosphericComposition:
if self.atmosphericCategory == "Very Thin":
self.habitability = self.habitability + 1
elif self.atmosphericCategory == "Thin":
self.habitability = self.habitability + 2
elif self.atmosphericCategory == "Standard" or self.atmosphericCategory == "Dense":
self.habitability = self.habitability + 3
elif self.atmosphericCategory == "Very Dense" or self.atmosphericCategory == "Superdense":
self.habitability = self.habitability + 2
if "Marginal" not in self.atmosphericComposition:
self.habitability = self.habitability + 1
if self.climate == "Cold" or self.climate == "Hot":
self.habitability = self.habitability + 1
elif self.climate == "Chilly" or self.climate == "Cool" or self.climate == "Normal" or self.climate == "Warm" or self.climate == "Tropical":
self.habitability = self.habitability + 2
elif not self.atmosphericCategory == "Vaccum" and not self.atmosphericCategory == "Trace":
if "Corrosive" in self.atmosphericComposition:
self.habitability = self.habitability - 2
elif "Mildly Toxic" in self.atmosphericComposition or "Highly Toxic" in self.atmosphericComposition or "Lethally Toxic" in self.atmosphericComposition:
self.habitability = self.habitability - 1
""" Hydrosphere... IF liquid water """
if self.mainType == "Standard" or self.mainType == "Large":
if self.subType == "Ice" or self.subType == "Ocean" or self.subType == "Garden":
if self.hydrosphere > 1:
if self.hydrosphere <= 59:
self.habitability = self.habitability + 1
elif self.hydrosphere <= 90:
self.habitability = self.habitability + 2
elif self.hydrosphere <= 90:
self.habitability = self.habitability + 1
self.affinity = self.habitability + self.resourceValue
def GenerateDetails(self):
self.GenerateVulcanism()
self.GenerateTectonicActivity()
self.GenerateAtmosphericComposition()
self.GenerateResourceValue()
self.GetHabitabilityAndAffinity()
def GetSymbol(self):
return "o"
def GetAffinity(self):
return self.affinity
def GetResource(self):
return self.resourceValue
def GetIsAMoon(self):
if self.parentWorld:
return True
return False
def GetAtmosphericComposition(self):
return self.atmosphericComposition