-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.js
143 lines (120 loc) · 3.88 KB
/
generator.js
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
var planetRoll = function() {
return roll() + roll();
}
var planet = function(size) {
var planet = {};
planet.name = "Planet"
// Size
planet.size = size;
// Orbit
planet.orbit = orbit();
if (planet.orbit === "") {
planet.orbit = "Empty Space";
}
// Atmosphere
planet.atmosphere = atmosphere(planet);
// Temerarure
planet.temperature = temperature(planet);
// Geosphere
planet.geosphere = geosphere(planet);
// Population
planet.population = population(planet);
// Space port
planet.spaceport = spaceport(planet);
// Hooks
planet.hooks = hooks();
// Factions
planet.factions = factions();
return planet;
};
var printPlanet = function(p) {
debug(String.format(headerTemplate, p.name));
debug(String.format(cellTemplate, "Size", planetSize(p.size)));
debug(String.format(cellTemplate, "Gravity", planetGravity(p.size)));
debug(String.format(cellTemplate, "Orbit", p.orbit));
debug(String.format(cellTemplate, "Atmosphere",
atmosphereString(p.atmosphere)));
debug(String.format(cellTemplate, "Temperature",
temperatureString(p.temperature)));
debug(String
.format(cellTemplate, "Geosphere", geosphereString(p.geosphere)));
debug(String.format(cellTemplate, "Population",
populationString(p.population)));
debug(String.format(cellTemplate, "Space Port",
spaceportString(p.spaceport)));
debug(String.format(cellTemplate, "Hooks", p.hooks));
debug(String.format(cellTemplate, "Factions", p.factions));
}
var gasGiant = function() {
var gg = {};
gg.name = "Gas Giant";
gg.size = gasGiantSize();
gg.color = gasGiantColor();
gg.temperature = gasGiantTemperature();
gg.characteristics = gasGiantCharacteristics();
gg.population = roll();
gg.spaceport = spaceport(gg);
gg.hooks = hooks();
gg.factions = factions();
gg.moons = [];
var numMoons = roll() + roll() + roll();
var c = 0;
for (c = 0; c < numMoons; c++) {
var moon = planet(roll());
moon.name = "Moon " + (c + 1);
gg.moons.push(moon);
}
;
return gg;
};
var printGasGiant = function(p) {
debug(String.format(headerTemplate, p.name));
debug(String.format(cellTemplate, "Size", gasGiantSize(p.size)));
debug(String.format(cellTemplate, "Color", p.color));
debug(String.format(cellTemplate, "Temperature",
gasGiantTemperatureString(p.temperature)));
debug(String.format(cellTemplate, "Characteristics", p.characteristics));
debug(String.format(cellTemplate, "Population",
populationString(p.population)));
debug(String.format(cellTemplate, "Space Port",
spaceportString(p.spaceport)));
debug(String.format(cellTemplate, "Hooks", p.hooks));
debug(String.format(cellTemplate, "Factions", p.factions));
debug(sepTemplate);
$.each(p.moons, function(i, m) {
debug(sepTemplate);
printPlanet(m);
debug(sepTemplate);
});
debug("----------");
};
var asteroidBelt = function() {
var ab = {};
ab.name = "Asteroid Belt";
ab.size = asteroidBeltSize();
ab.characteristics = asteroidBeltCharacteristics();
ab.color = gasGiantColor();
ab.composition = asteroidBeltComposition();
var pop = roll();
if (pop > 3) {
pop = pop - 3;
}
ab.population = pop;
ab.spaceport = spaceport(ab);
ab.hooks = hooks();
ab.factions = factions();
return ab;
};
var printAsteroidBelt = function(p) {
debug(String.format(headerTemplate, p.name));
debug(String.format(cellTemplate, "Size", p.size));
debug(String.format(cellTemplate, "Color", p.color));
debug(String.format(cellTemplate, "Comopsition", p.composition));
debug(String.format(cellTemplate, "Characteristics", p.characteristics));
debug(String.format(cellTemplate, "Population",
populationString(p.population)));
debug(String.format(cellTemplate, "Space Port",
spaceportString(p.spaceport)));
debug(String.format(cellTemplate, "Hooks", p.hooks));
debug(String.format(cellTemplate, "Factions", p.factions));
};