Advertisement
asqapro

RPG Base

Jul 12th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. void char_create();
  12.  
  13. struct monster{
  14.     int mon_health;
  15.     int speed;
  16.     int exp_drop;
  17.     int mon_dmg;
  18.  
  19.     void rep_dmg(){
  20.         mon_dmg = rand() % 15 + 3;
  21.     }
  22.     void bi_dmg(){
  23.         mon_dmg = rand() % 7 + 1;
  24.     }
  25.     void hum_dmg(){
  26.         mon_dmg = rand() % 10 + 2;
  27.     }
  28.     void hy_dmg(){
  29.         mon_dmg = rand() % 20 + 10;
  30.     }
  31.  
  32.     void mon_level(){
  33.         mon_health += 10;
  34.     }
  35.  
  36.  
  37.     void reptile(){
  38.         mon_health = 25;
  39.         speed = 2;
  40.         exp_drop = 35;
  41.         //frequency = 30
  42.     }
  43.     void bird(){
  44.         mon_health = 15;
  45.         speed = 15;
  46.         exp_drop = 15;
  47.         //frequency = 45
  48.     }
  49.     void humanoid(){
  50.         mon_health = 20;
  51.         speed = 10;
  52.         exp_drop = 20;
  53.         //frequency = 20
  54.     }
  55.     void hybrid(){
  56.         mon_health = 35;
  57.         speed = 7;
  58.         exp_drop = 55;
  59.         //frequency = 5
  60.     }
  61. }mob;
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. struct player{
  69.     string class_race;
  70.     int health;
  71.     int max_health;
  72.     int exp;
  73.     int level;
  74.     int dmg;
  75.  
  76.     void level_up(){
  77.         health += 10;
  78.     }
  79.  
  80.     void warrior_dmg(){
  81.         dmg = rand() % 10 + 5;
  82.     }
  83.     void rouge_dmg(){
  84.         int base = rand() % 5 + 1;
  85.         int second_base = rand() % 5 + 1;
  86.         int crit = 15;
  87.         if (base == second_base){
  88.             dmg = crit;
  89.         }
  90.         else{
  91.             dmg = base;
  92.         }
  93.     }
  94.     void mage_dmg(){
  95.         dmg = rand() % 7 + 1;
  96.     }
  97.  
  98.     void human_rouge(){
  99.         string special_race_abil = "run if low health";
  100.         string special_proff_abil = "avoid battles";
  101.         health = 35;
  102.         max_health = health;
  103.     }
  104.     void human_warrior(){
  105.         string special_race_abil = "run if low health";
  106.         string special_proff_abil = "heavy items";
  107.         health = 55;
  108.         max_health = health;
  109.     }
  110.     void human_mage(){
  111.         string special_race_abil = "run if low health";
  112.         string special_proff_abil = "magic";
  113.         health = 40;
  114.         max_health = health;
  115.     }
  116.  
  117.     void orc_rouge(){
  118.         string special_race_abil = "extra dmg";
  119.         string special_proff_abil = "avoid battles";
  120.         health = 35;
  121.         max_health = health;
  122.     }
  123.  
  124.     void orc_warrior(){
  125.         string special_race_abil = "extra dmg";
  126.         string special_proff_abil = "heavy items";
  127.         health = 55;
  128.         max_health = health;
  129.     }
  130.     void orc_mage(){
  131.         string special_race_abil = "extra dmg";
  132.         string special_proff_abil = "magic";
  133.         health = 40;
  134.         max_health = health;
  135.     }
  136.  
  137.     void elf_rouge(){
  138.         string extra_combo_abil = "always escape battles";
  139.         string special_race_abil = "first attack";
  140.         string special_proff_abil = "avoid battles";
  141.         health = 55;
  142.         max_health = health;
  143.     }
  144.     void elf_warrior(){
  145.         string extra_combo_abil = "always escape battles";
  146.         string special_proff_abil = "heavy items";
  147.         health = 55;
  148.         max_health = health;
  149.     }
  150.     void elf_mage(){
  151.         string extra_combo_abil = "always escape battles";
  152.         string special_proff_abil = "magic";
  153.         health = 40;
  154.         max_health = health;
  155.  
  156.     }
  157. }character;
  158.  
  159.  
  160. int main()
  161. {
  162.     srand(time(NULL));
  163.     char_create();
  164.     cout << "Character created successfully, work in progress.";
  165.     return 0;
  166.     cout << "Ben is jealous.";
  167. }
  168.  
  169.  
  170. void char_create(){
  171.     string pick_race;
  172.     string pick_class;
  173.     cout << "Pick your race: ";
  174.     cin >> pick_race;
  175.     cout << "Pick your class: ";
  176.     cin >> pick_class;
  177.  
  178.     string picked = pick_race+"_"+pick_class;
  179.     if (picked == "human_rouge"){
  180.         character.human_rouge();
  181.     }
  182.     else if (picked == "human_warrior"){
  183.         character.human_warrior();
  184.     }
  185.     else if (picked == "human_mage"){
  186.         character.human_mage();
  187.     }
  188.  
  189.     else if (picked == "orc_rouge"){
  190.         character.orc_rouge();
  191.     }
  192.     else if (picked == "orc_warrior"){
  193.         character.orc_warrior();
  194.     }
  195.     else if (picked == "orc_mage"){
  196.         character.orc_mage();
  197.     }
  198.  
  199.     else if (picked == "elf_rouge"){
  200.         character.elf_rouge();
  201.     }
  202.     else if (picked == "elf_warrior"){
  203.         character.elf_warrior();
  204.     }
  205.     else if (picked == "elf_mage"){
  206.         character.elf_mage();
  207.     }
  208. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement