-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
51 lines (37 loc) · 1.29 KB
/
main.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
var _ = require('lodash');
var Chance = require('chance');
var chance = new Chance();
var createDestination = require('./destination');
var createTravelRoute = require('./travel-route');
var createHomePassage = require('./home');
var presets = require('./preset');
var createStartPreset = presets.start;
var createEndPreset = presets.end;
var createLostPreset = presets.lost;
var dests = ["ruins", "city", "hills", "valley", "temple"];
function create() {
var str = "";
var startingDist = _.sample([2, 3, 4]);
var gender = chance.gender().toLowerCase();
var first = chance.first({
gender: gender
});
str += createStartPreset("route-0-" + startingDist + "-0");
for (var i = 0; i < 5; i++) {
// add route passages
str += createTravelRoute("route-" + i, startingDist, i, dests[i],
"destination-" + i,
"lost-" + i);
// add destination passages
str += createDestination(dests, i, "home");
// add lost passages
str += createLostPreset(dests[i], i);
startingDist = _.sample([2, 3, 4]);
// add home passages
str += createHomePassage(gender, first, i, 5, "route-" + (i + 1),
startingDist);
}
str += createEndPreset(5);
return str;
}
console.log(create());