Last active
August 17, 2018 10:49
-
-
Save krutek/6d6fdbdf48e0652fae613e266ca677dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "Ekwipunek.h" | |
#include "Postac.h" | |
class Postac; | |
class Bron : | |
protected Ekwipunek | |
{ | |
public: | |
Bron(); | |
string NazwaBroni; | |
int WartoscAtakuBroni; | |
friend class Postac; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "VirtualGameObject.h" | |
#include "stdafx.h" | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
class Ekwipunek : | |
protected VirtualGameObject | |
{ | |
public: | |
Ekwipunek(); | |
virtual ~Ekwipunek(); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <iostream> | |
#include <string> | |
#include "VirtualGameObject.h" | |
#include "Postac.h" | |
#include "Wojownik.h" | |
#include "Mag.h" | |
#include "Miecz.h" | |
using namespace std; | |
void walka(Postac &wsk1, Postac &wsk2) | |
{ | |
int licznikTur = 1; | |
cout << "rozpoczyna sie walka miedzy : " << endl; | |
wsk1.Wyswietl(); | |
cout << " a jego przeciwnikiem : " << endl; | |
wsk2.Wyswietl(); | |
while ((wsk1.zdrowie > 0) && (wsk2.zdrowie > 0)) | |
{ | |
int ruch = 0; | |
cout << endl << endl; | |
if (wsk1.zdrowie > 0) | |
{ | |
cout << " TURA WALKI NUMER : " << licznikTur << endl; | |
cout << " ruch nalezy do : " << wsk1.imie << endl; | |
cout << "obecne parametry postaci : Punkty zycia -" << wsk1.zdrowie << " Obrazenia - " << wsk1.obrazenia << endl; | |
cout << "co chcesz zrobic? : 1-zwykly atak 2-umiejetnosc specjalna " << endl; | |
cin >> ruch; | |
switch (ruch) | |
{ | |
case 1: | |
cout << wsk2.imie << " zostaje zatakowany przez : " << wsk1.imie << endl; | |
wsk2.zdrowie = wsk2.zdrowie - wsk1.obrazenia; | |
break; | |
case 2: | |
cout << wsk1.imie << "uzywa umiejetnosci specjalnej! : " << endl; | |
wsk1.Skill1(); | |
wsk2.zdrowie = wsk2.zdrowie - wsk1.obrazenia; | |
break; | |
default: | |
cout << "TAKI Z CIEBIE SMIESZEK?! TO TRACISZ RUCH !!" << endl; | |
} | |
wsk2.Smierc(); | |
} | |
else | |
wsk1.Smierc(); | |
if (wsk2.zdrowie > 0) | |
{ | |
cout << endl << endl; | |
cout << " ruch nalezy do : " << wsk2.imie << endl; | |
cout << "obecne parametry postaci : Punkty zycia - " << wsk2.zdrowie << " Obrazenia - " << wsk2.obrazenia << endl; | |
cout << wsk1.imie << " zostaje zatakowany przez : " << wsk2.imie << endl; | |
wsk1.zdrowie = wsk1.zdrowie - wsk2.obrazenia; | |
cout << endl << endl; | |
wsk1.Smierc(); | |
} | |
else | |
wsk2.Smierc(); | |
licznikTur++; | |
}; | |
cout << "XHUJJJ0"; | |
}; | |
int main() | |
{ | |
Miecz Miecz1("inny miecz",25); | |
Miecz *MieczWsk1; | |
MieczWsk1 = &Miecz1; | |
Wojownik woj1("buba", 5, 200, 15, 15, 15, 15); | |
Wojownik *wsk1; | |
wsk1 = &woj1; | |
Wojownik woj2("adam",2,100,10,10,10,0); | |
Wojownik *wsk2; | |
wsk2 = &woj2; | |
walka(woj1,woj2); | |
system("pause"); | |
return 0; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "Miecz.h" | |
#include "Wojownik.h" | |
Miecz::Miecz(string NazwaBroni,int WartoscAtakuBroni) | |
{ | |
this->NazwaBroni = NazwaBroni; | |
this->WartoscAtakuBroni = WartoscAtakuBroni; | |
} | |
//int getAttackVal() const { return WartoscAtakuBroni; } | |
int const Miecz::getAttackVal() | |
{ | |
return WartoscAtakuBroni; | |
} | |
void Miecz::getAttackVal2() | |
{ | |
this->WartoscAtakuBroni = WartoscAtakuBroni; | |
} | |
void Miecz::PobierzNazwe() | |
{ | |
cin >> NazwaBroni; | |
} | |
void Miecz::PobierzWAB() | |
{ | |
cin >> WartoscAtakuBroni; | |
} | |
Miecz::~Miecz() | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "Bron.h" | |
#include "Postac.h" | |
class wojownik; | |
class Miecz : | |
public Bron | |
{ | |
public: | |
Miecz(string NazwaBroni="Szeroki Miecz", int WartoscAtakuBroni=15); | |
virtual ~Miecz(); | |
//int getAttackVal() const { return WartoscAtakuBroni; } | |
int const getAttackVal(); | |
void getAttackVal2(); | |
string NazwaBroni; | |
//int WartoscAtakuBroni; | |
friend class wojownik; | |
void PobierzNazwe(); | |
void PobierzWAB(); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "VirtualGameObject.h" | |
#include "Bron.h" | |
class Postac : | |
public VirtualGameObject | |
{ | |
protected: | |
string imie; | |
int lvl, zdrowie, sila, inteligencja, energia, exp, obrazenia; | |
public: | |
Postac(); | |
virtual ~Postac(); | |
virtual void Wyswietl() = 0; | |
virtual void Level() = 0; | |
virtual void GetExp() = 0; | |
virtual void PodniesZdrowie() = 0; | |
virtual void PodniesSile() = 0; | |
virtual void PodniesEnergie() = 0; | |
virtual void Nazwa() = 0; | |
virtual void Smierc() = 0; | |
virtual void SprawdzObrazenia() = 0; | |
virtual void Skill1() = 0; | |
virtual void Skill2() = 0; | |
virtual void Skill3() = 0; | |
virtual void FunkcjaAtaku() = 0; | |
friend void walka(Postac &wsk1, Postac &wsk2); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "stdafx.h" | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
class VirtualGameObject | |
{ | |
public: | |
VirtualGameObject(); | |
virtual ~VirtualGameObject(); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "Wojownik.h" | |
#include "Miecz.h" | |
class Miecz; | |
Wojownik::Wojownik(string imie, int lvl, int zdrowie, int energia, int sila, int obrazenia, int exp) :Postac() | |
{ | |
this->imie = imie; | |
this->lvl = lvl; | |
this->zdrowie = zdrowie; | |
this->energia = energia; | |
this->sila = sila; | |
this->exp = exp; | |
this->obrazenia = obrazenia; | |
} | |
Wojownik::~Wojownik() | |
{ | |
} | |
void Wojownik::Wyswietl() | |
{ | |
int AtakOdBroni = PobierzWartoscAtakuBroni(Miecz()); | |
SprawdzObrazenia(); | |
cout << "Parametry twojej postaci" << endl; | |
cout << "imie : " << imie << endl << "lvl : " << lvl << endl; | |
cout << "punkt zycia : " << zdrowie << endl << "punkt energi :" << energia << endl << | |
"sila : " << sila << endl << "atak od broni : "<<AtakOdBroni<<endl << "obrazenia w walce: " << obrazenia << endl; | |
cout << " Nastepny level za : " << exp << " punktow doswiadczenia " << endl; | |
} | |
void Wojownik::SprawdzObrazenia() | |
{ | |
int AtakOdBroni = PobierzWartoscAtakuBroni(Miecz()); | |
obrazenia = sila+AtakOdBroni; | |
} | |
void Wojownik::Level() | |
{ | |
if (exp >= 100) | |
{ | |
int punktyr = 5; | |
cout << "wlasnie awansowales na " << ++lvl << "level! " << endl; | |
cout << " Teraz mozesz podniesc swoje statystki : " << endl; | |
for (int i = 0; i <= 4; i++) | |
{ | |
int wyborparametru; | |
cout << " masz do dyspozycji :" << punktyr << " punktow do rozdania " << endl; | |
cout << "jaki parametr chcesz podniesc? : 1-hp, 2-energia, 3-sila, " << endl; | |
cin >> wyborparametru; | |
switch (wyborparametru) | |
{ | |
case 1: | |
PodniesZdrowie(); | |
break; | |
case 2: | |
PodniesEnergie(); | |
break; | |
case 3: | |
PodniesSile(); | |
break; | |
} | |
--punktyr; | |
} | |
exp = exp - 100; | |
Wyswietl(); | |
} | |
else | |
cout << "coraz blizej nowego poziomu!" << endl; | |
} | |
void Wojownik::GetExp() | |
{ | |
exp = exp + 20; | |
} | |
void Wojownik::PodniesZdrowie() | |
{ | |
zdrowie = zdrowie + 2; | |
} | |
void Wojownik::PodniesEnergie() | |
{ | |
energia = energia + 2; | |
} | |
void Wojownik::PodniesSile() | |
{ | |
sila = sila + 2; | |
} | |
void Wojownik::Skill1() | |
{ | |
if (energia >= 2) | |
{ | |
obrazenia = obrazenia + 10; | |
cout << " postac " << imie << " Szeroki zamach zadaje dodatkowe obrazenia! " << endl; | |
energia = energia - 2; | |
cout << imie << " zostaje energi : " << energia; | |
} | |
else | |
cout << "brakuje ci energi! tracisz ture ! " << endl; | |
} | |
/*void Wojownik::s1o() | |
{ | |
obrazenia = obrazenia - 10; | |
cout << "opadasz z sil" << obrazenia; | |
}*/ | |
void Wojownik::FunkcjaAtaku() | |
{ | |
zdrowie = zdrowie - obrazenia; | |
} | |
void Wojownik::Nazwa() | |
{ | |
cout << imie; | |
} | |
void Wojownik::Smierc() | |
{ | |
if (zdrowie <= 0) | |
{ | |
zdrowie = 0; | |
cout << imie << " ma punktow zycia : " << zdrowie << endl; | |
cout << imie << " UMIERA !" << endl; | |
} | |
} | |
void Wojownik::Skill2() | |
{ | |
} | |
void Wojownik::Skill3() | |
{ | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "Postac.h" | |
#include "Bron.h" | |
#include "Miecz.h" | |
class Miecz; | |
class Wojownik : | |
public Postac | |
{ | |
public: | |
int BronPierwszejPostaci; | |
Wojownik(string imie = "Andrzej", int lvl = 1, int zdrowie = 100, int energia = 10, int sila = 2, int obrazenia = 0, int exp = 0); | |
virtual ~Wojownik(); | |
// int BronPierwszejPostaci = Miecz.getAttackVal(); | |
int PobierzWartoscAtakuBroni(const Miecz& miecz) | |
{ | |
return miecz.WartoscAtakuBroni; | |
}; | |
virtual void Wyswietl(); | |
virtual void Level(); | |
virtual void GetExp(); | |
virtual void PodniesZdrowie(); | |
virtual void PodniesSile(); | |
virtual void PodniesEnergie(); | |
virtual void Nazwa(); | |
virtual void Smierc(); | |
virtual void SprawdzObrazenia(); | |
virtual void Skill1(); | |
virtual void Skill2(); | |
virtual void Skill3(); | |
virtual void FunkcjaAtaku(); | |
friend void walka(Postac &wsk1, Postac &wsk2); | |
friend class Bron; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment