/*
* main.cpp
* Text Based Adventure
*
* Created by Memedaddy on 12/14/16.
* Copyright © 2016 Memedaddy. All rights reserved.
*/
#include <iostream>
#include <string>
using namespace std;
int main() {
string in;
bool alive = true, dogMoved = false, dwarfMoved = false, dragonMoved = false, greedyAF = false;
cout << "\tYou wake up in a dimly lit room.\n";
cout << "\tThere is a door in front of you.\n";
cout << "\tAn inscription reads, \"Welcome to my incredibly complicated maze.\"\n";
cout << "\tYou look around and there is nothing else around. The door seems to be the only option.\n";
cout << "\n[\topen door\t]\n";
cout << "> ";
getline(cin, in);
if(in != "open door") {
cout << "\n\tThe ceiling collapses.\n";
cout << "\tYou are dead.\n";
alive = false;
return 0;
}
cout << "\n\tYou enter the next room. The door behind you slams shut.\n";
cout << "\tYou see a large dog in front of another door.\n";
cout << "\tHe is gnawing on a bone, however you startle him and he begins to watch you.\n";
cout << "\tYou hastily turn around in order to escape through the door you came in.\n";
cout << "\tThe door is locked. The only way out is through the door behind the dog.\n";
cout << "\tThere's no way through that door without getting past the dog.\n";
cout << "\tBut how?\n";
while(true) {
if(!alive) {
cout << "\tYou are dead.\n";
break;
}
cout << "\n[\tcall dog\t]\n";
cout << "[\ttaunt dog\t]\n";
cout << "[\ttake bone\t]\n";
if(dogMoved) {
cout << "[\topen door\t]\n";
}
cout << "> ";
getline(cin, in);
if(in == "call dog") {
cout << "\n\tThe dog bounds over to you and before you can even react, it knocks you to the ground.\n";
cout << "\tYour consciousness begins to fade away.\n";
alive = false;
} else if(in == "taunt dog") {
cout << "\n\tYour excessive waving annoyed the dog and he attacked you.\n";
cout << "\tOddly enough, your consciousness begins to fade.\n";
alive = false;
} else if(in == "take bone") {
if(dogMoved) {
cout << "\n\tYou daringly take the bone, yet again.\n";
cout << "\tHowever, this time, you're out of luck.\n";
cout << "\tBefore you can even attempt to throw the bone, the dog rips you to shreds.\n";
alive = false;
} else {
cout << "\n\tIn a moment of madness, you snatch the bone from the dog.\n";
cout << "\tBefore he rips you to shreds, you throw the bone and shout\n";
cout << "\t\"Fetch!\"\n";
cout << "\tThe dog bounds eagerly after the bone.\n";
dogMoved = true;
}
} else if(in == "open door" && dogMoved) {
break;
} else {
cout << "\n\tThat wouldn't work too well here...\n";
}
}
if(!alive) {
return 0;
}
cout << "\n\tYou look around the new room as the sounds of the slamming door echos behind you.\n";
cout << "\tYou see a dwarf guarding the next door.\n";
cout << "\tHe, she, er.. it, is looking at you intently.\n";
cout << "\tYou get the feeling the dwarf is trying to stare you up. (dwarves\n";
cout << "\tare not able to stare down many people; even most animals are\n";
cout << "\tout of the question)\n\n";
cout << "\tYou need to wipe that stare of it's face.\n";
while(true) {
if(!alive) {
cout << "\tThe dwarf walks over and smacks you in the head with the\n";
cout << "\tside of the axe.\n";
cout << "\tAs you lose conciousness you think to yourself how lucky\n";
cout << "\tyou are that the flat side and not the sharp side connected\n";
cout << "\twith your noggin.\n";
cout << "\tYou are dead.\n";
break;
}
cout << "\n[\ttalk\t]\n";
cout << "[\tpush\t]\n";
cout << "[\ttake axe\t]\n";
if(dwarfMoved) {
cout << "[\topen door\t]\n";
}
cout << "> ";
getline(cin, in);
if(in == "talk") {
cout << "\n\tYou try to reason with the dwarf.\n";
cout << "\tUnfortunately, your dwarfish is very rusty and you\n";
cout << "\tinsult it instead.\n";
alive = false;
} else if(in == "push") {
cout << "\n\tDespite being half your size, pushing dwarfs around is never a good idea.\n";
alive = false;
} else if(in == "take axe") {
cout << "\n\tEmboldened by your perfomance in the last room, you\n";
cout << "\tsnatch the axe from the grasp of the dwarf.\n";
cout << "\tThis upsets the dwarf.\n";
cout << "\tA lot.\n";
cout << "\tYou feel like a bully, but only for the moment.\n";
cout << "\tBecause, the door is clear. And you have an axe.\n";
cout << "\t...\n";
cout << "\tNo, you are not going to do a \"Shining\" on the door.\n";
dwarfMoved = true;
} else if(in == "open door" && dwarfMoved) {
break;
} else {
cout << "\n\tThat wouldn't work too well here...\n";
}
}
if(!alive) {
return 0;
}
cout << "\n\tYou enter what feels like the final room.\n";
cout << "\tBlocking the door this time is a great big dragon.\n";
cout << "\tIn keeping with mythical creature stereotype, the dragon is sitting on a\n";
cout << "\tgreat big pile of gold.\n";
cout << "\tHow are you going to part a dragon with its gold, and therefore free the\n";
cout << "\tdoor up for you to go through?\n";
while(true) {
if(!alive) {
cout << "\tYou are dead.\n";
break;
}
cout << "\n[\tnoise\t]\n";
cout << "[\tslap\t]\n";
cout << "[\tuse axe\t]\n";
if(dragonMoved) {
cout << "[\topen door\t]\n";
cout << "[\ttake gold\t]\n";
}
cout << "> ";
getline(cin, in);
if(in == "noise") {
cout << "\n\tYou make a noise that you hope will scare the dragon away.\n";
cout << "\tThis just annoys the dragon.\n";
cout << "\tIt slaps you into unconciousness.\n";
cout << "\tThe sight of those claws coming towards you will haunt you \n";
cout << "\tforever.\n";
cout << "\tWell at least, they would have...\n";
cout << "\tThat is, if they hadn't actually sliced through your skull..\n";
alive = false;
} else if(in == "slap") {
cout << "\tYou slap the dragon, right on the snout.\n";
cout << "In return, the dragon casually sends out a flame\n";
cout << "which toasts you alive.\n";
alive = false;
} else if(in == "use axe") {
cout << "\n\tYou remember you are still carrying an axe.\n";
cout << "\tYou heft the axe and begin to walk towards the dragon.\n";
cout << "\tSensing something is wrong, the dragon opens its eyes.\n";
cout << "\tUpon seeing your big axe, the dragon lets out a scream\n";
cout << "\tand bolts, leaving its gold behind and the door free to walk through.\n";
dragonMoved = true;
} else if(in == "open door") {
break;
} else if(in == "take gold") {
greedyAF = true;
break;
} else {
cout << "\n\tThat wouldn't work too well here...\n";
}
}
if(!alive) {
return 0;
}
if(greedyAF) {
cout << "\n\tWith the dragon gone, the pile of shining gold seems to call to you.\n";
cout << "\tYou go over to the pile of gold, and fill your pockets, and take as much\n";
cout << "\tof the lovely stuff in your arms.\n";
cout << "\tYou stagger over to the door and attempt to open the door.\n";
cout << "\tAfter several attempts, you manage to open the door, while still carrying\n";
cout << "\ta load of gold.\n";
cout << "\tYou are free.\n";
cout << "\tAnd rich.\n";
cout << "\tNow, if only you knew where you were...\n";
} else {
cout << "\n\tYou open the door and see your way out.\n";
cout << "\tAs you walk through the door it slams behind you.\n";
cout << "\tAnd then you remember about the pile of gold.\n";
cout << "\t...\n";
cout << "\tUnguarded...\n";
cout << "\tCompletely unguarded...\n";
cout << "\tBut, hey... at least you have an axe.\n";
}
cout << "\n\n\t\tTHE END\n";
return 0;
}