-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathdevelopperGarden.js
89 lines (77 loc) · 4.34 KB
/
developperGarden.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
var developperGarden = {
// Variables
size : 40,
// Functions
onload : function(){
land.addLand("Developper's garden", this.size, 9, this.load.bind(this), this.getText.bind(this), this.move.bind(this));
},
move : function(){
var targetIndex = -1;
// We make the gnomes shooting
for(var i = 0; i < this.size; i++){
if(quest.things[i].text == "CGG"){
if(targetIndex != -1){ // If we have a target
quest.things[targetIndex].hp -= 30;
if(quest.things[targetIndex].hp <= 0){
if(quest.things[targetIndex].type != "character") quest.things[targetIndex] = quest.makeNoneThing();
else quest.things[targetIndex].hp = 1;
targetIndex = -1;
}
}
}
else if(quest.things[i].type != "none"){
targetIndex = i;
}
}
// Increase the time spent
this.timeSpent += 1;
},
load : function(){
// Add garden gnomes
quest.things[27] = this.makeCheatedGardenGnome();
quest.things[28] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[29] = this.makeCheatedGardenGnome();
quest.things[30] = this.makeCheatedGardenGnome();
quest.things[31] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[32] = this.makeCheatedGardenGnome();
quest.things[34] = this.makeCheatedGardenGnome();
quest.things[35] = this.makeCheatedGardenGnome();
quest.things[36] = this.makeCheatedGardenGnome();
quest.things[37] = this.makeCheatedGardenGnome();
quest.things[38] = this.makeCheatedGardenGnome();
if(random.flipACoin()) quest.things[39] = this.makeCheatedGardenGnome();
},
makeCheatedGardenGnome : function(){
return land.createMob("CGG", 70, 70, "ultra plasma gun", "A cheated garden gnome. Since when garden gnomes have guns like that ?", []);
},
getText : function(){
// Create the text
var lines = this.asciiGarden.slice(0);
// Add things
for(var i = 0; i < this.size; i++){
if(quest.things[i].type != "none"){
lines[13] = lines[13].replaceAt(i*3, quest.things[i].text);
}
}
return lines.join("");
},
// Ascii
asciiGarden :
[
" , \n",
" /\\^/`\\ \n",
" | \\/ | \n",
" | | | \n",
" _ _ \\ \\ / \n",
" _{ ' }_ '\\\\//' \n",
" _ { `.!.` } || \n",
" _(_)_ wWWWw ',_/Y\\_,' || \n",
" (_)@(_) (___) {_,_} || \n",
" (_)\\ Y | vVVVv |\\ || |\\ \n",
" |/ \\|/ (\\| (___) | | || | | \n",
" \\| |/ \\| /) Y | | || / / \n",
" | \\| |// (\\|/) \\ \\||/ / \n",
" \\\\\\|// \\\\|// |/ \\|/ `\\\\//` \n",
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
]
};