Advertisement
Guest User

Hi all noob, I m Djon Karmak

a guest
Jan 30th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <time.h>
  4.  
  5. using namespace std;
  6. void Start(){
  7. srand (time(NULL));
  8. setlocale(KEY_SET_VALUE, "Russian");
  9. }
  10. class Persona{
  11.  
  12. public:
  13.  
  14. Persona (string Name_tmp,int Level_tmp, int HP_tmp,int MP_tmp,int STR_tmp,int CON_tmp,int P_Atk_tmp,int P_Def_tmp){
  15.     Name = Name_tmp;
  16.     Level = Level_tmp;
  17.     HP = HP_tmp;
  18.     MP = MP_tmp;
  19.     STR = STR_tmp;
  20.     CON = CON_tmp;
  21.     P_Atk = P_Atk_tmp;
  22.     P_Def = P_Def_tmp;
  23. }
  24.  
  25. int Func_HP (int Level){
  26.  
  27.     int HP_Return = HP;
  28.     for (int i = 0; i < Level; i++){
  29.         if (i < 10){
  30.             HP_Return += rand() % 21 + 18;
  31.         }
  32.         else if (i > 9 && i < 20){
  33.             HP_Return += 20 + (i - 10);
  34.         }
  35.         else if (i > 19 && i < 40){
  36.             HP_Return += 53 + (i - 20);
  37.         }
  38.         if (i == 19){
  39.         HP_Return += 52;
  40.     }
  41.     }
  42.     return HP_Return;
  43. }
  44.  
  45. int Func_MP (int Level){
  46.     int MP_Return = MP;
  47.     for (int i = 0; i < Level; i++){
  48.         if (i < 10){
  49.             MP_Return += 7;
  50.         }
  51.         else if (i > 9 && Level < 20){
  52.             MP_Return += rand () % 9 + 8;
  53.         }
  54.         else if (i > 19 && Level < 40){
  55.             MP_Return += rand () % 18 + 16;   ;
  56.         }
  57.     }
  58.     return MP_Return;
  59. }
  60.  
  61.  
  62.     string Name;
  63.     int HP;
  64.     int MP;
  65.     int STR;
  66.     int CON;
  67.     int P_Atk;
  68.     int P_Def;
  69.     int Level;
  70. };
  71.  
  72. int main()
  73. {
  74.     Start();
  75.     int Lvl = 0;
  76.     cout << "Введите уровень персонажа: ";
  77.     cin >> Lvl;
  78.     Persona Human_Warrior ("MaKJlayD",Lvl, 126, 38, 40, 43, 30, 100);
  79.     cout << endl << Human_Warrior.HP << endl;
  80.     Human_Warrior.HP = Human_Warrior.Func_HP(Human_Warrior.Level);
  81.     Human_Warrior.MP = Human_Warrior.Func_MP(Human_Warrior.Level);
  82.     cout << endl << "HP Персонажа: " << Human_Warrior.HP << endl;
  83.     cout << "MP Персонажа: " << Human_Warrior.MP << endl;
  84.     cout << "Hello world!" << endl;
  85.     return 0;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement