I’m getting an ‘unidentified reference’ error in C++ that I can’t seem to find the solution to. Please help. I’m not using any virtual functions

When running my code, I keep getting the following errors:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>AppData\Local\Temp\ccemqO2g.o:main.cpp:(.rdata$.refptr.game[.refptr.game]+0x0): undefined reference to `game' `
`AppDataLocalTempccemqO2g.o:main.cpp:(.rdata$.refptr.hero[.refptr.hero]+0x0): undefined reference to `hero'
</code>
<code>AppData\Local\Temp\ccemqO2g.o:main.cpp:(.rdata$.refptr.game[.refptr.game]+0x0): undefined reference to `game' ` `AppDataLocalTempccemqO2g.o:main.cpp:(.rdata$.refptr.hero[.refptr.hero]+0x0): undefined reference to `hero' </code>
AppData\Local\Temp\ccemqO2g.o:main.cpp:(.rdata$.refptr.game[.refptr.game]+0x0): undefined reference to `game' `  
`AppDataLocalTempccemqO2g.o:main.cpp:(.rdata$.refptr.hero[.refptr.hero]+0x0): undefined reference to `hero'

compiler is g++

hero is a base class for 3 others that only really use a slightly modified constructor that changes only the values of the class and is also inheriting fron entity, which has less arguments

here’s the header file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include "Entity.h"
#pragma once
class Hero : public Entity {
public:
int xp;
int lvl;
int cd;
bool clericcheck;
Hero(int HP, int Damage);
void heal(int &potion_count);
void level_up();
};
</code>
<code>#include "Entity.h" #pragma once class Hero : public Entity { public: int xp; int lvl; int cd; bool clericcheck; Hero(int HP, int Damage); void heal(int &potion_count); void level_up(); }; </code>
#include "Entity.h"
#pragma once
class Hero : public Entity {
public:
    int xp;
    int lvl;
    int cd;
    bool clericcheck;

    Hero(int HP, int Damage);
    void heal(int &potion_count);
    void level_up();
};

.cpp file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include "Hero.h"
#include <iostream>
#pragma once
Hero::Hero(int HP, int Damage) : Entity(1000, 100), xp(0), lvl(0), cd(0), clericcheck(false) {}
void Hero::heal(int &potion_count) {
if (!clericcheck) {
if (potion_count > 0) {
HP += 400 + (20 * lvl);
potion_count -= 1;
std::cout << "Ez jól esett! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat. Még " << potion_count << " adag maradt." << std::endl;
} else {
std::cout << "Ez üres! - Kifogytál az életerő italból." << std::endl;
}
} else {
if (cd == 0) {
HP += 400 + (20 * lvl);
std::cout << "SZENTELT FÉNY! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat." << std::endl;
cd += 2;
} else {
std::cout << "Még túl fáradt vagyok hozzá. - Töltési időből hátravan még: " << cd << " kör." << std::endl;
}
}
}
void Hero::level_up() {
xp -= 1000 + (100 * lvl);
lvl += 1;
HP += int(1000 + 100 * lvl);
Damage += int((5 / Damage) * lvl);
std::cout << "Szintet léptél. n" << std::endl;
}
</code>
<code>#include "Hero.h" #include <iostream> #pragma once Hero::Hero(int HP, int Damage) : Entity(1000, 100), xp(0), lvl(0), cd(0), clericcheck(false) {} void Hero::heal(int &potion_count) { if (!clericcheck) { if (potion_count > 0) { HP += 400 + (20 * lvl); potion_count -= 1; std::cout << "Ez jól esett! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat. Még " << potion_count << " adag maradt." << std::endl; } else { std::cout << "Ez üres! - Kifogytál az életerő italból." << std::endl; } } else { if (cd == 0) { HP += 400 + (20 * lvl); std::cout << "SZENTELT FÉNY! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat." << std::endl; cd += 2; } else { std::cout << "Még túl fáradt vagyok hozzá. - Töltési időből hátravan még: " << cd << " kör." << std::endl; } } } void Hero::level_up() { xp -= 1000 + (100 * lvl); lvl += 1; HP += int(1000 + 100 * lvl); Damage += int((5 / Damage) * lvl); std::cout << "Szintet léptél. n" << std::endl; } </code>
#include "Hero.h"
#include <iostream>
#pragma once

Hero::Hero(int HP, int Damage) : Entity(1000, 100), xp(0), lvl(0), cd(0), clericcheck(false) {}

void Hero::heal(int &potion_count) {
    if (!clericcheck) {
        if (potion_count > 0) {
            HP += 400 + (20 * lvl);
            potion_count -= 1;
            std::cout << "Ez jól esett! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat. Még " << potion_count << " adag maradt." << std::endl;
        } else {
            std::cout << "Ez üres! - Kifogytál az életerő italból." << std::endl;
        }
    } else {
        if (cd == 0) {
            HP += 400 + (20 * lvl);
            std::cout << "SZENTELT FÉNY! - " << 400 + (20 * lvl) << " életponttal tovább bírod a fájdalmat." << std::endl;
            cd += 2;
        } else {
            std::cout << "Még túl fáradt vagyok hozzá. - Töltési időből hátravan még: " << cd << " kör." << std::endl;
        }
    }
}

void Hero::level_up() {
    xp -= 1000 + (100 * lvl);
    lvl += 1;
    HP += int(1000 + 100 * lvl);
    Damage += int((5 / Damage) * lvl);
    std::cout << "Szintet léptél. n" << std::endl;
}

here’s the game’s header file (inventory is not implemented properly yet):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include "Hero.cpp"
#include "Enemy.cpp"
//#include "Inventory.h"
#pragma once
class Game {
private:
int turn_counter;
bool easycheck;
bool mediumcheck;
bool hardcheck;
bool firstcheck;
bool Dshield_check;
bool boss1check;
bool boss2check;
bool boss3check;
int hulyementes;
std::string kiiras;
char choice;
public:
bool crown_check;
//Inventory inventory;
Hero hero;
Enemy enemy;
Game();
void menu();
void diff();
void gameplay(int difficulty);
void endgame(int difficulty);
};
</code>
<code>#include "Hero.cpp" #include "Enemy.cpp" //#include "Inventory.h" #pragma once class Game { private: int turn_counter; bool easycheck; bool mediumcheck; bool hardcheck; bool firstcheck; bool Dshield_check; bool boss1check; bool boss2check; bool boss3check; int hulyementes; std::string kiiras; char choice; public: bool crown_check; //Inventory inventory; Hero hero; Enemy enemy; Game(); void menu(); void diff(); void gameplay(int difficulty); void endgame(int difficulty); }; </code>
#include "Hero.cpp"
#include "Enemy.cpp"
//#include "Inventory.h"
#pragma once
class Game {
private:
    int turn_counter;
    bool easycheck;
    bool mediumcheck;
    bool hardcheck;
    bool firstcheck;
    bool Dshield_check;
    bool boss1check;
    bool boss2check;
    bool boss3check;
    int hulyementes;
    std::string kiiras;
    char choice;
public:
    bool crown_check;

    //Inventory inventory;
    Hero hero;
    Enemy enemy;

    Game();
    void menu();
    void diff();
    void gameplay(int difficulty);
    void endgame(int difficulty);
};

game.cpp:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include "Game.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include "Enemy.cpp"
#include "Hero.cpp"
#include "Inventory.cpp"
#include "Entity.cpp"
#include "Warrior.cpp"
#include "Ranger.cpp"
#include "Cleric.cpp"
using namespace std;
Game::Game() : turn_counter(0), enemy(1000, 100), easycheck(false), mediumcheck(false), hardcheck(false),
firstcheck(true), Dshield_check(false), crown_check(false), boss1check(false), boss2check(false), boss3check(false),
hulyementes(0), hero(1000,100), kiiras("Melyik szörnyet kéne megtámadni? (M --> menekulés, 1 --> könnyű, 2 --> közepes, 3 --> nehéz) ") {}
void Game::menu() {
cout << "Üdvözöllek ebben az RPG-ben! Kérlek válaszd ki hősödet!" << endl;
int valasztas = 0;
while (valasztas == 0) {
while (this->hulyementes == 0) {
cout << "1 --> warrior, az örjöngő öldöklő; 2 --> cleric, az ordító gyógyító; 3 --> ranger, a fejlövő cselszövő): ";
std::cin >> this->choice;
if (this->choice == '1' || this->choice == '2' || this->choice == '3') {
this->hulyementes++;
} else {
cout << "Normálisat válassz!" << endl;
}
}
if (this->choice == 1) {
this->hero = Warrior(1000, 100);
valasztas++;
} else if (this->choice == 2) {
this->hero = Cleric(1000, 100);
valasztas++;
} else if (this->choice == 3) {
this->hero = Ranger(1000,100);
valasztas++;
} else {
cout << "Ha azt mondom, hogy 1, 2, vagy 3, akkor nincs itt más választásod!" << endl;
}
this->diff();
}
}
void Game::diff() {
char difficulty;
this->hulyementes = 0;
while (this->hulyementes == 0) {
cout << this->kiiras;
std::cin >> difficulty;
if (difficulty == '1' || difficulty == '2'|| difficulty == '3') {
this->hulyementes++;
} else if (difficulty == '4' || difficulty == '5' || difficulty == '6') {
if (!this->firstcheck) {
this->hulyementes++;
} else {
cout << "Ez a szint még nem elérhető." << endl;
}
} else if (difficulty == 'm' || difficulty == 'M') {
this->hulyementes++;
cout << "Bátor Sir Robin bátran elfutott." << endl;
exit(0);
} else {
cout << "Normálisat válassz!" << endl;
}
};
this->gameplay(difficulty);
}
void Game::gameplay(int difficulty) {
//if (inventory.sisak == "Összetört királyné koronája") {
// this->crown_check = true;
//}
switch (difficulty) {
case 1:
this->enemy = EnemyEasy(1000, 100);
break;
case 2:
this->enemy = EnemyNormal(1000, 100);
break;
case 3:
this->enemy = EnemyHard(1000, 100);
break;
case 4:
this->enemy = Boss(1000, 100, "A vérszomjas");
break;
case 5:
this->enemy = Boss(1000, 100, "Doran pajzsa");
break;
case 6:
this->enemy = Boss(1000, 100, "Tuskevért");
break;
default:
cout << "Ez a szint még nem elérhető." << endl;
return;
}
this->hulyementes = 0;
while (this->hero.HP > 0 && this->enemy.HP > 0) {
while (this->hulyementes == 0) {
cout << "A hős életereje: " << int(this->hero.HP) << " , A boss életereje: " << int(this->enemy.HP) << endl;
cout << "1 = támadás, 2 = heal: ";
char move;
std::cin >> move;
if (move == '1') {
this->enemy -= this->hero;
this->hero -= this->enemy;
this->turn_counter++;
} else if (move == '2') {
//this->hero.heal(inventory.potion_count);
this->turn_counter++;
} else {
cout << "Ez nem egy lehetséges tett." << endl;
}
if (this->hero.HP <= 0 || this->enemy.HP <= 0) {
this->hulyementes++;
}
}
this->hulyementes = 0;
}
this->endgame(difficulty);
}
void Game::endgame(int difficulty) {
srand(time(0));
if (this->hero.HP > 0) {
int poti_rng = 1;
int loot_rng = rand() % 4 + 1;
cout << "n n n n Gratulálok, legyőzted a szörnyet! jutalmad: n" << endl;
this->hero.xp += 150 + (250 * difficulty);
this->kiiras += std::to_string(150 + (250 * difficulty)) + " xp n";
if (this->Dshield_check) {
this->hero.HP += this->hero.HP * 0.1;
}
if (poti_rng == 1) {
if (this->hero.clericcheck) {
this->hero.xp += 100;
this->kiiras += "Az életerő ital felesleges számodra, a fény által kaptál 100 xp-t. n";
} else {
//inventory.potion_count++;
this->kiiras += "1 Potion n";
}
}
/*if (loot_rng == 1) {
int rarity_rng = rand() % 101;
if (15 > rarity_rng >= 0) {
loot.get(rand() % 4, 2);
this->kiiras += "1 epic item n";
} else if (40 > rarity_rng >= 15) {
loot.get(rand() % 4, 1);
this->kiiras += "1 rare item n";
} else if (100 > rarity_rng > 40) {
loot.get(rand() % 4, 0);
this->kiiras += "1 common item n";
}*/
//}
cout << this->kiiras << endl;
if (difficulty == 1) {
this->easycheck = true;
} else if (difficulty == 2) {
this->mediumcheck = true;
} else if (difficulty == 3) {
this->hardcheck = true;
} else if (difficulty == 4) {
cout << "Gratulálok! Legyőzted Kardos Karcsit!" << endl;
//if (!this->boss1check) {
//loot.get(0, 3);
//} else
{
this->hero.xp += 1000 + (100 * this->hero.lvl);
}
} else if (difficulty == 5) {
cout << "Gratulálok! Legyőzted Pajzsos Palit!" << endl;
//if (!this->boss2check) {
//loot.get(1, 3);
//} else
{
this->hero.xp += 1000 + (100 * this->hero.lvl);
}
} else if (difficulty == 6) {
cout << "Gratulálok! Legyőzted Páncélos Pált!" << endl;
//if (!this->boss3check) {
// loot.get(2, 3);
//} else
{
this->hero.xp += 1000 + (100 * this->hero.lvl);
}
}
if (this->hero.xp >= 1000 + (100 * this->hero.lvl)) {
this->hero.level_up();
}
if (this->easycheck && this->mediumcheck && this->hardcheck && this->firstcheck) {
//loot.get(3, 3);
this->firstcheck = false;
this->kiiras += "nbossok: Kardos Karcsi (4), Pajzsos Pali (5), Páncálos Pál (6)";
}
//inventory.inventory_management();
this->diff();
} else if (this->crown_check) {
cout << "FELTÁMADTAM!" << endl;
this->hero.HP += int(1000 + (100 * this->hero.lvl));
if (this->hero.lvl > 1) {
this->diff();
this->hero.lvl--;
} else {
cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl;
exit(0);
}
} else {
cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl;
exit(0);
}
}
</code>
<code>#include "Game.h" #include <cstdlib> #include <ctime> #include <iostream> #include "Enemy.cpp" #include "Hero.cpp" #include "Inventory.cpp" #include "Entity.cpp" #include "Warrior.cpp" #include "Ranger.cpp" #include "Cleric.cpp" using namespace std; Game::Game() : turn_counter(0), enemy(1000, 100), easycheck(false), mediumcheck(false), hardcheck(false), firstcheck(true), Dshield_check(false), crown_check(false), boss1check(false), boss2check(false), boss3check(false), hulyementes(0), hero(1000,100), kiiras("Melyik szörnyet kéne megtámadni? (M --> menekulés, 1 --> könnyű, 2 --> közepes, 3 --> nehéz) ") {} void Game::menu() { cout << "Üdvözöllek ebben az RPG-ben! Kérlek válaszd ki hősödet!" << endl; int valasztas = 0; while (valasztas == 0) { while (this->hulyementes == 0) { cout << "1 --> warrior, az örjöngő öldöklő; 2 --> cleric, az ordító gyógyító; 3 --> ranger, a fejlövő cselszövő): "; std::cin >> this->choice; if (this->choice == '1' || this->choice == '2' || this->choice == '3') { this->hulyementes++; } else { cout << "Normálisat válassz!" << endl; } } if (this->choice == 1) { this->hero = Warrior(1000, 100); valasztas++; } else if (this->choice == 2) { this->hero = Cleric(1000, 100); valasztas++; } else if (this->choice == 3) { this->hero = Ranger(1000,100); valasztas++; } else { cout << "Ha azt mondom, hogy 1, 2, vagy 3, akkor nincs itt más választásod!" << endl; } this->diff(); } } void Game::diff() { char difficulty; this->hulyementes = 0; while (this->hulyementes == 0) { cout << this->kiiras; std::cin >> difficulty; if (difficulty == '1' || difficulty == '2'|| difficulty == '3') { this->hulyementes++; } else if (difficulty == '4' || difficulty == '5' || difficulty == '6') { if (!this->firstcheck) { this->hulyementes++; } else { cout << "Ez a szint még nem elérhető." << endl; } } else if (difficulty == 'm' || difficulty == 'M') { this->hulyementes++; cout << "Bátor Sir Robin bátran elfutott." << endl; exit(0); } else { cout << "Normálisat válassz!" << endl; } }; this->gameplay(difficulty); } void Game::gameplay(int difficulty) { //if (inventory.sisak == "Összetört királyné koronája") { // this->crown_check = true; //} switch (difficulty) { case 1: this->enemy = EnemyEasy(1000, 100); break; case 2: this->enemy = EnemyNormal(1000, 100); break; case 3: this->enemy = EnemyHard(1000, 100); break; case 4: this->enemy = Boss(1000, 100, "A vérszomjas"); break; case 5: this->enemy = Boss(1000, 100, "Doran pajzsa"); break; case 6: this->enemy = Boss(1000, 100, "Tuskevért"); break; default: cout << "Ez a szint még nem elérhető." << endl; return; } this->hulyementes = 0; while (this->hero.HP > 0 && this->enemy.HP > 0) { while (this->hulyementes == 0) { cout << "A hős életereje: " << int(this->hero.HP) << " , A boss életereje: " << int(this->enemy.HP) << endl; cout << "1 = támadás, 2 = heal: "; char move; std::cin >> move; if (move == '1') { this->enemy -= this->hero; this->hero -= this->enemy; this->turn_counter++; } else if (move == '2') { //this->hero.heal(inventory.potion_count); this->turn_counter++; } else { cout << "Ez nem egy lehetséges tett." << endl; } if (this->hero.HP <= 0 || this->enemy.HP <= 0) { this->hulyementes++; } } this->hulyementes = 0; } this->endgame(difficulty); } void Game::endgame(int difficulty) { srand(time(0)); if (this->hero.HP > 0) { int poti_rng = 1; int loot_rng = rand() % 4 + 1; cout << "n n n n Gratulálok, legyőzted a szörnyet! jutalmad: n" << endl; this->hero.xp += 150 + (250 * difficulty); this->kiiras += std::to_string(150 + (250 * difficulty)) + " xp n"; if (this->Dshield_check) { this->hero.HP += this->hero.HP * 0.1; } if (poti_rng == 1) { if (this->hero.clericcheck) { this->hero.xp += 100; this->kiiras += "Az életerő ital felesleges számodra, a fény által kaptál 100 xp-t. n"; } else { //inventory.potion_count++; this->kiiras += "1 Potion n"; } } /*if (loot_rng == 1) { int rarity_rng = rand() % 101; if (15 > rarity_rng >= 0) { loot.get(rand() % 4, 2); this->kiiras += "1 epic item n"; } else if (40 > rarity_rng >= 15) { loot.get(rand() % 4, 1); this->kiiras += "1 rare item n"; } else if (100 > rarity_rng > 40) { loot.get(rand() % 4, 0); this->kiiras += "1 common item n"; }*/ //} cout << this->kiiras << endl; if (difficulty == 1) { this->easycheck = true; } else if (difficulty == 2) { this->mediumcheck = true; } else if (difficulty == 3) { this->hardcheck = true; } else if (difficulty == 4) { cout << "Gratulálok! Legyőzted Kardos Karcsit!" << endl; //if (!this->boss1check) { //loot.get(0, 3); //} else { this->hero.xp += 1000 + (100 * this->hero.lvl); } } else if (difficulty == 5) { cout << "Gratulálok! Legyőzted Pajzsos Palit!" << endl; //if (!this->boss2check) { //loot.get(1, 3); //} else { this->hero.xp += 1000 + (100 * this->hero.lvl); } } else if (difficulty == 6) { cout << "Gratulálok! Legyőzted Páncélos Pált!" << endl; //if (!this->boss3check) { // loot.get(2, 3); //} else { this->hero.xp += 1000 + (100 * this->hero.lvl); } } if (this->hero.xp >= 1000 + (100 * this->hero.lvl)) { this->hero.level_up(); } if (this->easycheck && this->mediumcheck && this->hardcheck && this->firstcheck) { //loot.get(3, 3); this->firstcheck = false; this->kiiras += "nbossok: Kardos Karcsi (4), Pajzsos Pali (5), Páncálos Pál (6)"; } //inventory.inventory_management(); this->diff(); } else if (this->crown_check) { cout << "FELTÁMADTAM!" << endl; this->hero.HP += int(1000 + (100 * this->hero.lvl)); if (this->hero.lvl > 1) { this->diff(); this->hero.lvl--; } else { cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl; exit(0); } } else { cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl; exit(0); } } </code>
#include "Game.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include "Enemy.cpp"
#include "Hero.cpp"
#include "Inventory.cpp"
#include "Entity.cpp"
#include "Warrior.cpp"
#include "Ranger.cpp"
#include "Cleric.cpp"

using namespace std;

Game::Game() : turn_counter(0), enemy(1000, 100), easycheck(false), mediumcheck(false), hardcheck(false),
               firstcheck(true), Dshield_check(false), crown_check(false), boss1check(false), boss2check(false), boss3check(false),
               hulyementes(0), hero(1000,100), kiiras("Melyik szörnyet kéne megtámadni? (M --> menekulés, 1 --> könnyű, 2 --> közepes, 3 --> nehéz) ") {}

void Game::menu() {
    cout << "Üdvözöllek ebben az RPG-ben! Kérlek válaszd ki hősödet!" << endl;
    int valasztas = 0;
    while (valasztas == 0) {
        while (this->hulyementes == 0) {
            cout << "1 --> warrior, az örjöngő öldöklő; 2 --> cleric, az ordító gyógyító; 3 --> ranger, a fejlövő cselszövő): ";
            std::cin >> this->choice;
            if (this->choice == '1' || this->choice == '2' || this->choice == '3') {
                this->hulyementes++;
            } else {
                cout << "Normálisat válassz!" << endl;
            }
        }
        
        if (this->choice == 1) {
            this->hero = Warrior(1000, 100);
            valasztas++;
        } else if (this->choice == 2) {
            this->hero = Cleric(1000, 100);
            valasztas++;
        } else if (this->choice == 3) {
            this->hero = Ranger(1000,100);
            valasztas++;
        } else {
            cout << "Ha azt mondom, hogy 1, 2, vagy 3, akkor nincs itt más választásod!" << endl;
        }
        this->diff();
    }
}

void Game::diff() {
    char difficulty;
    this->hulyementes = 0;
    while (this->hulyementes == 0) {
        cout << this->kiiras;
        std::cin >> difficulty;
        if (difficulty == '1' || difficulty == '2'|| difficulty == '3') {
            this->hulyementes++;
        } else if (difficulty == '4' || difficulty == '5' || difficulty == '6') {
            if (!this->firstcheck) {
                this->hulyementes++;
            } else {
                cout << "Ez a szint még nem elérhető." << endl;
            }
        } else if (difficulty == 'm' || difficulty == 'M') {
            this->hulyementes++;
            cout << "Bátor Sir Robin bátran elfutott." << endl;
            exit(0);
        } else {
            cout << "Normálisat válassz!" << endl;
        }
    };
    this->gameplay(difficulty);
}

void Game::gameplay(int difficulty) {
    //if (inventory.sisak == "Összetört királyné koronája") {
    //    this->crown_check = true;
    //}
    switch (difficulty) {
        case 1:
            this->enemy = EnemyEasy(1000, 100);
            break;
        case 2:
            this->enemy = EnemyNormal(1000, 100);
            break;
        case 3:
            this->enemy = EnemyHard(1000, 100);
            break;
        case 4:
            this->enemy = Boss(1000, 100, "A vérszomjas");
            break;
        case 5:
            this->enemy = Boss(1000, 100, "Doran pajzsa");
            break;
        case 6:
            this->enemy = Boss(1000, 100, "Tuskevért");
            break;
        default:
            cout << "Ez a szint még nem elérhető." << endl;
            return;
    }
    this->hulyementes = 0;
    while (this->hero.HP > 0 && this->enemy.HP > 0) {
        while (this->hulyementes == 0) {
            cout << "A hős életereje: " << int(this->hero.HP) << " , A boss életereje: " << int(this->enemy.HP) << endl;
            cout << "1 = támadás, 2 = heal: ";
            char move;
            std::cin >> move;
            if (move == '1') {
                this->enemy -= this->hero;
                this->hero -= this->enemy;
                this->turn_counter++;
            } else if (move == '2') {
                //this->hero.heal(inventory.potion_count);
                this->turn_counter++;
            } else {
                cout << "Ez nem egy lehetséges tett." << endl;
            }
            if (this->hero.HP <= 0 || this->enemy.HP <= 0) {
                this->hulyementes++;
            }
        }
        this->hulyementes = 0;
    }
    this->endgame(difficulty);
}

void Game::endgame(int difficulty) {
    srand(time(0));
    if (this->hero.HP > 0) {
        int poti_rng = 1;
        int loot_rng = rand() % 4 + 1;
        cout << "n n n n Gratulálok, legyőzted a szörnyet! jutalmad: n" << endl;
        this->hero.xp += 150 + (250 * difficulty);
        this->kiiras += std::to_string(150 + (250 * difficulty)) + " xp n";
        if (this->Dshield_check) {
            this->hero.HP += this->hero.HP * 0.1;
        }
        if (poti_rng == 1) {
            if (this->hero.clericcheck) {
                this->hero.xp += 100;
                this->kiiras += "Az életerő ital felesleges számodra, a fény által kaptál 100 xp-t. n";
            } else {
                //inventory.potion_count++;
                this->kiiras += "1 Potion n";
            }
        }
        /*if (loot_rng == 1) {
            int rarity_rng = rand() % 101;
            if (15 > rarity_rng >= 0) {
                loot.get(rand() % 4, 2);
                this->kiiras += "1 epic item n";
            } else if (40 > rarity_rng >= 15) {
                loot.get(rand() % 4, 1);
                this->kiiras += "1 rare item n";
            } else if (100 > rarity_rng > 40) {
                loot.get(rand() % 4, 0);
                this->kiiras += "1 common item n";
            }*/
        //}
        cout << this->kiiras << endl;
        if (difficulty == 1) {
            this->easycheck = true;
        } else if (difficulty == 2) {
            this->mediumcheck = true;
        } else if (difficulty == 3) {
            this->hardcheck = true;
        } else if (difficulty == 4) {
            cout << "Gratulálok! Legyőzted Kardos Karcsit!" << endl;
            //if (!this->boss1check) {
                //loot.get(0, 3);
            //} else 
            {
                this->hero.xp += 1000 + (100 * this->hero.lvl);
            }
        } else if (difficulty == 5) {
            cout << "Gratulálok! Legyőzted Pajzsos Palit!" << endl;
            //if (!this->boss2check) {
                //loot.get(1, 3);
            //} else 
            {
                this->hero.xp += 1000 + (100 * this->hero.lvl);
            }
        } else if (difficulty == 6) {
            cout << "Gratulálok! Legyőzted Páncélos Pált!" << endl;
            //if (!this->boss3check) {
            //    loot.get(2, 3);
            //} else 
            {
                this->hero.xp += 1000 + (100 * this->hero.lvl);
            }
        }
        if (this->hero.xp >= 1000 + (100 * this->hero.lvl)) {
            this->hero.level_up();
        }
        if (this->easycheck && this->mediumcheck && this->hardcheck && this->firstcheck) {
            //loot.get(3, 3);
            this->firstcheck = false;
            this->kiiras += "nbossok: Kardos Karcsi (4), Pajzsos Pali (5), Páncálos Pál (6)";
        }
        //inventory.inventory_management();
        this->diff();
    } else if (this->crown_check) {
        cout << "FELTÁMADTAM!" << endl;
        this->hero.HP += int(1000 + (100 * this->hero.lvl));
        if (this->hero.lvl > 1) {
            this->diff();
            this->hero.lvl--;
        } else {
            cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl;
            exit(0);
        }
    } else {
        cout << "A végzet még a legnagyobb hősöket is utoléri. n Kalandod Itt véget ért." << endl;
        exit(0);
    }
}

main.cpp:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include "Game.cpp"
int main() {
Game game;
game.menu();
return 0;
}
</code>
<code>#include "Game.cpp" int main() { Game game; game.menu(); return 0; } </code>
#include "Game.cpp"

int main() {
    Game game;
    game.menu();
    return 0;
}

I’ve tried mixing around the headers, looked at every instance of ‘hero’ being used and I can’t find anything.

New contributor

user25231738 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật