Advertisement
Marcel12311

RPG console[PL LANGUAGE]

Jan 22nd, 2022
1,245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 43.63 KB | None | 0 0
  1. // if you don't understand it
  2. // translate it PL-EN
  3. ///////////////////////////////////////////////////
  4. // 1.copy this all code checked[1] to file main.cpp
  5. // 2.copy this all code checked[2] to file class.h
  6. // 3.copy this all code checked[3] to file class.cpp
  7. // 4.start your program and enjoy!
  8. // psss...you can edit code
  9. ///////////////////////////////////////
  10. //           [1]                     //
  11. ///////////////////////////////////////
  12. #include "Class.h"
  13.  
  14. map<int,string>EkwipunekG; // sluzy do przechowywania id ekwipunku
  15. map<int,string>::iterator it; // iterator do mapy EkwipunekG
  16. vector<bool>ValueBools; // typ bool tu przechowujemy czy zadanie zostalo rozpoczete czy nie (false/true) na poczatku jest false
  17.  
  18. void Skills(Character* chr){
  19.     system("cls");
  20.     char wybor;
  21.     char wyb1;
  22.     static int dmg1;
  23.     cout << "Skille info:\n";
  24.     cout << "------------\n";
  25.     cout << "1."<<chr->SkillName1<<endl;
  26.     cout << "2."<<chr->SkillName2<<endl;
  27.  
  28.     cout << "0. wyjdz\n";
  29.     cout << "Enter: ";
  30.     wybor=getch();
  31.  
  32.     switch(wybor){
  33.         case '0':{system("cls");return;}
  34.         case '1': {
  35.             system("cls");
  36.             cout << "Edytuj skilla:\n";
  37.             cout << "Nazwa: "<<chr->SkillName1<<endl;
  38.             cout << "Typ: specjalny\n";
  39.             cout << "Moc: nieokreslona\n";
  40.             cout << "-----------------\n";
  41.             cout << "Tego skilla nie da sie edytowac\n";
  42.             cout << "0. aby wyjsc\n";
  43.             cout << "Enter: ";
  44.             wyb1=getch();
  45.             if(wyb1=='0'){system("cls");return;}
  46.             break;
  47.             }
  48.         case '2':{
  49.             system("cls");
  50.             cout << "Edytuj skilla:\n";
  51.             cout << "Nazwa: "<<chr->SkillName2<<endl;
  52.             cout << "Typ: normalny\n";
  53.             cout << "Moc: "<<chr->skills2<<endl;
  54.             cout << "-----------------\n";
  55.             cout << "czy chcesz zwiekszyc moc?\n";
  56.             dmg1+= 25;
  57.             cout << "koszt wynosi: "<<dmg1<< " zlota.\n";
  58.             cout << "1)tak\n";
  59.             cout << "2)nie\n";
  60.             cout << "Enter: ";
  61.             wyb1=getch();
  62.             if(wyb1=='1' && chr->getGold() >= chr->skills1_koszt){
  63.                 int g;
  64.                 system("cls");
  65.                 chr->skills1_koszt *= 2;
  66.  
  67.                 g = chr->getGold();
  68.                 g -= chr->skills1_koszt;
  69.                 chr->setGold(g);
  70.  
  71.                 cout << "pomyslnie kupiles ulepszenie!\n";
  72.                 chr->skills2+=10;
  73.                 cout << "teraz twoj skill ma +"<<chr->skills2<<" mocy!\n";
  74.                 cout << "nacisnij aby kontynuowac...";
  75.                 wyb1=getch();
  76.                 system("cls");
  77.             }else if(wyb1=='1' && chr->getGold() < chr->skills1_koszt){
  78.                 system("cls");
  79.                 cout << "masz za malo zlota nie mozesz kupic tego\n";
  80.                 Sleep(3000);
  81.             }else {system("cls");return;}
  82.             break;
  83.         }
  84.          default: {system("cls");cout<<"Wybrales zla opcje!\n";Sleep(3000);system("cls");return;}
  85.     }
  86.     system("cls");
  87. }
  88.  
  89. void LogicQuests(Character* acc){
  90.     if(ValueBools[0] == true && acc->ZabiteMWilk >= acc->PolowanieMWilk){
  91.         system("cls");
  92.         int g;
  93.         cout << "Udalo ci sie wykonac zadanie!\n";
  94.         cout << "oto nagroda: " << 50 << " zlota";
  95.  
  96.         acc->ZabiteMWilk = 0;
  97.         acc->PolowanieMWilk  *= 2;
  98.  
  99.         g = acc->getGold();
  100.         g += 25;
  101.         acc->setGold(g);
  102.         Sleep(5000);
  103.         system("cls");
  104.     }
  105. }
  106.  
  107. void Quests(Character* acc){
  108.     system("cls");
  109.     char wybor;
  110.     if(ValueBools[0] == true){
  111.         cout <<"--------------------\n";
  112.         cout << "Upoluj "<<acc->PolowanieMWilk<< " mlode wilki\n";
  113.         cout << "Postep znajdziesz na dole\n";
  114.         cout <<"["<<acc->ZabiteMWilk<<"/"<<acc->PolowanieMWilk<<"]"<<endl;
  115.         cout <<"--------------------\n";
  116.  
  117.     }else {cout << "Nie masz zadnych zadan w tej chwili!\n";Sleep(3000);system("cls");return;}
  118.  
  119.     cout << "\n\nwcisnij cokolwiek aby kontynuowac...";
  120.     wybor=getch();
  121.     cout <<wybor;
  122.     system("cls");
  123. }
  124.  
  125. void Equipment(Character* acc){
  126.     int wybor=0;
  127.     system("cls");
  128.     if(EkwipunekG.size() == 0){
  129.         cout << "Nie masz nic w ekwipunku!\n";
  130.         Sleep(3000);
  131.     }else{
  132.  
  133.     for(auto it=EkwipunekG.begin();it!=EkwipunekG.end();it++){
  134.         cout << it->first<<"."<<it->second<<endl;
  135.     }
  136.  
  137.     cout << "Enter: ";
  138.     cin >> wybor;
  139.     if(!cin){
  140.         cin.clear();
  141.         cin.sync();
  142.         system("cls");
  143.         cout << "Nieprawidlowa opcja!\n";
  144.         Sleep(3500);
  145.         system("cls");
  146.         return;
  147.     }
  148.     it = EkwipunekG.find(wybor);
  149.     if(it != EkwipunekG.end()){
  150.         acc->LogicEQ(it->second,it->first);
  151.     }else {cout << "Nie znaleziono przedmiotu o takim id\n";Sleep(3000);}
  152. }
  153.     system("cls");
  154. }
  155.  
  156. void Shop(Character* acc){
  157.     system("cls");
  158.     char wybor=0;
  159.     string wybierz;
  160.     cout << "0)wyjdz\n";
  161.     cout << "1)Mala mikstura zycia\n";
  162.     cout << "Enter: ";
  163.     wybor=getch();
  164.  
  165.     switch(wybor){
  166.         case '0':{system("cls");return;}
  167.         case '1': {
  168.             system("cls");
  169.             cout << "Leczy: 20 punktow zycia\n";
  170.             cout << "Koszt zakupu: ["<<acc->Mikstura_01_koszt<<"] zlota!\n";
  171.             cout << "Czy chcesz kupic?(Mala mikstura zycia\n)";
  172.             cout << "wypisz (tak/Tak) lub (nie/Nie)\n";
  173.             cout << "Enter: ";
  174.             cin >> wybierz;
  175.  
  176.             if(wybierz == "tak" || wybierz == "Tak"){
  177.                 int g=0;
  178.                 if(acc->getGold() >= acc->Mikstura_01_koszt){
  179.                 acc->Mikstura_01_ilosc++;
  180.                 if(acc->Mikstura_01_ilosc <= 1)acc->iteruj++;
  181.                 EkwipunekG[acc->iteruj] = "MalaMiksturaZycia";
  182.  
  183.                 g = acc->getGold();
  184.                 g -= acc->Mikstura_01_koszt;
  185.                 acc->setGold(g);
  186.  
  187.                 system("cls");
  188.                 }else {system("cls");cout << "Nie masz na tyle zlota!\n";Sleep(4500);system("cls");}
  189.             }else {system("cls");}
  190.         break;}
  191.     default: {system("cls");cout<<"Zla opcja!\n";Sleep(3500);system("cls");}
  192.     }
  193. }
  194.  
  195. void SaveGame(Character* acc){
  196.  
  197.     system("cls");
  198.     string odp;
  199.     cout << "Czy na pewno chcesz nadpisac stan gry?\n";
  200.     cout << "wypisz (tak/Tak) lub (nie/Nie)\n";
  201.     cout << "enter: ";
  202.     cin >> odp;
  203.         //if(!cin){cin.clear();cin.sync();system("cls");cout<<"Blad!\n";Sleep(2500);file.close();return;}
  204.     if(odp=="tak" || odp=="Tak"){
  205.     ofstream file;
  206.  
  207.     file.open("statystyki.txt",std::ofstream::out);
  208.  
  209.  
  210.     if(!file.is_open()){
  211.         system("cls");
  212.         //jezeli sie nie da zapisac wyswietl komunikat o bledzie
  213.         cout << "Blad przy zapisie danych!\n";
  214.         cout << "Sprobuj ponownie.\n";
  215.         Sleep(3000);
  216.         system("cls");
  217.         file.close();
  218.         return;
  219.  
  220.     }else{
  221.         file << acc->getHealth();
  222.         file <<endl;
  223.         file << acc->getMaxHealth();
  224.         file <<endl;
  225.         file << acc->getGold();
  226.         file <<endl;
  227.         file << acc->getAttack();
  228.         file <<endl;
  229.         file << acc->name;
  230.         file <<endl;
  231.         file << acc->getType();
  232.         file <<endl;
  233.         file << acc->PolowanieMWilk;
  234.         file <<endl;
  235.         file << acc->ZabiteMWilk;
  236.         file <<endl;
  237.         file << ValueBools[0];
  238.         file <<endl;
  239.         file << acc->eqiuppedWep;
  240.         file <<endl;
  241.         file << acc->EqWep;
  242.         file <<endl;
  243.         file << acc->iteruj;
  244.         file <<endl;
  245.         file << EkwipunekG[1];
  246.         file <<endl;
  247.         file << acc->Mikstura_01_ilosc;
  248.         file <<endl;
  249.         file << acc->skills1;
  250.         }
  251.         system("cls");
  252.         cout << "Pomyslne zapisanie gry!\n";
  253.         Sleep(3000);
  254.         system("cls");
  255.        // zamykamy plik
  256.        file.close();
  257.     }else {system("cls");return;}
  258. }
  259.  
  260. Character* LoadGame(){
  261.     ifstream file;
  262.  
  263.     int zycie=0;
  264.     int zyciemax=0;
  265.     int gold=0;
  266.     int atak=0;
  267.     int ZWilk1=0;
  268.     int QWilk1=0;
  269.     bool QTWilk1;
  270.     int skillss1;
  271.  
  272.     bool ifwepun;
  273.     int wep1S;
  274.     int iterat1;
  275.     int mik1_ilosc;
  276.     string nazwa="unknown";
  277.     string typ="unknown";
  278.     string wth1="";
  279.  
  280.     file.open("statystyki.txt",std::ifstream::in);
  281.  
  282.     if(!file.is_open()){
  283.         system("cls");
  284.         cout << "\nBlad! statystyki gracza nie istnieja!\n";
  285.         cout << "Musisz zaczac gre od nowa!\n";
  286.         Sleep(4500);
  287.         system("cls");
  288.     }else{
  289.         file >> zycie;
  290.         file >> zyciemax;
  291.         file >> gold;
  292.         file >> atak;
  293.         file >> nazwa;
  294.         file >> typ;
  295.         file >> QWilk1;
  296.         file >> ZWilk1;
  297.         file >> QTWilk1;
  298.         file >> ifwepun;
  299.         file >> wep1S;
  300.         file >> iterat1;
  301.         file >> wth1;
  302.         file >> mik1_ilosc;
  303.         file >> skillss1;
  304. }
  305.     file.close();
  306.     if(typ=="Wojownik"){
  307.         system("cls");
  308.         cout << "Laduje prosze czekac...";
  309.         Sleep(4500);
  310.  
  311.         Warrior* wojownik = new Warrior(100,100,5,0,nazwa);
  312.         wojownik->setGold(gold);
  313.         wojownik->setHealth(zycie);
  314.         wojownik->setMaxHealth(zyciemax);
  315.         wojownik->setAttack(atak);
  316.         wojownik->name = nazwa;
  317.         wojownik->setType(typ);
  318.         wojownik->PolowanieMWilk=QWilk1;
  319.         wojownik->ZabiteMWilk=ZWilk1;
  320.         ValueBools[0]=QTWilk1;
  321.         wojownik->eqiuppedWep = ifwepun;
  322.         wojownik->iteruj=iterat1;
  323.         wojownik->EqWep = static_cast<EqBron>(wep1S);
  324.         wojownik->skills1 = skillss1;
  325.         if(mik1_ilosc != 0){
  326.         EkwipunekG[1] = wth1;
  327.         wojownik->Mikstura_01_ilosc = mik1_ilosc;}
  328.         return wojownik;
  329.  
  330.     }else if(typ=="Lucznik"){
  331.         system("cls");
  332.         cout << "Laduje prosze czekac...";
  333.         Sleep(4500);
  334.  
  335.         Archery* Lucznik = new Archery(60,60,14,0,nazwa);
  336.         Lucznik->setGold(gold);
  337.         Lucznik->setHealth(zycie);
  338.         Lucznik->setMaxHealth(zyciemax);
  339.         Lucznik->setAttack(atak);
  340.         Lucznik->name = nazwa;
  341.         Lucznik->setType(typ);
  342.         Lucznik->PolowanieMWilk=QWilk1;
  343.         Lucznik->ZabiteMWilk=ZWilk1;
  344.         ValueBools[0]=QTWilk1;
  345.         Lucznik->eqiuppedWep = ifwepun;
  346.         Lucznik->iteruj=iterat1;
  347.         Lucznik->EqWep = static_cast<EqBron>(wep1S);
  348.         Lucznik->skills1 = skillss1;
  349.         if(mik1_ilosc != 0){
  350.         EkwipunekG[1] = wth1;
  351.         Lucznik->Mikstura_01_ilosc = mik1_ilosc;}
  352.         return Lucznik;
  353.  
  354.     }else if(typ=="Mag"){
  355.         system("cls");
  356.         cout << "Laduje prosze czekac...";
  357.         Sleep(4500);
  358.  
  359.         Archery* Mag = new Archery(60,60,14,0,nazwa);
  360.         Mag->setGold(gold);
  361.         Mag->setHealth(zycie);
  362.         Mag->setMaxHealth(zyciemax);
  363.         Mag->setAttack(atak);
  364.         Mag->name = nazwa;
  365.         Mag->setType(typ);
  366.         Mag->PolowanieMWilk=QWilk1;
  367.         Mag->ZabiteMWilk=ZWilk1;
  368.         ValueBools[0]=QTWilk1;
  369.         Mag->eqiuppedWep = ifwepun;
  370.         Mag->iteruj=iterat1;
  371.         Mag->EqWep = static_cast<EqBron>(wep1S);
  372.         Mag->skills1 = skillss1;
  373.         if(mik1_ilosc != 0){
  374.         EkwipunekG[1] = wth1;
  375.         Mag->Mikstura_01_ilosc = mik1_ilosc;}
  376.         return Mag;
  377.  
  378.     }else return NULL;
  379. }
  380.  
  381. void Battle(Character* chr,Character* target){
  382.     char wybor=0;
  383.     system("cls");
  384.     cout << "statystyki przeciwnika:\n";
  385.     target->showStats();
  386.     cout << "statystyki twoje:\n";
  387.     chr->showStats();
  388.     Sleep(3000);
  389.     cout <<endl<<endl;
  390.     for(int i=5;i>=0;i--){
  391.         cout << "za [" << i <<"] zacznie sie walka"<<endl;
  392.         Sleep(1000);
  393.     }
  394.     system("cls");
  395.  
  396.     //system walki
  397.     int hp=0; // zmienna przechowuje tymczasowe zycie naszej postaci
  398.     int mhp=0; // tymaczasowe potwora zycie
  399.     int tura=1; // liczy tury co koniec rundy
  400.     int Speedhits=0; // jezeli zaatakowalismy przeciwnika i mialismy go na strzala ustawiamy zmienna na 1 / odwrotnie przeciwnik mial nas na strzala
  401.     cout << "rozpoczela sie walka pomiedzy\n";
  402.     cout << chr->name<<" vs "<<target->name<<"!"<<endl;
  403.     Sleep(3000);
  404.     system("cls");
  405.     do{
  406.         system("cls");
  407.         cout << "1)uzyj zwyklego ataku\n";
  408.         cout << "2)uzyj skilla\n";
  409.         cout << "3) opusc walke\n";
  410.         cout << "Enter: ";
  411.         wybor=getch();
  412.  
  413.         switch(wybor){
  414.             case '1': {cout << "Atak zwykly";Sleep(3000);system("cls");break;}
  415.             case '2': {chr->useSkills(target);break;}
  416.             case '3': {system("cls");cout << "stchorzyles!";Sleep(3500);delete target;target=NULL;system("cls");return;}
  417.             default: {cout << "nieznana opcja!";Sleep(3000);system("cls");}
  418.         }
  419.         if(target->getHealth()<=0){mhp=0;target->setHealth(mhp);Speedhits=1;Sleep(2500);break;}
  420.         //zadawanie obrazen i wyswietlenie na ekranie
  421.         if((chr->getBoolSkill() == false && chr->getSkillID() <= 0) || (chr->getBoolSkill() == true && chr->getSkillID() == 1)){
  422.         cout << chr->name << " zaatakowal " << target->name<< " z sila "<<chr->getAttack()<<"!"<<endl;
  423.         mhp = target->getHealth();
  424.         mhp -= chr->getAttack();
  425.         target->setHealth(mhp);
  426.         if(target->getHealth()<=0){mhp=0;target->setHealth(mhp);Speedhits=1;Sleep(2500);break;}
  427.         Sleep(2500);
  428.         cout<<endl;}
  429.         cout << target->name << " zaatakowal " << chr->name<< " z sila "<<target->getAttack()<<"!"<<endl;
  430.         hp = chr->getHealth();
  431.         hp -= target->getAttack();
  432.         chr->setHealth(hp);
  433.         if(chr->getHealth()<=0){hp=0;chr->setHealth(hp);Speedhits=1;Sleep(2500);break;}
  434.         cout<<endl<<endl;
  435.  
  436.         Sleep(2500);
  437.         // wyswietlamy informacje
  438.         cout <<"Koniec tury: "<<tura<<endl;
  439.         cout << "twoje zycie: "<<chr->getHealth()<<endl;
  440.         cout << "przeciwnika zycie: "<<target->getHealth()<<endl;
  441.         cout << "-------------------\n";
  442.  
  443.         Sleep(5000);
  444.         cout <<endl <<endl;
  445.         tura++; // inkrementujemy ture co koniec walki
  446.         if(chr->cooldownSkill > 0)chr->cooldownSkill--;
  447.         if(chr->getSkillID() == 1 || chr->getSkillID() == 2){chr->setBoolSkills(false);chr->setSkillID(0);}
  448.  
  449.     }while((chr->getHealth())>0 && (target->getHealth())>0);
  450.     // tutaj jest koncowa tura jezeli trafilismy przeciwnika na strzala
  451.     // lub przeciwnik trafil nas na strzala
  452.     if(Speedhits == 1){
  453.         cout<<endl;
  454.         cout <<"Koniec tury: "<<tura<<endl;
  455.         cout << "twoje zycie: "<<chr->getHealth()<<endl;
  456.         cout << "przeciwnika zycie: "<<target->getHealth()<<endl;
  457.         cout << "-------------------\n";
  458.         Sleep(6000);
  459.     }
  460.  
  461.     if(chr->getHealth() <= 0){
  462.         system("cls");
  463.         cout << "Przegrales!\n";
  464.         cout << "Sprobuj innym razem!\n";
  465.         chr->setBoolSkills(false);
  466.         chr->setSkillID(0);
  467.         chr->cooldownSkill = 0;
  468.         delete target;
  469.     }else if(target->getHealth() <= 0){
  470.         system("cls");
  471.         int numsrand = target->getGold();
  472.         int goldmy=0;
  473.         numsrand = rand()%numsrand+1;
  474.         cout << "wygrales!\n";
  475.         cout << "oto nagroda: "<<numsrand<<" zlota!"<<endl;
  476.         goldmy = chr->getGold();
  477.         goldmy += numsrand;
  478.         chr->setGold(goldmy);
  479.         chr->setBoolSkills(false);
  480.         chr->setSkillID(0);
  481.         chr->cooldownSkill=0;
  482.         if(ValueBools[0] == true)chr->ZabiteMWilk++;
  483.         if(target->getType() == "MlodyWilk" )ValueBools[0]=true;
  484.  
  485.         delete target;
  486.     }
  487.     target=NULL;
  488.     cout << "Nacisnij dowolny klawisz...";
  489.     wybor=getch();
  490.     system("cls");
  491. }
  492.  
  493. void ChooseDiffArena(Character* chr){
  494.     system("cls");
  495.     char wybor;
  496.     int ran = 0;
  497.     int hp;
  498.     int atk;
  499.     int gold;
  500.     cout << "1)Easy\n";
  501.     cout << "2)Medium\n";
  502.     cout << "3)Hard\n";
  503.     cout << "------\n";
  504.     cout << "Enter: ";
  505.     wybor=getch();
  506.  
  507.     switch(wybor){
  508.         case '1': {
  509.             ran = rand()%2+1;
  510.             hp = rand()%(chr->getHealth()-10)+10;
  511.             atk = rand()%(chr->getAttack()-1)+1;
  512.             gold = rand()%10+3;
  513.             if(ran == 1){
  514.                 Warrior* object1 = new Warrior(hp,hp,atk,gold,"Apocaliptus");
  515.                 Battle(chr,object1);
  516.             }else if(ran == 2){
  517.                 hp = rand()%(chr->getHealth()-10)+10;
  518.                 atk = rand()%(chr->getAttack()-1)+1;
  519.                 gold = rand()%10+3;
  520.                 Archery* object1 = new Archery(hp,hp,atk,gold,"Nipetilus");
  521.                 Battle(chr,object1);
  522.             }else if(ran == 3){
  523.                 hp = rand()%(chr->getHealth()-10)+10;
  524.                 atk = rand()%(chr->getAttack()-1)+1;
  525.                 gold = rand()%10+3;
  526.                 Mage* object1 = new Mage(hp,hp,atk,gold,"Elipse");
  527.                 Battle(chr,object1);
  528.             }
  529.             break;
  530.         }
  531.         // tutaj mozesz dodac kolejne poziomy trudnosci
  532.         // bazujac na tym gorze...
  533.  
  534.         default: {system("cls");cout << "nieznana opcja!";Sleep(3000);system("cls");return;}
  535.     }
  536.  
  537. }
  538.  
  539. void ChoiceBattle(Character* chr){
  540.     system("cls");
  541.     char wybor=0;
  542.     Character* target=NULL;
  543.     cout<<"WYBOR PRZECIWNIKA:\n";
  544.     cout <<"-----------------\n";
  545.     cout <<"1)Mlody Wilk\n";
  546.     cout<<"Enter: ";
  547.     wybor=getch();
  548.  
  549.     switch(wybor){
  550.         case '1': {Wolf* youngWolf = new Wolf(60,60,3,10,"Mlody Wilk");target=youngWolf;Battle(chr,target);break;}
  551.         default: {cout<<"nieprawidlowa opcja!\n";}
  552.     }
  553. }
  554.  
  555. void GameStart(Character* acc){
  556.     char wybor=0;
  557. do{
  558.     LogicQuests(acc);
  559.     acc->showStats();
  560.     cout << "----------"<<endl;
  561.     cout <<"0) wyjsc z gry\n";
  562.     cout <<"1)Walcz z potworami\n";
  563.     cout <<"2)Arena"<<endl;
  564.     cout <<"3)Ekwipunek"<<endl;
  565.     cout << "4)Skille"<<endl;
  566.     cout <<"5)Zadania"<<endl;
  567.     cout <<"6)Sklep"<<endl;
  568.     cout <<"7)Zapisz gre\n"<<endl;
  569.     cout << "----------"<<endl;
  570.     cout << "Enter: ";
  571.     wybor=getch();
  572.  
  573.     switch(wybor){
  574.         case '0':{system("cls");cout<<"Pomyslnie wyszedles z gry!\n";delete acc;exit(0);}
  575.         case '1':{ChoiceBattle(acc);break;}
  576.         case '2':{ChooseDiffArena(acc);break;}
  577.         case '3':{Equipment(acc);break;}
  578.         case '4':{Skills(acc);break;}
  579.         case '5':{Quests(acc);break;}
  580.         case '6':{Shop(acc);break;}
  581.         case '7':{SaveGame(acc);break;}
  582.         default: {system("cls");cout << "nieprawidlowa opcja!\n";}
  583.     }
  584.   }while(wybor!='0');
  585. }
  586.  
  587. Character* character_selection(){
  588.     char znak = 0;
  589.     string name;
  590.  
  591.     cout << "witamy w rpg\n";
  592.     cout << "aby stworzyc postac nacisnij na klawiaturze\n";
  593.     cout << "podana liczbe na dole...\n";
  594.     cout <<endl<<endl;
  595.     cout<<"-------------\n";
  596.     cout <<"Prosze podac najpierw \n";
  597.     cout << "nazwe postaci\n";
  598.     cout << "od 4 do 10 liter\n";
  599.     cout << "nie moze przekraczac\n";
  600.     cout << "Enter: ";
  601.     cin >> name;
  602.  
  603. // obsluga nazwy gracza
  604. if(name.length() >= 0 && name.length() <= 3){cout <<"za mala nazwe postaci podales!\n";exit(0);}
  605. else if(name.length() >= 10){cout << "za dluga nazwe postaci podales!\n";exit(0);}
  606. else if(!cin){
  607.         cout << "failed name!\n";
  608.         cout << "returned 0!\n";
  609.         exit(0);
  610. }
  611.  
  612. //petla ta wybiera i zwraca obiekt klasy
  613.     do{
  614.     cout<<"-------------\n";
  615.     cout<<"0)aby wyjsc calkowicie\n";
  616.     cout<<"1)Wojownik\n";
  617.     cout<<"2)Lucznik\n";
  618.     cout<<"3)Mag\n";
  619.     cout <<"4)Wczytaj gre\n";
  620.     cout << "Enter: ";
  621.     znak = getch();
  622.     cout << znak <<endl;
  623.     switch(znak){
  624.         case '0': {system("cls");cout<<"Pomyslnie wyszedles z gry!";break;}
  625.         case '1':{Warrior* wojownik = new Warrior(100,100,10,0,name);return wojownik;}
  626.         case '2':{Archery* lucznik = new Archery(50,50,18,0,name);return lucznik;}
  627.         case '3':{Mage* Mag1 = new Mage(30,30,25,0,name);return Mag1;}
  628.         case '4':{return LoadGame();}
  629.     default: {system("cls");cout << "nieprawidlowa opcja!\n";}
  630.     }
  631. }while(znak!='0');
  632.     // jezeli 0 wybralismy wychodzimy z calego programu
  633.     if(znak == '0')exit(0);
  634.  
  635.     // przeciwnym wypadku zwroc null
  636.     return NULL;
  637. }
  638.  
  639. int main(){
  640.     Character* wsk; // glowny wskaznik na obiekt gracza ktorego bedziemy operowali we funkcjach
  641.     wsk = character_selection(); // tworzymy najpierw obiekt klasy [Wojownik] lub [Lowca] lub [Mag] i wskazujemy wskaznikiem wsk na obiekt utworzony
  642.     if(wsk == NULL){
  643.         system("cls");
  644.         cout << "Blad w wczytaniu postaci\n";
  645.         cout << "lub anulowales\n";
  646.         exit(0);
  647.     }
  648.     system("cls");
  649.     // glowna mechanika gry w tej funkcja ponizej
  650.     GameStart(wsk);
  651.     // jezeli jakims cudem wyszedlismy z funkcji gameStart zwaliamy pamiec wsk
  652.     delete wsk;
  653.     return 0;
  654. }
  655. ///////////////////////////////////////
  656. //              [2]                  //
  657. ///////////////////////////////////////
  658. #ifndef elo
  659. #define elo
  660. #include <iostream>
  661. #include <windows.h>
  662. #include <cstdlib>
  663. #include <time.h>
  664. #include <ctime>
  665. #include <conio.h> // obsluga klawiatury
  666. #include <fstream> // biblioteka sluzy do zapisywania plikow
  667. #include <map>
  668. #include <sstream>
  669. #include <vector>
  670. using namespace std;
  671.  
  672. extern map<int,string>EkwipunekG;
  673. extern map<int,string>::iterator it;
  674. extern vector<bool>ValueBools;
  675. enum EqBron {uneqiupped=0,eq1=1};
  676.  
  677. class Character{
  678. protected:
  679.     bool skill;
  680.     int hp;
  681.     int hpMax;
  682.     int attack;
  683.     int gold;
  684.     int skillID;
  685.     string type;
  686. public:
  687.     EqBron EqWep;
  688.     bool quest1;
  689.     bool eqiuppedWep;
  690.  
  691.     int PolowanieMWilk;
  692.     int ZabiteMWilk;
  693.     int cooldownSkill;
  694.  
  695.     // iterator po ekwipunku
  696.     int iteruj;
  697.     int Mikstura_01_ilosc;
  698.     int Mikstura_01_koszt;
  699.  
  700.     int wepDmg;
  701.  
  702.  
  703.  
  704.     int skills1;
  705.     int skills2;
  706.     int skills1_koszt;
  707.  
  708.     string nameWep1;
  709.  
  710.     string name;
  711.     string SkillName1;
  712.     string SkillName2;
  713.  
  714.  
  715.  
  716.     // czysta metoda wirtualna
  717.     virtual ~Character(){};
  718.     virtual void showStats()=0;
  719.     virtual int getHealth()=0;
  720.     virtual void setHealth(int)=0;
  721.     virtual int getAttack()=0;
  722.     virtual int getGold()=0;
  723.     virtual void setGold(int)=0;
  724.     virtual bool getBoolSkill(){return false;}
  725.     virtual void setBoolSkills(bool){};
  726.     virtual int getSkillID(){return 0;}
  727.     virtual void useSkills(Character*){};
  728.     virtual void setSkillID(int){};
  729.     virtual int getMaxHealth(){return 0;};
  730.     virtual void setType(string){};
  731.     virtual string getType(){return "";}
  732.     virtual void setAttack(int){};
  733.     virtual void setMaxHealth(int){};
  734.     virtual void LogicEQ(string,int){};
  735.     virtual void SkillsInfo(){};
  736. };
  737.  
  738. class Warrior :public Character{
  739. public:
  740.     Warrior(int,int,int,int,string);
  741.     void showStats();
  742.     int getHealth();
  743.     void setHealth(int);
  744.     int getAttack();
  745.     int getGold();
  746.     void setGold(int);
  747.     void useSkills(Character*);
  748.     bool getBoolSkill();
  749.     void setBoolSkills(bool);
  750.     int getSkillID();
  751.     void setSkillID(int);
  752.     int getMaxHealth();
  753.     void setType(string);
  754.     void setAttack(int);
  755.     void setMaxHealth(int);
  756.     string getType();
  757.     void LogicEQ(string,int);
  758.     void SkillsInfo();
  759. };
  760.  
  761. class Archery :public Character{
  762.  
  763. public:
  764.     Archery(int,int,int,int,string);
  765.     void showStats();
  766.     int getHealth();
  767.     void setHealth(int);
  768.     int getAttack();
  769.     int getGold();
  770.     void setGold(int);
  771.     void useSkills(Character*);
  772.     bool getBoolSkill();
  773.     void setBoolSkills(bool);
  774.     int getSkillID();
  775.     void setSkillID(int);
  776.     int getMaxHealth();
  777.     void setType(string);
  778.     void setAttack(int);
  779.     void setMaxHealth(int);
  780.     string getType();
  781.     void LogicEQ(string,int);
  782.     void SkillsInfo();
  783. };
  784.  
  785. class Mage :public Character{
  786.  
  787. public:
  788.     Mage(int,int,int,int,string);
  789.     void showStats();
  790.     int getHealth();
  791.     void setHealth(int);
  792.     int getAttack();
  793.     int getGold();
  794.     void setGold(int);
  795.     void useSkills(Character*);
  796.     bool getBoolSkill();
  797.     void setBoolSkills(bool);
  798.     int getSkillID();
  799.     void setSkillID(int);
  800.     int getMaxHealth();
  801.     void setType(string);
  802.     void setAttack(int);
  803.     void setMaxHealth(int);
  804.     string getType();
  805.     void LogicEQ(string,int);
  806.     void SkillsInfo();
  807. };
  808.  
  809. class Wolf :public Character{
  810. public:
  811.     Wolf(int,int,int,int,string);
  812.     virtual void showStats();
  813.     int getHealth();
  814.     void setHealth(int);
  815.     int getAttack();
  816.     int getGold();
  817.     void setGold(int);
  818.     string getType();
  819. };
  820.  
  821. #endif // elo
  822. ///////////////////////////////////////
  823. //              [3]                  //
  824. ///////////////////////////////////////
  825. #include "Class.h"
  826.  
  827. Warrior::Warrior(int h,int hm,int a,int g,string n){
  828.     hp=h;
  829.     hpMax=hm;
  830.     attack=a;
  831.     gold=g;
  832.     name=n;
  833.     type="Wojownik";
  834.  
  835.     eqiuppedWep=false;
  836.     nameWep1="Bron nowicjuszy";
  837.  
  838.  
  839.     cooldownSkill=0;
  840.     skill=false;
  841.     skillID=-1;
  842.  
  843.     SkillName1 = "Podwojny atak";
  844.     SkillName2 = "Uzdrow siebie";
  845.  
  846.     quest1=false;
  847.     PolowanieMWilk = 3;
  848.     ZabiteMWilk = 0;
  849.  
  850.     ValueBools.push_back(false);
  851.     iteruj=0;
  852.     EkwipunekG[0] = nameWep1;
  853.     Mikstura_01_ilosc=0;
  854.     Mikstura_01_koszt=10;
  855.     skills1_koszt=10;
  856.  
  857.     // wlasciwosci skille
  858.     // (dmg - moc)
  859.     skills1 = 10;
  860.     skills2 = 20;
  861.     wepDmg = 10;
  862.     EqWep = uneqiupped;
  863. }
  864.  
  865. void Warrior::showStats(){
  866.     cout << "Nazwa: "<<name<<endl;
  867.     cout << "Zycie: "<<hp<<"/"<<hpMax<<endl;
  868.     cout << "atak: "<<attack<<endl;
  869.     cout << "Zloto: "<<gold<<endl;
  870.     cout << "Klasa: "<<type;
  871.     cout<<endl;
  872. }
  873.  
  874. int Warrior::getHealth(){
  875.     return hp;
  876. }
  877.  
  878. void Warrior::setHealth(int n){
  879.     hp=n;
  880. }
  881.  
  882. int Warrior::getAttack(){
  883.     return attack;
  884. }
  885. int Warrior::getGold(){
  886.     return gold;
  887. }
  888. void Warrior::setGold(int n){
  889.     gold=n;
  890. }
  891.  
  892. void Warrior::useSkills(Character* target){
  893.     char wybor=0;
  894.     int mhp=0;
  895.     system("cls");
  896.     cout << "Menu Skilli:\n";
  897.     cout << "1)Podwojny atak\n";
  898.     cout << "2)Uzdrow siebie(moc: "<<this->skills1<<")\n";
  899.     cout << "Enter: ";
  900.     wybor=getch();
  901.     // if we have cooldownSkill = 0 we can use skills
  902. if(this->cooldownSkill==0){
  903.     switch(wybor){
  904.         case '1': {cout<<"Podwojny atak";Sleep(3000);this->skill=true;this->skillID=1;break;}
  905.         case '2': {cout<<"Uzdrow siebie";Sleep(3000);this->skill=true;this->skillID=2;break;}
  906.         default: {cout <<"nieznana opcja!\n";Sleep(4000);return;}
  907.     }
  908.  
  909.     if(this->skill==true && this->skillID == 1){
  910.     system("cls");
  911.     cout << this->name << " zaatakowal " << target->name<< " z sila "<<this->getAttack()<<"!"<<endl;
  912.     mhp = target->getHealth();
  913.     mhp -= this->getAttack();
  914.     target->setHealth(mhp);
  915.     cout <<endl;cooldownSkill=3;}else if(this->skill==true && this->skillID == 2){
  916.         system("cls");
  917.         if(this->hp < this->hpMax){
  918.         cout << "gracz "<<this->name<<" uzyl zaklecia uzdrow siebie!\n";
  919.         this->hp += skills1;
  920.         if(this->hp > this->hpMax)this->hp=this->hpMax;
  921.         }
  922.  
  923.         else if(this->hp >= this->hpMax)cout<<"Masz pelne zycie!\n";
  924.         cout << "twoje hp: "<<this->hp<<endl;
  925.         this->cooldownSkill=5;
  926.         Sleep(3000);
  927.         system("cls");
  928.     }
  929.  
  930.  
  931.     }else {cout << "Nie mozesz teraz uzywac skillow poczekaj jeszcze: "<<this->cooldownSkill<<" tury!"<<endl;Sleep(3000);system("cls");}
  932.     Sleep(2500);
  933. }
  934.  
  935. bool Warrior::getBoolSkill(){
  936.     return skill;
  937. }
  938.  
  939. void Warrior::setBoolSkills(bool b){
  940.     skill = b;
  941. }
  942.  
  943. int Warrior::getSkillID(){
  944.     return skillID;
  945. }
  946.  
  947. void Warrior::setSkillID(int s){
  948.     skillID = s;
  949. }
  950.  
  951. int Warrior::getMaxHealth(){
  952.     return hpMax;
  953. }
  954.  
  955. void Warrior::setType(string n){
  956.     type=n;
  957. }
  958.  
  959. void Warrior::setAttack(int n){
  960.     attack = n;
  961. }
  962.  
  963. void Warrior::setMaxHealth(int n){
  964.     hpMax = n;
  965. }
  966.  
  967. string Warrior::getType(){
  968.     return type;
  969. }
  970.  
  971. void Warrior::LogicEQ(string nazwa,int id){
  972.     if(nazwa == "MalaMiksturaZycia"){
  973.             string wybor;
  974.             cout << "Informacje:\n";
  975.             cout << "-----------------\n";
  976.             cout << "Nazwa przedmiotu: "<<nazwa<<endl;
  977.             cout << "Ilosc: " << this->Mikstura_01_ilosc<<endl;
  978.             cout << "Leczy: 20 punktow zycia\n";
  979.             cout << "-----------------\n";
  980.             cout << "czy chcesz uzyc przedmiotu?\n";
  981.             cout << "(tak/Tak) lub (nie/Nie)\n";
  982.             cout << "Enter: ";
  983.             cin >> wybor;
  984.  
  985.             if(!cin){cin.clear();cin.sync();system("cls");cout<<"Blad!\n";Sleep(2500);system("cls");return;}
  986.  
  987.             if(wybor == "tak" || wybor == "Tak"){
  988.                 this->hp+=20;
  989.                 this->Mikstura_01_ilosc--;
  990.                 if(this->hp > this->hpMax){
  991.                     system("cls");
  992.                     cout << "Masz pelne zycie!\n";
  993.                     this->hp=hpMax;
  994.                     Sleep(3000);
  995.                     system("cls");
  996.                 }else if(this->hp <= this->hpMax) cout << "Uzyles przedmiotu!\n";
  997.                 if(this->Mikstura_01_ilosc == 0){
  998.                         EkwipunekG.erase(id);
  999.                         this->iteruj--;
  1000.                 }
  1001.             }else return;
  1002.     }
  1003.     if(nazwa == "Bron nowicjuszy"){
  1004.             system("cls");
  1005.             char wybor;
  1006.             cout << "Informacje:\n";
  1007.             cout << "-----------------\n";
  1008.             cout << "Nazwa przedmiotu: "<<this->nameWep1<<endl;
  1009.             cout << "atak: " << this->wepDmg<<endl;
  1010.             cout << "-----------------\n";
  1011.             cout << "0)wyjdz\n";
  1012.             cout << "1)zalozyc\n";
  1013.             cout << "2)zdjac\n";
  1014.             cout << "Enter: ";
  1015.             wybor=getch();
  1016.             if(wybor == '0'){
  1017.                     system("cls");return;
  1018.             }else if (wybor == '1'){
  1019.                     if(eqiuppedWep == false && EqWep == 0){
  1020.                         EqWep = eq1;
  1021.                         eqiuppedWep = true;
  1022.                         this->attack+=wepDmg;
  1023.                         cout << "Pomyslnie zalozyles bron!\n";
  1024.                         Sleep(3000);
  1025.                         system("cls");
  1026.                     }else {cout<<"Masz juz bron na siebie zalozona!\n";Sleep(3000);system("cls");}
  1027.             }
  1028.             else if(wybor == '2'){
  1029.                 if(eqiuppedWep == true && EqWep != 0){
  1030.                         if(EqWep == 1){
  1031.                             this->attack-=wepDmg;
  1032.                         }
  1033.                         EqWep = uneqiupped;
  1034.                         eqiuppedWep = false;
  1035.                         cout << "Pomyslnie zdjales bron!\n";
  1036.                         Sleep(3000);
  1037.                         system("cls");
  1038.                 }else {cout << "Nie masz zadnej broni zalozonej na siebie!\n";Sleep(3000);system("cls");return;}
  1039.             }else {cout << "prowadz poprawna opcje!\n";Sleep(3000);system("cls");return;}
  1040.     }
  1041. }
  1042.  
  1043. void Warrior::SkillsInfo(){
  1044.  
  1045. };
  1046.  
  1047. Archery::Archery(int h,int hm,int a,int g,string n){
  1048.     hp=h;
  1049.     hpMax=hm;
  1050.     attack=a;
  1051.     gold=g;
  1052.     name=n;
  1053.     type="Lucznik";
  1054.  
  1055.     eqiuppedWep=false;
  1056.     nameWep1="Luk nowicjuszy";
  1057.  
  1058.  
  1059.     cooldownSkill=0;
  1060.     skill=false;
  1061.     skillID=-1;
  1062.  
  1063.     SkillName1 = "Podwojny atak";
  1064.     SkillName2 = "Uzdrow siebie";
  1065.  
  1066.     quest1=false;
  1067.     PolowanieMWilk = 3;
  1068.     ZabiteMWilk = 0;
  1069.  
  1070.     ValueBools.push_back(false);
  1071.     iteruj=0;
  1072.     EkwipunekG[0] = nameWep1;
  1073.     Mikstura_01_ilosc=0;
  1074.     Mikstura_01_koszt=10;
  1075.     skills1_koszt=10;
  1076.  
  1077.     // wlasciwosci skille
  1078.     // (dmg - moc)
  1079.     skills1 = 10;
  1080.     skills2 = 20;
  1081.     wepDmg = 10;
  1082.     EqWep = uneqiupped;
  1083. }
  1084.  
  1085. void Archery::showStats(){
  1086.     cout << "Nazwa: "<<name<<endl;
  1087.     cout << "Zycie: "<<hp<<"/"<<hpMax<<endl;
  1088.     cout << "atak: "<<attack<<endl;
  1089.     cout << "Zloto: "<<gold<<endl;
  1090.     cout << "Klasa: "<<type;
  1091.     cout<<endl;
  1092. }
  1093.  
  1094. int Archery::getHealth(){
  1095.     return hp;
  1096. }
  1097.  
  1098. void Archery::setHealth(int n){
  1099.     hp=n;
  1100. }
  1101.  
  1102. int Archery::getAttack(){
  1103.     return attack;
  1104. }
  1105. int Archery::getGold(){
  1106.     return gold;
  1107. }
  1108. void Archery::setGold(int n){
  1109.     gold=n;
  1110. }
  1111.  
  1112. void Archery::useSkills(Character* target){
  1113.     char wybor=0;
  1114.     int mhp=0;
  1115.     int s=0;
  1116.     system("cls");
  1117.     cout << "Menu Skilli:\n";
  1118.     cout << "1)Super Atak\n";
  1119.     cout << "2)Uzdrow siebie(moc: "<<this->skills1<<")\n";
  1120.     cout << "Enter: ";
  1121.     wybor=getch();
  1122.     // if we have cooldownSkill = 0 we can use skills
  1123. if(this->cooldownSkill==0){
  1124.     switch(wybor){
  1125.         case '1': {cout<<"Super atak";Sleep(3000);this->skill=true;this->skillID=1;break;}
  1126.         case '2': {cout<<"Uzdrow siebie";Sleep(3000);this->skill=true;this->skillID=2;break;}
  1127.         default: {cout <<"nieznana opcja!\n";Sleep(4000);return;}
  1128.     }
  1129.  
  1130.     if(this->skill==true && this->skillID == 1){
  1131.     system("cls");
  1132.     cout << this->name << " zaatakowal " << target->name<< " z sila "<<(this->getAttack()) + (this->attack / 2) <<"!"<<endl;
  1133.     s = (this->attack / 2);
  1134.     mhp = target->getHealth();
  1135.     mhp -= (this->getAttack()) + s;
  1136.     target->setHealth(mhp);
  1137.     cout <<endl;cooldownSkill=3;}else if(this->skill==true && this->skillID == 2){
  1138.         system("cls");
  1139.         if(this->hp < this->hpMax){
  1140.         cout << "gracz "<<this->name<<" uzyl zaklecia uzdrow siebie!\n";
  1141.         this->hp += skills1;
  1142.         if(this->hp > this->hpMax)this->hp=this->hpMax;
  1143.         }
  1144.  
  1145.         else if(this->hp >= this->hpMax)cout<<"Masz pelne zycie!\n";
  1146.         cout << "twoje hp: "<<this->hp<<endl;
  1147.         this->cooldownSkill=5;
  1148.         Sleep(3000);
  1149.         system("cls");
  1150.     }
  1151.  
  1152.  
  1153.     }else {cout << "Nie mozesz teraz uzywac skillow poczekaj jeszcze: "<<this->cooldownSkill<<" tury!"<<endl;Sleep(3000);system("cls");}
  1154.     Sleep(2500);
  1155. }
  1156.  
  1157. bool Archery::getBoolSkill(){
  1158.     return skill;
  1159. }
  1160.  
  1161. void Archery::setBoolSkills(bool b){
  1162.     skill = b;
  1163. }
  1164.  
  1165. int Archery::getSkillID(){
  1166.     return skillID;
  1167. }
  1168.  
  1169. void Archery::setSkillID(int s){
  1170.     skillID = s;
  1171. }
  1172.  
  1173. int Archery::getMaxHealth(){
  1174.     return hpMax;
  1175. }
  1176.  
  1177. void Archery::setType(string n){
  1178.     type=n;
  1179. }
  1180.  
  1181. void Archery::setAttack(int n){
  1182.     attack = n;
  1183. }
  1184.  
  1185. void Archery::setMaxHealth(int n){
  1186.     hpMax = n;
  1187. }
  1188.  
  1189. string Archery::getType(){
  1190.     return type;
  1191. }
  1192.  
  1193. void Archery::LogicEQ(string nazwa,int id){
  1194.     if(nazwa == "MalaMiksturaZycia"){
  1195.             string wybor;
  1196.             cout << "Informacje:\n";
  1197.             cout << "-----------------\n";
  1198.             cout << "Nazwa przedmiotu: "<<nazwa<<endl;
  1199.             cout << "Ilosc: " << this->Mikstura_01_ilosc<<endl;
  1200.             cout << "Leczy: 20 punktow zycia\n";
  1201.             cout << "-----------------\n";
  1202.             cout << "czy chcesz uzyc przedmiotu?\n";
  1203.             cout << "(tak/Tak) lub (nie/Nie)\n";
  1204.             cout << "Enter: ";
  1205.             cin >> wybor;
  1206.  
  1207.             if(!cin){cin.clear();cin.sync();system("cls");cout<<"Blad!\n";Sleep(2500);system("cls");return;}
  1208.  
  1209.             if(wybor == "tak" || wybor == "Tak"){
  1210.                 this->hp+=20;
  1211.                 this->Mikstura_01_ilosc--;
  1212.                 if(this->hp > this->hpMax){
  1213.                     system("cls");
  1214.                     cout << "Masz pelne zycie!\n";
  1215.                     this->hp=hpMax;
  1216.                     Sleep(3000);
  1217.                     system("cls");
  1218.                 }else if(this->hp <= this->hpMax) cout << "Uzyles przedmiotu!\n";
  1219.                 if(this->Mikstura_01_ilosc == 0){
  1220.                         EkwipunekG.erase(id);
  1221.                         this->iteruj--;
  1222.                 }
  1223.             }else return;
  1224.     }
  1225.     if(nazwa == "Luk nowicjuszy"){
  1226.             system("cls");
  1227.             char wybor;
  1228.             cout << "Informacje:\n";
  1229.             cout << "-----------------\n";
  1230.             cout << "Nazwa przedmiotu: "<<this->nameWep1<<endl;
  1231.             cout << "atak: " << this->wepDmg<<endl;
  1232.             cout << "-----------------\n";
  1233.             cout << "0)wyjdz\n";
  1234.             cout << "1)zalozyc\n";
  1235.             cout << "2)zdjac\n";
  1236.             cout << "Enter: ";
  1237.             wybor=getch();
  1238.             if(wybor == '0'){
  1239.                     system("cls");return;
  1240.             }else if (wybor == '1'){
  1241.                     if(eqiuppedWep == false && EqWep == 0){
  1242.                         EqWep = eq1;
  1243.                         eqiuppedWep = true;
  1244.                         this->attack+=wepDmg;
  1245.                         cout << "Pomyslnie zalozyles bron!\n";
  1246.                         Sleep(3000);
  1247.                         system("cls");
  1248.                     }else {cout<<"Masz juz bron na siebie zalozona!\n";Sleep(3000);system("cls");}
  1249.             }
  1250.             else if(wybor == '2'){
  1251.                 if(eqiuppedWep == true && EqWep != 0){
  1252.                         if(EqWep == 1){
  1253.                             this->attack-=wepDmg;
  1254.                         }
  1255.                         EqWep = uneqiupped;
  1256.                         eqiuppedWep = false;
  1257.                         cout << "Pomyslnie zdjales bron!\n";
  1258.                         Sleep(3000);
  1259.                         system("cls");
  1260.                 }else {cout << "Nie masz zadnej broni zalozonej na siebie!\n";Sleep(3000);system("cls");return;}
  1261.             }else {cout << "prowadz poprawna opcje!\n";Sleep(3000);system("cls");return;}
  1262.     }
  1263. }
  1264.  
  1265. void Archery::SkillsInfo(){
  1266.  
  1267. };
  1268.  
  1269.  
  1270. Mage::Mage(int h,int hm,int a,int g,string n){
  1271.     hp=h;
  1272.     hpMax=hm;
  1273.     attack=a;
  1274.     gold=g;
  1275.     name=n;
  1276.     type="Mag";
  1277.  
  1278.     eqiuppedWep=false;
  1279.     nameWep1="Rozdzka nowicjuszy";
  1280.  
  1281.  
  1282.     cooldownSkill=0;
  1283.     skill=false;
  1284.     skillID=-1;
  1285.  
  1286.     SkillName1 = "Podwojny atak";
  1287.     SkillName2 = "Uzdrow siebie";
  1288.  
  1289.     quest1=false;
  1290.     PolowanieMWilk = 3;
  1291.     ZabiteMWilk = 0;
  1292.  
  1293.     ValueBools.push_back(false);
  1294.     iteruj=0;
  1295.     EkwipunekG[0] = nameWep1;
  1296.     Mikstura_01_ilosc=0;
  1297.     Mikstura_01_koszt=10;
  1298.     skills1_koszt=10;
  1299.  
  1300.     // wlasciwosci skille
  1301.     // (dmg - moc)
  1302.     skills1 = 30;
  1303.     skills2 = 20;
  1304.     wepDmg = 5;
  1305.     EqWep = uneqiupped;
  1306. }
  1307.  
  1308. void Mage::showStats(){
  1309.     cout << "Nazwa: "<<name<<endl;
  1310.     cout << "Zycie: "<<hp<<"/"<<hpMax<<endl;
  1311.     cout << "atak: "<<attack<<endl;
  1312.     cout << "Zloto: "<<gold<<endl;
  1313.     cout << "Klasa: "<<type;
  1314.     cout<<endl;
  1315. }
  1316.  
  1317. int Mage::getHealth(){
  1318.     return hp;
  1319. }
  1320.  
  1321. void Mage::setHealth(int n){
  1322.     hp=n;
  1323. }
  1324.  
  1325. int Mage::getAttack(){
  1326.     return attack;
  1327. }
  1328. int Mage::getGold(){
  1329.     return gold;
  1330. }
  1331. void Mage::setGold(int n){
  1332.     gold=n;
  1333. }
  1334.  
  1335. void Mage::useSkills(Character* target){
  1336.     char wybor=0;
  1337.     int mhp=0;
  1338.     system("cls");
  1339.     cout << "Menu Skilli:\n";
  1340.     cout << "1)Podwojny atak\n";
  1341.     cout << "2)Uzdrow siebie(moc: "<<this->skills1<<")\n";
  1342.     cout << "Enter: ";
  1343.     wybor=getch();
  1344.     // if we have cooldownSkill = 0 we can use skills
  1345. if(this->cooldownSkill==0){
  1346.     switch(wybor){
  1347.         case '1': {cout<<"Podwojny atak";Sleep(3000);this->skill=true;this->skillID=1;break;}
  1348.         case '2': {cout<<"Uzdrow siebie";Sleep(3000);this->skill=true;this->skillID=2;break;}
  1349.         default: {cout <<"nieznana opcja!\n";Sleep(4000);return;}
  1350.     }
  1351.  
  1352.     if(this->skill==true && this->skillID == 1){
  1353.     system("cls");
  1354.     cout << this->name << " zaatakowal " << target->name<< " z sila "<<this->getAttack()<<"!"<<endl;
  1355.     mhp = target->getHealth();
  1356.     mhp -= this->getAttack();
  1357.     target->setHealth(mhp);
  1358.     cout <<endl;cooldownSkill=3;}else if(this->skill==true && this->skillID == 2){
  1359.         system("cls");
  1360.         if(this->hp < this->hpMax){
  1361.         cout << "gracz "<<this->name<<" uzyl zaklecia uzdrow siebie!\n";
  1362.         this->hp += skills1;
  1363.         if(this->hp > this->hpMax)this->hp=this->hpMax;
  1364.         }
  1365.  
  1366.         else if(this->hp >= this->hpMax)cout<<"Masz pelne zycie!\n";
  1367.         cout << "twoje hp: "<<this->hp<<endl;
  1368.         this->cooldownSkill=5;
  1369.         Sleep(3000);
  1370.         system("cls");
  1371.     }
  1372.  
  1373.  
  1374.     }else {cout << "Nie mozesz teraz uzywac skillow poczekaj jeszcze: "<<this->cooldownSkill<<" tury!"<<endl;Sleep(3000);system("cls");}
  1375.     Sleep(2500);
  1376. }
  1377.  
  1378. bool Mage::getBoolSkill(){
  1379.     return skill;
  1380. }
  1381.  
  1382. void Mage::setBoolSkills(bool b){
  1383.     skill = b;
  1384. }
  1385.  
  1386. int Mage::getSkillID(){
  1387.     return skillID;
  1388. }
  1389.  
  1390. void Mage::setSkillID(int s){
  1391.     skillID = s;
  1392. }
  1393.  
  1394. int Mage::getMaxHealth(){
  1395.     return hpMax;
  1396. }
  1397.  
  1398. void Mage::setType(string n){
  1399.     type=n;
  1400. }
  1401.  
  1402. void Mage::setAttack(int n){
  1403.     attack = n;
  1404. }
  1405.  
  1406. void Mage::setMaxHealth(int n){
  1407.     hpMax = n;
  1408. }
  1409.  
  1410. string Mage::getType(){
  1411.     return type;
  1412. }
  1413.  
  1414. void Mage::LogicEQ(string nazwa,int id){
  1415.     if(nazwa == "MalaMiksturaZycia"){
  1416.             string wybor;
  1417.             cout << "Informacje:\n";
  1418.             cout << "-----------------\n";
  1419.             cout << "Nazwa przedmiotu: "<<nazwa<<endl;
  1420.             cout << "Ilosc: " << this->Mikstura_01_ilosc<<endl;
  1421.             cout << "Leczy: 20 punktow zycia\n";
  1422.             cout << "-----------------\n";
  1423.             cout << "czy chcesz uzyc przedmiotu?\n";
  1424.             cout << "(tak/Tak) lub (nie/Nie)\n";
  1425.             cout << "Enter: ";
  1426.             cin >> wybor;
  1427.  
  1428.             if(!cin){cin.clear();cin.sync();system("cls");cout<<"Blad!\n";Sleep(2500);system("cls");return;}
  1429.  
  1430.             if(wybor == "tak" || wybor == "Tak"){
  1431.                 this->hp+=20;
  1432.                 this->Mikstura_01_ilosc--;
  1433.                 if(this->hp > this->hpMax){
  1434.                     system("cls");
  1435.                     cout << "Masz pelne zycie!\n";
  1436.                     this->hp=hpMax;
  1437.                     Sleep(3000);
  1438.                     system("cls");
  1439.                 }else if(this->hp <= this->hpMax) cout << "Uzyles przedmiotu!\n";
  1440.                 if(this->Mikstura_01_ilosc == 0){
  1441.                         EkwipunekG.erase(id);
  1442.                         this->iteruj--;
  1443.                 }
  1444.             }else return;
  1445.     }
  1446.     if(nazwa == "Rozdzka nowicjuszy"){
  1447.             system("cls");
  1448.             char wybor;
  1449.             cout << "Informacje:\n";
  1450.             cout << "-----------------\n";
  1451.             cout << "Nazwa przedmiotu: "<<this->nameWep1<<endl;
  1452.             cout << "atak: " << this->wepDmg<<endl;
  1453.             cout << "-----------------\n";
  1454.             cout << "0)wyjdz\n";
  1455.             cout << "1)zalozyc\n";
  1456.             cout << "2)zdjac\n";
  1457.             cout << "Enter: ";
  1458.             wybor=getch();
  1459.             if(wybor == '0'){
  1460.                     system("cls");return;
  1461.             }else if (wybor == '1'){
  1462.                     if(eqiuppedWep == false && EqWep == 0){
  1463.                         EqWep = eq1;
  1464.                         eqiuppedWep = true;
  1465.                         this->attack+=wepDmg;
  1466.                         cout << "Pomyslnie zalozyles bron!\n";
  1467.                         Sleep(3000);
  1468.                         system("cls");
  1469.                     }else {cout<<"Masz juz bron na siebie zalozona!\n";Sleep(3000);system("cls");}
  1470.             }
  1471.             else if(wybor == '2'){
  1472.                 if(eqiuppedWep == true && EqWep != 0){
  1473.                         if(EqWep == 1){
  1474.                             this->attack-=wepDmg;
  1475.                         }
  1476.                         EqWep = uneqiupped;
  1477.                         eqiuppedWep = false;
  1478.                         cout << "Pomyslnie zdjales bron!\n";
  1479.                         Sleep(3000);
  1480.                         system("cls");
  1481.                 }else {cout << "Nie masz zadnej broni zalozonej na siebie!\n";Sleep(3000);system("cls");return;}
  1482.             }else {cout << "prowadz poprawna opcje!\n";Sleep(3000);system("cls");return;}
  1483.     }
  1484. }
  1485.  
  1486. void Mage::SkillsInfo(){
  1487.  
  1488. };
  1489.  
  1490.  
  1491. Wolf::Wolf(int h,int hm,int a,int g,string n){
  1492.     hp=h;
  1493.     hpMax=hm;
  1494.     attack=a;
  1495.     gold=g;
  1496.     name=n;
  1497.     type="MlodyWilk";
  1498.     cooldownSkill=0;
  1499.     skill=false;
  1500.     skillID=-1;
  1501. }
  1502.  
  1503. void Wolf::showStats(){
  1504.     cout << "Nazwa: "<<name<<endl;
  1505.     cout << "Zycie: "<<hp<<"/"<<hpMax<<endl;
  1506.     cout << "atak: "<<attack<<endl;
  1507.     cout << "Klasa: "<<type<<endl;
  1508.     cout<<endl;
  1509. }
  1510.  
  1511. int Wolf::getHealth(){
  1512.     return hp;
  1513. }
  1514.  
  1515. void Wolf::setHealth(int n){
  1516.     hp=n;
  1517. }
  1518.  
  1519. int Wolf::getAttack(){
  1520.     return attack;
  1521. }
  1522.  
  1523. int Wolf::getGold(){
  1524.     return gold;
  1525. }
  1526. void Wolf::setGold(int n){
  1527.     gold=n;
  1528. }
  1529.  
  1530. string Wolf::getType(){
  1531.     return type;
  1532. }
  1533.  
  1534.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement