-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlocations.js
460 lines (410 loc) · 12 KB
/
locations.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
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
//telescope interactivity
function telescope(direction) {
switch(direction) {
case 'up':
$('#location_ascii').html(Skyscraper.ascii5);
$('#location_text').html('The moon, sure seems far away');
break;
case 'left':
$('#location_ascii').html(Skyscraper.ascii4);
$('#location_text').html('The sea! Going for a swim would be nice right now');
break;
case 'right':
$('#location_ascii').html(Skyscraper.ascii2);
$('#location_text').html('Looks like there is a cabin in the woods over there, should probably check that out');
stuffToShow.forest_map = true;
$('#forest_map').show();
break;
case 'telescope':
$('#location_ascii').html(Skyscraper.ascii3);
$('#location_text').html('Wow who left this up here?');
$('#telescope').show();
$('#look_left').hide();
break;
}
}
function lightFire() {
$('#cabin_rest').show();
$('#location_text').html('The fire is roaring. You may now rest here freely.');
}
function magicDoor() {
if (inventoryObject.rune == true) {
$('#rune_true').css('display', 'inline');
$('#rune_false').css('display', 'none');
$('#magic_door').css('color', '#4FE8D6');
}
else {
$('#rune_false').css('display', 'inline-block');
$('#rune_true').css('display', 'none');
}
}
function showLab() {
$('#lab_map').show();
stuffToShow.lab_map = true;
}
function spaceShipCheck() {
if (player.parts) {
$('#phase3').show();
$('#rocket_launch').show();
stuffToShow.phase3 = true;
stuffToShow.rocket_launch = true;
}
}
//cant visit demon more than once
function noDemon() {
player.demonVisit = true;
}
function flipperCheck() {
if (inventoryObject.flippers) {
$('#flipper_on').show();
$('#location_text').html('Good to go!');
}
else {
$('#error').html('Hey you dont have any flippers!');
}
}
function reflectingPoolChoice(poolChoice) {
if (poolChoice == 'health') {
$('#error').html('Your sword now grants life on hit');
player.swordHP = player.swordHP + 0.25;
}
else if (poolChoice == 'power') {
player.power = player.power + 0.25;
$('#error').html('Your weapons now deal extra damage');
}
else {
player.freedom = player.freedom + 1;
$('#error').html('You now gain extra money from monsters');
}
player.fountain = true;
$('.pool_button').hide();
}
//camp stuff ahead
var campCount = 0;
function searchCamp() {
$('#steal_items').show();
Camp.text = 'There is lots of swag here, but no people still';
$('#location_text').html(Camp.text);
}
//if you confess he charges 3x per return visit
//not a very forgiving man apparently
function campConfess() {
$('#man_text').html('You took my stuff? Guess <br> You are paying extra!');
$('#confess_button').hide();
player.confess = true;
}
//raises price based on outcome of scenario, then updates button
function raiseRestPrice() {
if (player.confess) {
player.restPrice = player.restPrice * 3;
}
else if (player.thief) {
player.restPrice = player.restPrice * 2
}
else {
player.restPrice = 0;
}
$('#rest').html('Rest(' + player.restPrice + ')');
$('#rest_perm').html('Rest(' + player.restPrice + ')');
}
function cabinRest() {
player.health = player.maxHealth;
updateHealthBar();
$('#location_text').html('You are fully rested');
}
//rest if you have the money to give full hp, otherwise error
function campRest() {
campgroundAfterScenario();
if (levelActive) {
$('#error').html('hey you cant rest in battle!');
return;
}
if (player.money > player.restPrice) {
player.money = player.money - player.restPrice;
player.health = player.maxHealth - 1;
$('#error').html('You are fully rested');
raiseRestPrice();
}
else {
$('#error').html('You need more money to rest');
}
}
//just displays the relevant text/buttons depending on how scenario played out
function campgroundAfterScenario() {
Camp.text = 'The fire is roaring';
$('#rest_perm').show();
$('#rest_perm').html('Rest (' + player.restPrice + ')');
$('#camp_scenario').hide();
$('#camp_use').show();
stuffToShow.rest_perm = true;
if (player.confess) {
$('#man_text').html('Hey jerk want to rest? <br> Special Price..');
}
else if (player.thief) {
$('#man_text').show().html('Sorry but someone stole my supplies, Im going <br> to have to charge for you to rest here');
$('#confess').show();
}
else {
$('#confess').hide();
$('#man_text').html('Good to see you again, <br> feel free to rest');
}
$('#man_text').show();
$('#man').show();
}
//stealing is bad okay
//adds the loot to the thieves inventory
//immediately leaves campground
function stealItems() {
player.gunk = player.gunk + 500;
player.money = player.money + 5000;
$('#camp_scenario').hide();
$('#camp_use').show();
player.restPrice = 1;
player.thief = true;
locationSwitch(Map);
$('#error').html('You take the items and leave, gained 5000 gold and 500 gunk');
player.camp = true;
campgroundAfterScenario();
}
//waiting...
//onclick hides buttons for 5 seconds, waiting is hard
//you have to wait forever for him to arrive!
function campgroundWait() {
$('#location_text').html('You are waiting...(be patient)');
$('#camp_scenario').hide();
window.setTimeout(function() {
if (campCount == 0) {
$('#location_text').html('You waited for thirty minutes and no one showed up');
$('#camp_scenario').show();
}
else if (campCount == 1) {
$('#location_text').html('Still no one around, you look around and see a lot of supplies');
$('#camp_scenario').show();
}
else if (campCount == 2) {
$('#location_text').html('The fire is starting to die down');
$('#camp_scenario').show();
}
else {
$('#location_text').html('You may now use the campers tent to rest, free of charge')
$('#man').show();
$('#man_text').show();
$('#camp_use').show();
player.camp = true;
player.restPrice = 0;
}
}, 5000);
campCount++;
}
function labScenario(buttonValue) {
console.log(buttonValue + ' the value');
if (buttonValue == 'grab') {
$('#location_text').html('Oh okay heres a fresh batch for you');
inventoryObject.shipFuel = true;
player.parts = true;
('#laboratory').hide();
}
else if (buttonValue == 'pass') {
$('#location_text').html('But this is a dead end?..');
}
else {
$('#location_text').html('You kill the Chemist in one hit, she was defenseless, you grab the rocket fuel off her corpse');
inventoryObject.shipFuel = true;
player.parts = true;
$('#location_ascii').html(Laboratory.ascii2);
$('#laboratory').hide();
}
}
var reelCount = 0;
function fishReel() {
if (caught) {
$('#location_text').html('Keep reeling!');
reelCount++;
if (reelCount > 5) {
fishCatch();
reelCount = 0;
}
}
else {
$('#location_text').html('Nothing on the line');
}
}
function lootBait() {
if (inventoryObject.bait) {
$('#error').html('You already found some bait, leave some for the other anglers!');
}
else {
$('#location_text').html('Hmm found some bait in the bushes!');
inventoryObject.bait = true;
}
}
var fishCaught;
var caught = false;
function checkFish() {
if (player.bigFish) {
inventoryObject.flippers = true;
Fish.text = 'Hope those flippers are helping you out, maybe check out the sea?';
$('#location_text').html('Wow check out that fish! Here you go take these flippers you deserve them!');
}
else {
$('#location_text').html('You are going to have to do better than that if you want these flippers. Heres a hint: These fish love the worms that live around the pond');
}
}
function fishCatch() {
$('#location_ascii').html(Fish.ascii3);
if (inventoryObject.bait) {
fishCaught = 20;
}
else {
fishCaught = Math.round(Math.random()*19);
}
if (fishCaught < 18) {
$('#location_text').html('You caught a ' + fishCaught + ' pound fish! Some better bait might make this easier. I bet the fisherman knows where to look');
}
else {
$('#location_text').html('Wow! a ' + fishCaught + ' pound fish! That will show the fisherman!');
player.bigFish = true;
}
caught = false;
$('#reel').hide();
}
function fishCast() {
$('#reel').show();
$('#location_ascii').html(Fish.ascii2);
$('#location_text').html('Waiting...');
fishCounter();
}
function fishCounter() {
var random = Math.floor(Math.random()*100);
if (random > 85) {
fishEncounter();
return;
}
else {
setTimeout(function() {
fishCounter();
}, 500);
}
}
function fishEncounter() {
$('#location_ascii').html(Fish.ascii4);
$('#location_text').html('Reel in quick!');
caught = true;
}
function wizardEnchant(buttonValue) {
switch (buttonValue) {
case 'sword':
if (enoughMoney(player.swordEnchantCost)) {
player.swordEnchantVal = player.swordEnchantVal + 0.1;
player.swordEnchantCost = player.swordEnchantCost * 3;
$('#enchantDmg').html('Enchant Sword (' + player.swordEnchantCost + ')');
break;
}
break;
case 'armor':
if (enoughMoney(player.armorEnchantCost)) {
player.armorEnchantVal = player.armorEnchantVal + 0.1;
player.armorEnchantCost = player.armorEnchantCost * 3;
$('#enchantRed').html('Enchant Armor (' + player.armorEnchantCost + ')');
break;
}
break;
}
}
function updateWizardButtons() {
$('#enchantDmg').html('Enchant Sword (' + player.swordEnchantCost + ')');
$('#enchantRed').html('Enchant Armor (' + player.armorEnchantCost + ')');
}
function enoughMoney(cost) {
if (cost > player.money) {
$('#error').html('Not enough money!');
return false;
}
else {
player.money = player.money - cost;
return true;
}
}
function wizardExplain(buttonValue) {
console.log(buttonValue + 'wizzz')
if (buttonValue == 'explain') {
$('#location_text').html('The Lich killed you. Or not. You are here now.. You must have some kind of Lich Curse on you.');
$('#wizard_time').show();
$('#wizard_explain').hide();
}
else if (buttonValue == 'time') {
$('#location_text').html('I dont measure time like you I am a wizard. It has been 0.63 wizard years, a lot sure has changed in that little time! Little for me at least.');
$('#wizard_help').show();
$('#wizard_time').hide();
}
else if (buttonValue == 'help') {
$('#wizard_help').hide()
$('#wizard_explain').show();
$('#location_text').html('Dont ask me Im just a wizard');
}
}
function wizardQuestion() {
$('#location_text').html('Ooh arent you the sassy one, how about this, beat me in a battle of wits and I will give you a prize! I am not afraid of losing, Im a pretty good wizard');
}
function monkCheck() {
if (player.monkVisit) {
$('#location_text').html('The monk is no longer here');
$('#greet_monk').hide();
$('#location_ascii').html('');
}
else if (player.sinChoosen) {
$('#location_text').html('Thank you for rescuing me, unfortunately I cant teach someone afflicted with the demons mark and have nothing else to offer');
$('#kill_monk').show();
}
else {
$('#location_text').html('Thank you for rescuing me, I can teach you the practice of meditation');
$('#learn_monk').show();
}
stuffToShow.cave = true;
$('#cave').show();
}
function monkAction(buttonValue) {
if (buttonValue == 'kill') {
$('#location_ascii').html(Monk.ascii2);
$('#location_text').html('. . .');
$('#error').html('There was nothing on his corpse');
$('#monk_button').hide();
$('#kill_monk').hide();
}
else {
$('#location_text').html('');
$('#error').html('You gain +10% armor & sword enchants');
player.swordEnchantVal = player.swordEnchantVal + 0.1;
player.armorEnchantVal = player.armorEnchantVal + 0.1;
$('#learn_monk').hide();
$('#monk_button').hide();
}
player.monkVisit = true;
}
function lichEncounter(buttonValue) {
switch (buttonValue) {
case 'who':
$('#location_text').html('I am the Lich.');
$('#location_ascii').html(Lich.ascii3);
break;
case 'die':
$('#location_text').html('Fool! You cant defeat me!');
$('#location_ascii').html(Lich.ascii2);
$('.lich_button').hide();
$('#lich_attack').show();
break;
}
}
function lichAttack() {
$('#location_ascii').html('');
$('#location_text').html('. . .');
Main.special = '#future_special';
Map.special = '#future_map';
Store.ascii = Store.ascii3;
$('#post_lich').show();
Wizard.text = 'Wow I havent seen you in awhile!';
Main.text = 'what happened..?'
$('#lich_attack').hide();
$('#continue').show();
player.postLich = true;
}