Advertisement
asqapro

RPG Update

Jul 12th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. void char_create();
  11. void alive();
  12. void rest_explore();
  13. void battle();
  14.  
  15. struct monster{
  16.     int mon_health;
  17.     int speed;
  18.     int exp_drop;
  19.     int mon_dmg;
  20.     string rand_item;
  21.  
  22.     vector<string> item_drop_list;
  23.  
  24.     void rep_dmg(){
  25.         mon_dmg = rand() % 15 + 3;
  26.     }
  27.     void bi_dmg(){
  28.         mon_dmg = rand() % 7 + 1;
  29.     }
  30.     void hum_dmg(){
  31.         mon_dmg = rand() % 10 + 2;
  32.     }
  33.     void hy_dmg(){
  34.         mon_dmg = rand() % 20 + 10;
  35.     }
  36.  
  37.     void mon_level(){
  38.         mon_health += 10;
  39.     }
  40.  
  41.     void item_drop(){
  42.         int get_rand_item = rand() % 3 + 1;
  43.         rand_item = item_drop_list[get_rand_item];
  44.     }
  45.  
  46.     void reptile(){
  47.         mon_health = 25;
  48.         speed = 2;
  49.         exp_drop = 35;
  50.         item_drop_list.push_back("health potion");
  51.         item_drop_list.push_back("battle axe");
  52.         item_drop_list.push_back("heavy armor");
  53.         //frequency = 30
  54.     }
  55.     void bird(){
  56.         mon_health = 15;
  57.         speed = 15;
  58.         exp_drop = 15;
  59.         item_drop_list.push_back("health potion");
  60.         item_drop_list.push_back("dagger");
  61.         item_drop_list.push_back("light armor");
  62.         //frequency = 45
  63.     }
  64.     void humanoid(){
  65.         mon_health = 20;
  66.         speed = 10;
  67.         exp_drop = 20;
  68.         item_drop_list.push_back("health potion");
  69.         item_drop_list.push_back("wooden staff");
  70.         item_drop_list.push_back("arcane armor");
  71.         //frequency = 20
  72.     }
  73.     void hybrid(){
  74.         mon_health = 35;
  75.         speed = 7;
  76.         exp_drop = 55;
  77.         item_drop_list.push_back("health potion");
  78.         item_drop_list.push_back("health potionx2");
  79.         item_drop_list.push_back("health potionx3");
  80.         //frequency = 5
  81.     }
  82. }mob;
  83.  
  84.  
  85. struct player{
  86.     string class_race;
  87.     int health;
  88.     int max_health;
  89.     int exp;
  90.     int level;
  91.     int dmg;
  92.  
  93.     void level_up(){
  94.         health += 10;
  95.     }
  96.  
  97.     void warrior_dmg(){
  98.         dmg = rand() % 10 + 5;
  99.     }
  100.     void rouge_dmg(){
  101.         int base = rand() % 5 + 1;
  102.         int second_base = rand() % 5 + 1;
  103.         int crit = 15;
  104.         if (base == second_base){
  105.             dmg = crit;
  106.         }
  107.         else{
  108.             dmg = base;
  109.         }
  110.     }
  111.     void mage_dmg(){
  112.         dmg = rand() % 7 + 1;
  113.     }
  114.  
  115.     void human_rouge(){
  116.         string special_race_abil = "run if low health";
  117.         string special_proff_abil = "avoid battles";
  118.         health = 35;
  119.         max_health = health;
  120.     }
  121.     void human_warrior(){
  122.         string special_race_abil = "run if low health";
  123.         string special_proff_abil = "heavy items";
  124.         health = 55;
  125.         max_health = health;
  126.     }
  127.     void human_mage(){
  128.         string special_race_abil = "run if low health";
  129.         string special_proff_abil = "magic";
  130.         health = 40;
  131.         max_health = health;
  132.     }
  133.  
  134.     void orc_rouge(){
  135.         string special_race_abil = "extra dmg";
  136.         string special_proff_abil = "avoid battles";
  137.         health = 35;
  138.         max_health = health;
  139.     }
  140.  
  141.     void orc_warrior(){
  142.         string special_race_abil = "extra dmg";
  143.         string special_proff_abil = "heavy items";
  144.         health = 55;
  145.         max_health = health;
  146.     }
  147.     void orc_mage(){
  148.         string special_race_abil = "extra dmg";
  149.         string special_proff_abil = "magic";
  150.         health = 40;
  151.         max_health = health;
  152.     }
  153.  
  154.     void elf_rouge(){
  155.         string extra_combo_abil = "always escape battles";
  156.         string special_race_abil = "first attack";
  157.         string special_proff_abil = "avoid battles";
  158.         health = 55;
  159.         max_health = health;
  160.     }
  161.     void elf_warrior(){
  162.         string extra_combo_abil = "always escape battles";
  163.         string special_proff_abil = "heavy items";
  164.         health = 55;
  165.         max_health = health;
  166.     }
  167.     void elf_mage(){
  168.         string extra_combo_abil = "always escape battles";
  169.         string special_proff_abil = "magic";
  170.         health = 40;
  171.         max_health = health;
  172.  
  173.     }
  174. }character;
  175.  
  176.  
  177. int main()
  178. {
  179.     string reload;
  180.     vector<string>::iterator i;
  181.     srand(time(NULL));
  182.     char_create();
  183.     cout << "Character created successfully, work in progress." << endl;
  184.     alive();
  185.     cout << "You died. Reload a save?(y/n) ";
  186.     cin >> reload;
  187.     if (reload == "y"){
  188.         cout << "Save not implemented yet.";
  189.     }
  190.     return 0;
  191. }
  192.  
  193.  
  194. void char_create(){
  195.     string pick_race;
  196.     string pick_class;
  197.     cout << "Pick your race: ";
  198.     cin >> pick_race;
  199.     cout << "Pick your class: ";
  200.     cin >> pick_class;
  201.  
  202.     string picked = pick_race+"_"+pick_class;
  203.     if (picked == "human_rouge"){
  204.         character.human_rouge();
  205.     }
  206.     else if (picked == "human_warrior"){
  207.         character.human_warrior();
  208.     }
  209.     else if (picked == "human_mage"){
  210.         character.human_mage();
  211.     }
  212.  
  213.     else if (picked == "orc_rouge"){
  214.         character.orc_rouge();
  215.     }
  216.     else if (picked == "orc_warrior"){
  217.         character.orc_warrior();
  218.     }
  219.     else if (picked == "orc_mage"){
  220.         character.orc_mage();
  221.     }
  222.  
  223.     else if (picked == "elf_rouge"){
  224.         character.elf_rouge();
  225.     }
  226.     else if (picked == "elf_warrior"){
  227.         character.elf_warrior();
  228.     }
  229.     else if (picked == "elf_mage"){
  230.         character.elf_mage();
  231.     }
  232. };
  233.  
  234.  
  235. void rest_explore(){
  236.     string action;
  237.     int dot_count = 0;
  238.     int dot_stop = 3;
  239.     cout << "Type status to view some current stats about your character." << endl;
  240.     cout << "What do you want to do? ";
  241.     cin >> action;
  242.     if (action == "rest"){
  243.         for (dot_count = 0; dot_count <= dot_stop; dot_count++){
  244.             cout <<  ". ";
  245.             //time.sleep(1)
  246.         }
  247.         cout <<  "You awake feeling rested.";
  248.         character.health += (character.max_health - character.health);
  249.         rest_explore();
  250.     }
  251.     else if(action == "explore"){
  252.         int fequ = rand() % 100 + 1;
  253.         if(fequ < 11){
  254.             //battle();
  255.             cout << "Working on it." << endl;
  256.             rest_explore();
  257.         }
  258.         else{
  259.             //explore();
  260.             cout << "Exploring not set up." << endl;
  261.             rest_explore();
  262.         }
  263.     }
  264.     else if(action == "battle"){
  265.         //battle();
  266.         cout << "Battle not implemented yet." << endl;
  267.         rest_explore();
  268.     }
  269.     else if(action == "status"){
  270.         cout << "Your health is " << character.health << "." << endl;
  271.         //time.sleep(1);
  272.         //cout << "Your inventory consists of " << character.inven << "." << endl;
  273.         //time.sleep(1);
  274.         cout << "You have " << character.exp << " experience points." << endl;
  275.         cout << "You need " << 100 - character.exp << " more point(s) to level." << endl;
  276.         //time.sleep(1)
  277.         cout << "You are level " << character.level << "." << endl;
  278.         //time.sleep(1);
  279.         //cout << character.equips;
  280.         rest_explore();
  281.     }
  282.     else if(action == "save"){
  283.         //cout << "Your game is saved. Only one saved game is possible at a time." << endl;
  284.         //save();
  285.         cout << "Working on it." << endl;
  286.         rest_explore();
  287.     }
  288.     else if(action == "equip"){
  289.         //character.equip();
  290.         cout << "Working on it." << endl;
  291.         rest_explore();
  292.     }
  293.     else{
  294.         cout << "Choose \'rest\', \'status\', \'explore\', \'save\', or \'battle\'." << endl;
  295.         rest_explore();
  296.     }
  297. }
  298.  
  299.  
  300. void alive(){
  301.     rest_explore();
  302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement