-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject3.cpp
More file actions
778 lines (683 loc) · 25.8 KB
/
project3.cpp
File metadata and controls
778 lines (683 loc) · 25.8 KB
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
// Classes
class object {
public:
string name;
string inv_desc;
string env_desc;
int location;
};
class locs {
public:
string name;
string look_desc;
int location;
};
class puzzle {
public:
string name;
bool completed;
};
// Function Declarations
vector<object> get(string a, int b, vector<object> c);
vector<object> drop(string a, int b, vector<object> c);
void look(string a, int b, vector<object> c);
int go(int a, string b, vector<locs> c, vector<puzzle> d, vector<object> e);
void check(string a, vector<object> b);
vector<puzzle> red_room(vector<puzzle> a);
vector<object> red_outcome(vector<object> a, vector<puzzle> b);
vector<puzzle> blue_room(vector<puzzle> a);
vector<object> blue_outcome(vector<object> a, vector<puzzle> b);
vector<puzzle> puzzle_update(vector<puzzle> a, vector<object> b);
vector<puzzle> give(string a, vector<object> b, string c, vector<puzzle> d);
// Variables
string player;
int char_loc = 0;
bool error_message = false;
vector<object> items = {
{"rock", "The rock rests at the bottom of your bag.",
"The rock is slightly larger than your hand.", 0},
{"large mushroom", "The large mushroom rests at the bottom of your bag.",
"The mushroom is dark blue with white spots. How strange!", 2},
{"red orb","The red orb casts a glow on all its surroundings.",
"Red light dances across the surface of the perfect sphere",-2},
{"blue orb","The blue orb glows quietly in the dark. What power could it possess?",
"Blue light dances across the surface of the magic device.",-2}
};
vector<locs> all_locs = {
{"The Gray Field", "You are in a foggy field with knee high grass in all directions.\nThere is a hill to the north with a smoldering tree on top of it.\n>",
0},
{"Scorched Hill",
"You approach the smoldering tree. You wonder how it could have even\ncaught on fire in the first place. There were no storms last night but\nthe entire hill appears badly burned. There is a large hole\nat the base of the tree. Loose tree roots surround the hole. Upon\ncloser examination you can hear someone calling out from inside!\n>",
1},
{"The Hall of Roots",
"You betray your better judgment, get on your hands and knees, and \ncrawl into the hole. It is very dark. You hold your hand in front \nof your face and see nothing. Something, presumably tree roots, \nscrapes your arms and neck. Finally, some light. You see a large \nmushroom where the dirt tunnel meets the top of a marble ledge. \nBeyond here is a steep drop into a large extravagant room. \n>",
2},
{"The Dining Hall",
"You drop down from the ledge and fall over. After getting off the\nground you step forward onto the marble tiles. This room has high\nvaulted ceilings with stained glass windows. Some of the panes are\nbroken with mounds of dirt below them from outside. There is a large\ndoor to your left, another on your right, and one in front of you at\nthe far end of the room. There is a long table in the center of the\nroom. Several glass lanterns hang from the ceiling.\n>",
3},
{"The Red Room" ,
"You open the large door on the left side of the dining hall and \nenter a small dark room. There are small lanterns gleaming through \nred stained glass. Who keeps all these lanterns burning? In the \ncorner of the room there is a gold ruby encrusted altar with three \nlevers.\n>",
4},
{"The Blue Room" ,
"You open the large door on the right side of the dining hall and \nenter a small dark room. There are small lanterns gleaming through \nblue stained glass. The light of the lanterns reflects off of \nthe floor which is entirely covered by a shallow layer of water. In\nthe corner of the room there is a silver saphire encrusted altar with\nthree levers.\n>",
5},
{"The Green Room",
"The orbs glow brightly in your bag as you open the moss covered door at\nthe far end of the room. Inside many mushrooms glow bright green.\nYou notice a foul odor as the door slams shut behind you.\nTurning around you make eye contact with a tall creature covered \nin mold. The fungal beast lets out a low gurgling noise as it staggers\ntoward you.\n>",
6}
};
vector<puzzle> all_puzzles = {
{"Red Room", false},
{"Blue Room", false},
{"Holding both orbs", false},
{"Green Room", false}
};
int main()
{
// Give your character a name
cout << "Please enter your character's name: ";
getline(cin, player);
cout << "\nWelcome to \"Fever Dream\", " << player << "!\n"
<< "Good luck!\n\n";
cin.clear();
// Introduction message
cout << "***************Now Entering: " << all_locs.at(0).name << "***************\n"
<< "You are in a foggy field with knee high grass in all directions.\n"
<< "There is a hill to the north with a smoldering tree on top of it.\n"
<< "You see a rock on the ground.\n"
<< ">";
while(true){
if(error_message == true)
return 0;
if(all_puzzles.at(3).completed == true)
return 0;
all_puzzles = puzzle_update(all_puzzles, items);
string line;
getline(cin, line);
/* Filtering out all instances of "the", "on", and "with".
* If I filter out "in" one of my commands "go inside" won't
* work correctly.
*/
while(line.find("the") < line.length() ||
line.find("on") < line.length() ||
line.find("with")< line.length() ||
line.find("in") < line.length())
{
if(line.find(" the") < line.length())
line.erase(line.find(" the"), 4);
else if(line.find("the") < line.length())
line.erase(line.find("the"), 3);
else if(line.find(" on") < line.length())
line.erase(line.find(" on"), 3);
else if(line.find("on") < line.length())
line.erase(line.find("on"), 2);
else if(line.find(" with") < line.length())
line.erase(line.find(" with"), 5);
else if(line.find("with") < line.length())
line.erase(line.find("with"), 4);
else
break;
}
char space = line.find(" ");
string verb = line.substr(0, space);
string noun = line.substr(space + 1, + 1000000);
if(verb == "get")
{
items = get(noun, char_loc, items);
}
else if(verb == "drop")
{
items = drop(noun, char_loc, items);
}
else if(verb == "look")
{
look(noun, char_loc, items);
}
else if(verb == "go")
{
char_loc = go(char_loc, noun, all_locs, all_puzzles, items);
}
else if(verb == "check")
{
check(noun, items);
}
else if(verb == "use" && noun == "levers" && char_loc == 4)
{
all_puzzles = red_room(all_puzzles);
items = red_outcome(items, all_puzzles);
}
else if(verb == "use" && noun == "levers" && char_loc == 5)
{
all_puzzles = blue_room(all_puzzles);
items = blue_outcome(items, all_puzzles);
}
else if(verb == "give" && char_loc == 6)
{
all_puzzles = give(noun, items, player, all_puzzles);
}
else if(verb == "give" && char_loc !=6)
{
cout << "There's no one to give anything to.\n"
<< ">";
}
else if(verb == "quit")
return 0;
else{
cout << "You dont know how to do that."
<< '\n' << ">";
}
}
}
// Function Definitions
vector<object> get(string a, int b, vector<object> c)
{
int i = 0;
while(i <= c.size() - 1){
try{
if(a == c.at(i).name && c.at(i).location == b) {
cout << "Taken.\n"
<< ">";
c.at(i).location = -1;
return c;
}
++i;
}
catch(out_of_range&){
cout << "Out of Range Error";
error_message = true;
}
}
if(a.at(0) == 'a' || a.at(0) == 'e' || a.at(0) == 'i' ||
a.at(0) == 'o' || a.at(0) == 'u'){
cout << "You don't see an " << a << ".\n"
<< ">";
return c;
}
else{
cout << "You don't see a " << a << ".\n"
<< ">";
return c;
}
}
vector<object> drop(string a, int b, vector<object> c)
{
int i = 0;
while(i <= c.size() - 1){
try{
if(a == c.at(i).name && c.at(i).location == -1) {
cout << "You drop the " << a << ".\n"
<< ">";
c.at(i).location = b;
return c;
}
++i;
}
catch(out_of_range&){
cout << "Out of Range Error";
error_message = true;
}
}
if(a.at(0) == 'a' || a.at(0) == 'e' || a.at(0) == 'i' ||
a.at(0) == 'o' || a.at(0) == 'u'){
cout << "You don't have an " << a << ".\n"
<< ">";
return c;
}
else
cout << "You don't have a " << a << ".\n"
<< ">";
return c;
}
void look(string a, int b, vector<object> c)
{
if(a == "rock" && c.at(0).location == b){
cout << "The rock is slightly larger than your hand.\n"
<< ">";
}
else if(a == "rock" && c.at(0).location == -1){
cout << "The rock rests at the bottom of your bag.\n"
<< ">";
}
else if(a == "large mushroom" && c.at(1).location == b){
cout << "The mushroom is dark blue with white spots. How strange!\n"
<< ">";
}
else if(a == "large mushroom" && c.at(1).location == -1){
cout << "The large mushroom rests at the bottom of your bag.\n"
<< ">";
}
else if(a == "red orb" && c.at(2).location == b){
cout << "The red orb casts a glow on all its surroundings.\n"
<< ">";
}
else if(a == "red orb" && c.at(2).location == -1){
cout << "Red light dances across the surface of the perfect sphere.\n"
<< ">";
}
else if(a == "blue orb" && c.at(3).location == b){
cout << "The blue orb glows quietly in the dark. What power could it possess?\n"
<< ">";
}
else if(a == "blue orb" && c.at(3).location == -1){
cout << "Blue light dances across the surface of the magic device.\n"
<< ">";
}
else if(a == "tree" && b == 0){
cout << "That used to be a massive oak tree, but nobody would ever \n"
<< "guess that by looking at it now.\n"
<< ">";
}
else if(a == "hill" && b == 0){
cout << "The grass that used to cover this hill has been reduced to ash.\n"
<< ">";
}
else if(a == "" && b == 0){
cout << "You are in a foggy field with knee high grass in all directions.\nThere is a hill to the north with a smoldering tree on top of it.\n"
<< ">";
if(c.at(0).location == 0)
cout << "\bYou see a rock on the ground.\n>";
}
else if(a == "look" && b == 0){
cout << "You are in a foggy field with knee high grass in all directions.\nThere is a hill to the north with a smoldering tree on top of it.\n"
<< ">";
if(c.at(0).location == 0)
cout << "\bYou see a rock on the ground.\n>";
}
else if(a == "tree" && b == 1){
cout << "The tree crackles as smoke steadily rises up to the morning \n"
<< "sky. It looks as though it could collapse at any moment.\n"
<< ">";
}
else if(a == "hill" && b == 1){
cout << "The hill is completely charred at the top. From up here you can\n"
<< "see that the ash has also covered the area at the base of the hill.\n"
<< ">";
}
else if(a == "hole" && b == 1){
cout << "The hole is huge! Could it have been created by lightning?\n"
<< ">";
}
else if(a == "" && b == 1){
cout << "In front of you is a smoldering tree. This entire hill has been badly\nburned. There is a large hole with roots surrounding it at the base\nof the tree.\n"
<< ">";
if(c.at(0).location == 1)
cout << "\bYou see a rock on the ground.\n>";
}
else if(a == "look" && b == 1){
cout << "In front of you is a smoldering tree. This entire hill has been badly\nburned. There is a large hole with roots surrounding it at the base\nof the tree.\n"
<< ">";
if(c.at(0).location == 1)
cout << "\bYou see a rock on the ground.\n>";
}
else if(a == "" && b == 2){
cout << "Thick tree roots stick out of the damp earth all around you.\n"
<< ">";
if(c.at(0).location == 2)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 2)
cout << "\bThere is a large mushroom in front of you.\n>";
}
else if(a == "look" && b == 2){
cout << "Thick tree roots stick out of the damp earth all around you.\n"
<< ">";
if(c.at(0).location == 2)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 2)
cout << "\bThere is a large mushroom in front of you.\n>";
}
else if(a == "" && b == 3){
cout << "This room has high vaulted ceilings, a marble floor, and stained\nglass windows. Some of the panes are broken with mounds of dirt below\nthem from outside. There is a large door to your left, another on\nyour right, and one in front of you at the far end of the room.\nThere is a long table in the center of the room. Several glass\nlanterns hang from the ceiling.\n"
<< ">";
if(c.at(0).location == 3)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 3)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 3)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 3)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "look" && b == 3){
cout << "This room has high vaulted ceilings, a marble floor, and stained\nglass windows. Some of the panes are broken with mounds of dirt below\nthem from outside. There is a large door to your left, another on\nyour right, and one in front of you at the far end of the room.\nThere is a long table in the center of the room. Several glass\nlanterns hang from the ceiling.\n"
<< ">";
if(c.at(0).location == 3)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 3)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 3)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 3)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "gold ruby encrusted altar" && b == 4){
cout << "What is this contraption? It looks valuable.\n"
<< ">";
}
else if(a == "" && b == 4){
cout << "This room is much smaller than the one you just left. There are\nsmall lanterns gleaming through red stained glass. Who keeps\nall these lanterns burning? In the corner of the room there is\na gold ruby encrusted altar with three levers.\n"
<< ">";
if(c.at(0).location == 4)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 4)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 4)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 4)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "look" && b == 4){
cout << "This room is much smaller than the one you just left. There are\nsmall lanterns gleaming through red stained glass. Who keeps\nall these lanterns burning? In the corner of the room there is\na gold ruby encrusted altar with three levers.\n"
<< ">";
if(c.at(0).location == 4)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 4)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 4)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 4)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "silver saphire encrusted altar" && b == 5){
cout << "Blue light reflects off of the mysterious altar.\n"
<< ">";
}
else if(a == "" && b == 5){
cout << "There are many small lanterns gleaming through blue stained glass.\nThe light from the lanterns is reflecting off of the floor which is\nentirely covered by a shallow layer of water. In the corner of the\nroom there is a silver saphire encrusted altar with three levers.\n"
<< ">";
if(c.at(0).location == 5)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 5)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 5)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 5)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "look" && b == 5){
cout << "There are many small lanterns gleaming through blue stained glass.\nThe light from the lanterns is reflecting off of the floor which is\nentirely covered by a shallow layer of water. In the corner of the\nroom there is a silver saphire encrusted altar with three levers.\n"
<< ">";
if(c.at(0).location == 5)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 5)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 5)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 5)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "fungal beast" && b == 6){
cout << "Looking at the creature causes you to freeze in horror.\n"
<< "Was this a human?\n"
<< ">";
}
else if(a == "" && b == 6){
cout << "You force yourself to look at something besides the embodiment of all\nthat is evil before you...\nThere are many green mushrooms casting their light on the damp walls\nof the room. Moisture drips from the cieling.\n"
<< ">";
if(c.at(0).location == 6)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 6)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 6)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 6)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else if(a == "look" && b == 6){
cout << "You force yourself to look at something besides the embodiment of all\nthat is evil before you...\nThere are many green mushrooms casting their light on the damp walls\nof the room. Moisture drips from the cieling.\n"
<< ">";
if(c.at(0).location == 6)
cout << "\bYou see a rock on the ground.\n>";
if(c.at(1).location == 6)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(c.at(2).location == 6)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(c.at(3).location == 6)
cout << "\bYou see a blue orb casting a soft light.\n>";
}
else{
cout << "You dont see anything interesting.\n"
<< ">";
}
}
int go(int a, string b, vector<locs> c, vector<puzzle> d, vector<object> e){
if(a == 0 && b == "north") {
cout << "***************Now Entering: " << c.at(1).name << "***************\n"
<< c.at(1).look_desc;
if(e.at(0).location == 1)
cout << "\bYou see a rock on the ground.\n>";
return 1;
}
else if(a == 1 && b == "back") {
cout << "***************Now Entering: " << c.at(0).name << "***************\n"
<< c.at(0).look_desc;
if(e.at(0).location == 0)
cout << "\bYou see a rock on the ground.\n>";
return 0;
}
else if(a == 1 && b == "south") {
cout << "***************Now Entering: " << c.at(0).name << "***************\n"
<< c.at(0).look_desc;
if(e.at(0).location == 0)
cout << "\bYou see a rock on the ground.\n>";
return 0;
}
else if(a == 1 && b == "inside") {
cout << "***************Now Entering: " << c.at(2).name << "***************\n"
<< c.at(2).look_desc;
return 2;
}
else if(a == 2 && b == "forward") {
cout << "***************Now Entering: " << c.at(3).name << "***************\n"
<< c.at(3).look_desc;
return 3;
}
else if(a == 3 && b == "left") {
cout << "***************Now Entering: " << c.at(4).name << "***************\n"
<< c.at(4).look_desc;
if(e.at(0).location == 4)
cout << "\bYou see a rock on the ground.\n>";
if(e.at(1).location == 4)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(e.at(2).location == 4)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(e.at(3).location == 4)
cout << "\bYou see a blue orb casting a soft light.\n>";
return 4;
}
else if(a == 4 && b == "back") {
cout << "***************Now Entering: " << c.at(3).name << "***************\n"
<< "Y" << c.at(3).look_desc.erase(0,74);
if(e.at(0).location == 3)
cout << "\bYou see a rock on the ground.\n>";
if(e.at(1).location == 3)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(e.at(2).location == 3)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(e.at(3).location == 3)
cout << "\bYou see a blue orb casting a soft light.\n>";
return 3;
}
else if(a == 3 && b == "right") {
cout << "***************Now Entering: " << c.at(5).name << "***************\n"
<< c.at(5).look_desc;
if(e.at(0).location == 5)
cout << "\bYou see a rock on the ground.\n>";
if(e.at(1).location == 5)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(e.at(2).location == 5)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(e.at(3).location == 5)
cout << "\bYou see a blue orb casting a soft light.\n>";
return 5;
}
else if(a == 5 && b == "back") {
cout << "***************Now Entering: " << c.at(3).name << "***************\n"
<< "Y" << c.at(3).look_desc.erase(0,74);
if(e.at(0).location == 3)
cout << "\bYou see a rock on the ground.\n>";
if(e.at(1).location == 3)
cout << "\bThere is a large mushroom resting on the marble tiles.\n>";
if(e.at(2).location == 3)
cout << "\bA red orb gleams brightly on the ground.\n>";
if(e.at(3).location == 3)
cout << "\bYou see a blue orb casting a soft light.\n>";
return 3;
}
else if(a == 3 && b == "forward" && d.at(2).completed == true) {
cout << "***************Now Entering: " << c.at(6).name << "***************\n"
<< c.at(6).look_desc;
return 6;
}
else{
cout << "You can't go there right now\n"
<< ">";
return a;
}
}
void check(string a, vector<object> b){
if(a == "inventory" || a == "bag"){
if(b.at(0).location == -1 || b.at(1).location == -1 ||
b.at(2).location == -1 || b.at(3).location == -1){
cout << "You have:\n";
if(b.at(0).location == -1)
cout << "A rock\n";
if(b.at(1).location == -1)
cout << "A large mushroom\n";
if(b.at(2).location == -1)
cout << "A red orb\n";
if(b.at(3).location == -1)
cout << "A blue orb\n";
cout << ">";
}
else
cout << "Your bag is empty.\n"
<< ">";
}
else
cout << "You can't do that right now.\n"
<< ">";
}
vector<puzzle> red_room(vector<puzzle> a){
string x;
string y;
string z;
if(a.at(0).completed == true){
cout << "The levers are locked in place and will not budge.\n"
<< ">";
return a;
}
else if(a.at(0).completed == false){
cout << "There are three levers with three positions: up (u), neutral(n),\n"
<< "and down (d). How would you like to orient them?\n"
<< "";
cout << "Lever 1: ";
getline(cin, x);
cout << "Lever 2: ";
getline(cin, y);
cout << "Lever 3: ";
getline(cin, z);
if(x == "u" && y == "d" && z == "u"){
cout << "You see a red flash and hear a high pitch ringing. \n"
<< "It's coming from the dining hall!\n"
<< ">";
a.at(0).completed = true;
return a;
}
else{
cout << "Nothing happens.\n"
<< ">";
return a;
}
}
else
return a;
}
vector<object> red_outcome(vector<object> a, vector<puzzle> b){
if(b.at(0).completed == true && a.at(2).location ==-2){
a.at(2).location = 3;
return a;
}
else
return a;
}
vector<puzzle> blue_room(vector<puzzle> a){
string x;
string y;
string z;
if(a.at(1).completed == true){
cout << "The levers are locked in place and will not budge.\n"
<< ">";
return a;
}
else if(a.at(1).completed == false){
cout << "There are three levers with three positions: up (u), neutral(n),\n"
<< "and down (d). How would you like to orient them?\n"
<< "";
cout << "Lever 1: ";
getline(cin, x);
cout << "Lever 2: ";
getline(cin, y);
cout << "Lever 3: ";
getline(cin, z);
if(x == "n" && y == "n" && z == "d"){
cout << "You see a blue flash and hear a high pitch ringing. \n"
<< "It's coming from the dining hall!\n"
<< ">";
a.at(1).completed = true;
return a;
}
else{
cout << "Nothing happens.\n"
<< ">";
return a;
}
}
else
return a;
}
vector<object> blue_outcome(vector<object> a, vector<puzzle> b){
if(b.at(1).completed == true && a.at(3).location ==-2){
a.at(3).location = 3;
return a;
}
else
return a;
}
vector<puzzle> puzzle_update(vector<puzzle> a, vector<object> b){
if(b.at(2).location == -1 && b.at(3).location == -1){
a.at(2).completed = true;
return a;
}
else{
a.at(2).completed = false;
return a;
}
}
vector<puzzle> give(string a, vector<object> b, string c, vector<puzzle> d){
if(a == "rock" && b.at(0).location == -1){
cout << "You give the rock to the fungal beast...\nThe creature puts the rock in its mouth and tries to bite into it.\nThe beast lets out a deafening howl and tears your still-beating heart\nout of your chest. You fall to the ground, regretting that you ever \ncrawled into this hole, as everything begins to fade to black.\n*PRO TIP*: Fungal beasts do not like rocks! They are also crazy strong...\n";
d.at(3).completed = true;
return d;
}
else if(a == "large mushroom" && b.at(1).location == -1){
cout << "You give the large mushroom to the fungal beast...\nThe creature puts the mushroom in its mouth and bites into it.\nAfter releasing some approving groans the creature motions for you\nfollow it. The beast retrieves a large chest and sets it in front\nof you. You open the chest revealing a mountain of gold!\nIt's all yours! Glory be yours! Your village will sing songs of\nyour brav-\n\"" << c << "\"" << " ... " << "\"" << c << "\"" << " ... \"" << c << ", wake up Sicky it's time\nto take your temperature again.\" Your mother enters the room.\nIt turns out you're actually a 12 year old kid in Oregon who\nstayed home sick from school today...\nStill! Glory be yours!\n";
d.at(3).completed = true;
return d;
}
else{
if(a.at(0) == 'a' || a.at(0) == 'e' || a.at(0) == 'i' ||
a.at(0) == 'o' || a.at(0) == 'u'){
cout << "You don't have an " << a << ".\n"
<< ">";
return d;
}
else
cout << "You don't have a " << a << ".\n"
<< ">";
return d;
}
}