-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleApplication1.cpp
72 lines (66 loc) · 1.48 KB
/
ConsoleApplication1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Player.h"
#include "Skeleton.h"
#include "Equipment.h"
#include "ITEMS.h"
using std::cin;
using std::cout;
using std::endl;
void battle(Player& voite) {
int x;
Skeleton* enemy;
enemy = new Skeleton;
do {
system("CLS");
cout << "A Skeleton has appeared" << endl;
enemy->takeDamage(voite.attack());
if (enemy->active == false) {
voite.earnEXP(enemy->distEXP());
voite.lootEnemy(enemy->lootItem);
voite.getTotalEXP();
Skeleton::destroySkeleton(enemy);
break;
}
voite.takeDamage(enemy->enemyAttack());
x = -1;
cout << endl << "Battle Menu" << endl;
cout << "1. Attack!" << endl;
cout << "2. Run Away" << endl;
cin >> x;
if (x == 2) { break; }
} while (true);
}
int main()
{
int x = 0;
bool gameState = true;
int input;
Player voite;
while (gameState = true) {
cout << "---------------------------" << endl;
cout << "Main Menu" << endl;
cout << "1. Inventory" << endl;
cout << "2. Stats" << endl;
cout << "3. Battle Skeleton" << endl;
cout << "4. Exit Game" << endl;
cout << "---------------------------" << endl;
cin >> input;
system("CLS");
if (input == 1) {
voite.getInventory();
voite.inventoryMenu();
}
if (input == 2) {
voite.getStats();
}
if (input == 3) {
battle(voite);
}
if (input == 4) {
break;
}
}
return 0;
}