/*Copyright 2002 */ #include #include #include #include #include #include //defined functions void fightagain(); void map1(); void map2(); void map3(); void fork(); void fight1(); void fight2(); void keepgoing(); void goback(); //defined variables int east=0; //keeps track if you have gone east int west=0; //keeps track if you have gone east int race; //character race int gender; //character gender int playerclass; //character class int life=3; //lives int choice1;//first choice you make int dir2; //second choice (which direction) int dir3; //third choice (which direction) int choice4; //fourth choice (fight again or run away) int hp=100; //character health int trollhp=75; //troll's health int youdamage; //damage you do int theirdamage; //damage monster does int training=0; //if you have trained or not //strings char lost1; //holds y or n to go back or not char name[20]; //holds character name int main() { cout<<" **************************************************"<>gender; system("cls"); cout<<"What race would you like to be?"<>race; system("cls"); cout<<"What class would you like to be?"<>playerclass; system("cls"); cout<<"Enter your character's name: "; cin>>name; system("cls"); while (life>0) { if(life==3) { system("cls"); cout<<"You have 3 lives left."<>lost1; switch(lost1) { case 'y': case 'Y': keepgoing(); break; case 'n': case 'N': goback(); break; default: cout<<"I said to enter Y or N, not "<>lost1; switch(lost1) { case 'y': case 'Y': keepgoing(); break; case 'n': case 'N': goback(); break; default: cout<<"I said to enter Y or N, not "<>lost1; switch(lost1) { case 'y': case 'Y': keepgoing(); break; case 'n': case 'N': goback(); break; default: cout<<"I said to enter Y or N, not "<> //////////////////// //================================================================== //\\\\\\\\\\\\\\\\\\ // CHOICE 1 >> //////////////////// //one of these 2 functions are called when you press y or n at the first choice //******************************************************************* void keepgoing() { system("cls"); cout<<"You decide to keep on moving forward. Suddenly you feel a snake twist around"<> //////////////////// //this is the intro to the fight, only called once //******************************************************************* void fight1() { cout<<"As you turn around you are met with a 10 foot tall, green skinned troll. He"<>dir3; if (dir3==1) { system("cls"); srand( (unsigned)time( NULL ) ); if (training==1) { youdamage = rand() % 35; cout << "You attack the troll for " << youdamage << " points of damage"<> //////////////////// //this function is for the 2nd time and beyond for fighting the troll //******************************************************************* void fightagain() { if (hp<=0) { hp=0; system("cls"); cout <<"The troll hits you and everything goes black as your body falls to the ground."<>choice4; if (choice4==1) { system("cls"); srand( (unsigned)time( NULL ) ); if (training==1) { youdamage = rand() % 30; cout << "You attack the troll for " << youdamage << " points of damage"<> //////////////////// //******************************************************************* void fork() { //if character hasn't been east and west yet if(east + west < 2) { cout<<"At a fork, the path splits into 2 ways."<>choice1; } //if the character has been east and west if(east + west ==2) { cout<<"At the fork you find a new path that you didn't notice before. It leads north."<>choice1; } if(choice1==1) { system("cls"); map1(); } if(choice1==2) { system("cls"); map2(); } if(choice1==3) { system("cls"); map3(); } } //******************************************************************* //\\\\\\\\\\\\\\\\\\ // MAP1 >> //////////////////// //go to map1(east) //******************************************************************* void map1() { if (east==1) { cout<<"You have already been here. You head back to the fork."<>dir2; if (dir2==1) { system("cls"); cout<<"You go investigate and when you come to the front you realize that it is a"<> //////////////////// //go to map2(west) //******************************************************************* void map2() { if (west==1) { cout<<"You have already been here. You head back to the fork."<> //////////////////// //go to map3(north) //******************************************************************* void map3() { cout<<"As you march on the trail north you see the end of the trail and the fields"<