forked from engooyen/majel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alienGenerator.js
183 lines (169 loc) · 6.6 KB
/
alienGenerator.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
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
/**
* Copyright 2019 John H. Nguyen
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
// origin
const carbonBased = "Carbon-based"
const exoticBased = "Exotic-based"
const nonCorporeal = "Non-corporeal"
var origin = [carbonBased, exoticBased, nonCorporeal]
// carbon-based
const anthropoid = "Anthropoid"
const fungal = "Fungal"
const plant = "Plant"
var carbonBasedClasses = [
anthropoid,
anthropoid,
anthropoid,
fungal,
plant,
plant
]
// exotic-based
const anaphasic = "Anaphasic"
const electromagnetic = "Electromagnetic"
const gaseous = "Gaseous"
const magnetic = "Magnetic"
const nucleogenic = "Nucleogenic"
const neurogenic = "Neurogenic"
var exoticBasedClasses = [
anaphasic,
electromagnetic,
gaseous,
magnetic,
nucleogenic,
neurogenic
]
// non-corporeal
const artificial = "Artificial"
const biomimetic = "Biomimetic"
const darkMatter = "Dark matter"
const silicon = "Silicon-based"
const xenon = "Xenon-based"
var nonCorporealClassed = [
artificial,
biomimetic,
darkMatter,
silicon,
silicon,
xenon
]
var environment = [
"Class-D world",
"Class-H world",
"Class-J world",
"Class-K world",
"Class-K world",
"Class-L world",
"Class-L world",
"Class-L world",
"Class-L world",
"Class-M world",
"Class-M world",
"Class-M world",
"Class-M world",
"Class-M world",
"Class-M world",
"Class-T world",
"Class-Y world",
"Anomalous world",
"Deep Space"
]
var culture = [
"Discovery",
"Power",
"Expansion",
"Affluence",
"Purity",
"Supremacy"
]
var traits = {
"Extraordinary Attribute X":
"An automatic success is added to Tasks using the Attribute defined by X. The number of automatic successes can exceed 1; for example, a creature with Extraordinary Reason 2 gains two successes on all Tasks using Reason, in addition to any generated by rolling.",
"Fast Recovery X":
"The creature recovers from stress and injury quickly. At the start of each of its turns, the creature regains X Stress, up to its normal maximum. If the creature is Injured at the start of its turn, it may instead spend two Threat in order to remove that Injury.",
"Immune to X":
"The creature is unaffected by conditions caused by a Trait present in the scene, such as: cold, disease, fear, heat, pain, poison, vacuum, etc.",
Invulnerable:
"The creature is impervious to harm, and cannot be Injured in any way; attacks can be attempted and damage is rolled as normal, but it cannot suffer Injuries. This may take different forms; see the core rulebook p. 313.",
"Keen Sense X":
"Choose one of the following: sight, hearing, or scent. The creature reduces the Difficulty of all Tasks which use that sense to detect or observe.",
"Machine X":
"The creature is not a living being, but a machine, or some form of cybernetic organism. It is highly resistant to environmental conditions, reducing the Difficulty of Tasks to resist extremes of heat and cost by two, and it is immune to the effects of suffocation, starvation, and thirst. Further, the machine’s sturdy construction grants it Resistance equal to X.",
Menacing:
"The creature is dangerous, heralding a greater problem for those who confront it. When a creature with this rule enters a scene, immediately add a point to the Threat pool.",
"Night Vision":
"The creature has some way of perceiving its environment even in pitch darkness — perceiving infrared or ultraviolet light, echolocation, or some other method. Tasks the creature attempts do not increase in Difficulty as a result of darkness.",
Threatening:
"The creature is powerful and dangerous, with a vitality and drive that allows it to triumph where others might fail. The creature begins each scene with X Threat, that may only be used to benefit itself, and which are not drawn from the general Threat pool.",
"Immune to Physical Damage":
"The creature does not exist in the material Galaxy, and therefore is immune to physical effects.",
"Gravity Sense":
"The creature perceives the Galaxy and manipulates matter through altering gravity and detecting the mass of objects. It cannot detect waves or radiation."
}
function roll() {
return Math.floor(Math.random() * 20) + 1
}
module.exports = {
origin: function() {
let rollMain = roll()
let origin = {}
if (rollMain <= 17) {
origin["Origin"] = carbonBased
origin["Sub-origin"] =
carbonBasedClasses[
Math.floor(Math.random() * carbonBasedClasses.length)
]
} else if (rollMain <= 19) {
origin["Origin"] = exoticBased
origin["Sub-origin"] =
exoticBasedClasses[
Math.floor(Math.random() * exoticBasedClasses.length)
]
} else {
origin["Origin"] = nonCorporeal
origin["Sub-origin"] =
nonCorporealClassed[
Math.floor(Math.random() * nonCorporealClassed.length)
]
}
return origin
},
environment: function() {
return environment[Math.floor(Math.random() * environment.length)]
},
culture: function() {
return culture[Math.floor(Math.random() * culture.length)]
},
trait: function() {
let keys = Object.keys(traits)
let key = keys[Math.floor(Math.random() * keys.length)]
return { name: key, description: traits[key] }
},
alien: function() {
let origin = this.origin()
return {
Origin: origin.Origin,
"Sub-origin": origin["Sub-origin"],
Environment: this.environment(),
Culture: this.culture(),
Traits: this.trait()
}
}
}