Advertisement
Guest User

Text Adventure Game

a guest
May 20th, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.69 KB | None | 0 0
  1. //Game Maybe...
  2. #include <iostream>
  3. #include <string>
  4.  
  5.  
  6. using std::cout;
  7. using std::endl;
  8. using std::cin;
  9. using std::string;
  10.  
  11.  
  12. int main()
  13. {
  14.     const int GEMS = 500;
  15.     int adventurers, killed, survivors;
  16.     int choice;
  17.     string leader;
  18.     char direction;
  19.     char spells;
  20.     char classes;
  21.     bool loop = true;
  22.  
  23.  
  24.     cout << "Welcome to the Lost Fortune\n\n";
  25.     cout << "Please input the following for an adventure!\n";
  26.    
  27.     cout << "Enter a Number: ";
  28.     cin >> adventurers;
  29.  
  30.     cout << "Enter a Number smaller than the first: ";
  31.     cin >> killed;
  32.  
  33.     survivors = adventurers - killed;
  34.  
  35.     cout << "Enter a Nickname: ";
  36.     cin >> leader;
  37.  
  38.  
  39.     //!!!!!Start you loop here.
  40.  
  41.     do
  42.     {
  43.     cout << "Classes\n\n";
  44.     cout << "1 - Mage\n";
  45.     cout << "2 - Brute\n";
  46.     cout << "3 - Warrior\n";
  47.     cout << "4 - Dwarf\n\n";
  48.    
  49.     cout << "Choice: ";
  50.     cin >> choice;
  51.  
  52.     switch(choice)
  53.     {
  54.         case 1:
  55.             classes = 'M';
  56.             loop = false;
  57.             cout << "\nMage\n";
  58.             break;
  59.  
  60.         case 2:
  61.             classes = 'B';
  62.             loop = false;
  63.             cout << "\nBrute\n";
  64.             break;
  65.  
  66.         case 3:
  67.             classes = 'W';
  68.             loop = false;
  69.             cout << "\nWarrior\n";
  70.             break;
  71.  
  72.         case 4:
  73.             classes = 'D';
  74.             loop = false;
  75.             cout << "\nDwarf\n";
  76.             break;
  77.  
  78.         default:
  79.             cout << "\nYou made an illegal choice.\n\n";
  80.             loop = true;
  81.             break;
  82.     }
  83.     }
  84.     while (loop == true);
  85.  
  86.     //!!!!!End you loop here. Check the choice here.
  87.  
  88.     //story
  89.     cout << "\nA group of " << adventurers << " set out of a mission ";
  90.     cout << "-- in search of the Chalice of Solitude.\n ";
  91.     cout << "The group was led by the marvelous " << leader << ".";
  92.     cout << "\nAlong the way, a pack of vicious Flutterwackening Jabberwocks attacked.\n";
  93.    
  94.    
  95.    
  96.     if (classes == 'M') //!!!!Make this be the compair to the char from above.
  97.     {
  98.         cout << "As a Mage you stand back and look through your book of spells. " << endl;
  99.  
  100.        
  101.     do
  102.     {
  103.     cout << "\nSpells\n\n";
  104.     cout << "1 - Icebeam\n";
  105.     cout << "2 - Fireball\n";
  106.     cout << "3 - Earthquake\n";
  107.    
  108.     cout << "Choice: ";
  109.     cin >> choice;
  110.  
  111.     switch(choice)
  112.     {
  113.         case 1:
  114.             spells = 'I';
  115.             loop = false;
  116.             cout << "\nIcebeam\n";
  117.             break;
  118.  
  119.         case 2:
  120.             spells = 'F';
  121.             loop = false;
  122.             cout << "\nFireball\n";
  123.             break;
  124.  
  125.         case 3:
  126.             spells = 'E';
  127.             loop = false;
  128.             cout << "\nEarthquake\n";
  129.             break;
  130.  
  131.         default:
  132.             cout << "\nYou made an illegal choice.\n\n";
  133.             loop = true;
  134.             break;
  135.     }
  136.     }
  137.     while (loop == true);
  138.  
  139.         if (spells == 'I')
  140.         {
  141.             cout << "You cast Icebeam, freezing the Jabberwock charging your allies in its path." << endl;
  142.         }
  143.  
  144.         if (spells == 'F')
  145.         {
  146.             cout << "You cast Fireball, placing a line of fire between your group and the Jabberwocks." << endl;
  147.             cout << "The only bad thing about this is that it is blocking your path to the exit." << endl;
  148.         }
  149.  
  150.         if (spells == 'E')
  151.         {
  152.             cout << "You cast Earthquake, causing the ground to shake and stalagmites to break off from the ceiling." << endl;
  153.             cout << "Your foes dodge all of the falling stalagmites, but some of your friends arent so lucky." << endl;
  154.             killed + 2;
  155.         }
  156.     }
  157.  
  158.     if (classes == 'W') //!!!!Make this be the compair to the char from above. Make it only a if
  159.     {
  160.         cout << "Test Warrior" << endl;
  161.     }
  162.  
  163.     if (classes == 'D') //!!!!Make this be the compair to the char from above. Make it only a if
  164.     {
  165.         cout << "Test Dwarf" << endl;
  166.     }
  167.  
  168.  
  169.     if (classes == 'B') //!!!!Make this be the compair to the char from above. Make it only a if
  170.     {
  171.         cout << "As a Brute you start to take charge of your group." << endl;
  172.         cout << "You choose the largest Jabberwock out of the pack and slay it within seconds." << endl;
  173.  
  174.         cout << "The others flee in fear." << endl;
  175.         cout << "You see two passages." << endl;
  176.         cout << "Which way do you choose?" << endl;
  177.        
  178.         do
  179.         {
  180.             cout << "Directions:\n\n";
  181.             cout << "1 - Left\n";
  182.             cout << "2 - Right\n";
  183.             cout << "\nChoice: ";
  184.             cin >> choice;
  185.  
  186.             switch(choice)
  187.             {
  188.                 case 1:
  189.                     direction = 'L';
  190.                     loop = false;
  191.                     break;
  192.  
  193.                 case 2:
  194.                     direction = 'R';
  195.                     loop = false;
  196.                     break;
  197.  
  198.                 default:
  199.                     cout << "\n\nYou made an ILLEGAL choice.\n\n";
  200.                     loop = true;
  201.  
  202.             }
  203.  
  204.         }
  205.         while (loop == true);
  206.  
  207.         if(direction = 'L')
  208.         {
  209.             cout << "The passage has led you and your pack to their demise.\n" << endl;
  210.         }
  211.  
  212.         if(direction = 'R')
  213.         {
  214.             cout << "You find a wide open room with absolutely no light." << endl;
  215.             cout << "You cannot find anything to make your path visible." << endl;
  216.  
  217.             do
  218.             {
  219.                 cout << "\nOptions:\n\n";
  220.                 cout << "1 - Stay\n";
  221.                 cout << "2 - Go back\n";
  222.                 cout << "\nChoice: ";
  223.                 cin >> choice;
  224.  
  225.                 switch(choice)
  226.                 {
  227.                     case 1:
  228.                         direction = 'S';
  229.                         loop = false;
  230.                         break;
  231.  
  232.                     case 2:
  233.                         direction = 'G';
  234.                         loop = false;
  235.                         break;
  236.  
  237.                     default:
  238.                         cout << "\n\nYou made an ILLEGAL choice.\n\n";
  239.                         loop = true;
  240.                 }
  241.             }
  242.             while(loop = true);
  243.            
  244.  
  245.             if(direction == 'S')
  246.             {
  247.                 cout << "You search for a source of light." << endl;
  248.                 cout << "You feel around and find the edge of a large hole." << endl;
  249.  
  250.             }
  251.  
  252.             if(direction == 'G')
  253.             {
  254.                 cout << "You turn around and go back." << endl;
  255.             }
  256.         }
  257.     }
  258.  
  259.     cout << "Everyone fought to hold their territory." << endl;
  260.     cout << "All of the foes have been vanquished, but at a cost.\n";
  261.     cout << "\nOf the adventurers, " << killed << " were valiently lost, ";
  262.     cout << "leaving just " << survivors << " in the group.\n";
  263.     cout << "But while laying the deceased to rest, \n";
  264.     cout << "they stumbled upon the buried fortune. \n";
  265.     cout << "So the adventurers split " << GEMS << " gems.\n";
  266.     cout << leader << " held on to the extra " << (GEMS % survivors);
  267.     cout << " peices to keep things fair.\n";
  268.  
  269.     return 0;
  270. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement