bunnytaur

bunnyboi

Apr 15th, 2008
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.34 KB | None | 0 0
  1. // Snow "bunnyboi" Pawson's game version 0.1
  2. // Copyright April 15 2008(tax day '08) under the GPL
  3. // TODO: Just about everything
  4. // DONE  Use strings instead of char
  5. //       Make the monster/user fighting sub routine
  6. //       Make the upgrade armor/weapon sub routine
  7. //       Make the lvl up sub routine
  8. //       Clean up the code!!!
  9.  
  10. #include <iostream>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include <string>
  15. using namespace std;
  16. int main ()
  17. {
  18. // your stats
  19.   int mp;
  20.   int hp;
  21.   int dmg;
  22.   int dfc;
  23.   int lvl;
  24.   int mny;
  25.   int exp;
  26.  
  27. // monster stats
  28.   int m_hp;
  29.   int m_mp;
  30.   int m_dmg;
  31.   int m_dfc;
  32.   int m_lvl;
  33.   int m_exp;
  34.   int m_mny;
  35.  
  36. // menu option container
  37.   string option;
  38.  
  39. // intialize random number
  40.   srand ( time(NULL) );
  41.  
  42. // generate random numbers for character
  43.   mp = rand() % 9 + 1;
  44.   hp = rand() % 9 + 1;
  45.   dmg = rand() % 9 + 1;
  46.   dfc = rand() % 9 + 1;
  47.   lvl = 1;
  48.   mny = rand() % 999 + 1;
  49.   exp = 0;
  50.  
  51. // generate random numbers for monsters
  52.   m_mp = rand() % 9 + 1;
  53.   m_hp = rand() % 9 + 1;
  54.   m_dmg = rand() % 9 + 1;
  55.   m_dfc = rand() % 9 + 1;
  56.   m_lvl = 1 + lvl;
  57.   m_mny = rand() % 999 + 1 * m_exp / lvl;
  58.   m_exp = rand() % 9 + lvl;
  59.  
  60.  
  61.   cout << "Main menu \n";
  62.   cout << "Choose one of the following options\n";
  63.   cout << "Current stats\n";
  64.   cout << "Fight a monster \n";
  65.   cout << "Heal life and mana\n";
  66.   cout << "Level up \n";
  67.   cout << "upgrade Armor \n";
  68.   cout << "upgrade Weapon\n";
  69.   cout << "Quit\n";
  70.   cin >> option;
  71.   cout << option << "\n";
  72.   if (option == "Fight")
  73.     cout << "You choose to fight a monster\n";
  74.   else if (option == "Current")
  75.     {cout << "You chose to list your current stats\n";
  76.     cout << "Your current hp is " << hp << " and your mp is " << mp << "\n";
  77.     cout << " your exp is " << exp << " your level is " << lvl << "\n";
  78.     cout << " your gold is " << mny << " your weapon's damage is " << dmg << " and your defence is " << dfc << "\n";}
  79.   else if (option == "Level")
  80.     cout << "You chose to lvl up\n";
  81.   else if (option == "Armor")
  82.     cout << "You chose to upgrade your \n";
  83.   else if (option == "Weapon")
  84.     cout << "You chose to upgrade your weapon\n";
  85.   else if (option == "Heal")
  86.     cout << "You choe to heal your life and mana\n";
  87.   else if (option == "Quit")
  88.     cout << "You chose to quit\n";
  89. return 0;
  90. }
  91.  
  92.  
Advertisement
Add Comment
Please, Sign In to add comment