-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFunction.cpp
More file actions
85 lines (78 loc) · 3.06 KB
/
Copy pathMainFunction.cpp
File metadata and controls
85 lines (78 loc) · 3.06 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include "Header.h"
void MainFunction() {
//TESTING======================================= (For user : -> don't about this)
Character hero;
hero.RandomizeStats();
Weapon* weapon_1 = new Weapon();
weapon_1->RandomizeWeaponStart(hero.GetProfession());
Armory* armor_1 = new Armory();
armor_1->RandomizeArmorStart();
Weapon* weapon_2 = new Weapon();
weapon_2->RandomizeWeaponSpeacial();
MyInventory inv1;
inv1.SetOwner(&hero);
hero.SetInventory(&inv1);
inv1.AddItem(weapon_1);
inv1.AddItem(armor_1);
inv1.AddItem(weapon_2);
Potion* p = new Potion();
p->RandomizePotion();
inv1.AddItem(p);
//====================================================================
int mainChoice = 0;
while (true) {
std::cout << "\n=== MAIN MENU ===" << std::endl; //Main functions (*Main menu*)
std::cout << "1. Start game" << std::endl;
std::cout << "2. Show character stats" << std::endl;
std::cout << "3. Manage your Inventory" << std::endl;
std::cout << "4. Settings " << std::endl;
std::cout << "5. Help" << std::endl;
std::cout << "0. Exit" << std::endl;
std::cout << "Choice: ";
std::cin >> mainChoice;
if (mainChoice == 1) {
StartGame();
} else if (mainChoice == 2) {
hero.DisplayStats();
} else if (mainChoice == 3) {
std::cout << "1. Display inventory" << std::endl; //Sub-main functions act1
std::cout << "2. Show weapon status" << std::endl;
std::cout << "3. Equip weapon" << std::endl;
std::cout << "4. Unequip weapon" << std::endl;
std::cout << "5. Show armor stats" << std::endl;
std::cout << "6. Equip armor" << std::endl;
std::cout << "7. Unquip armor" << std::endl;
std::cout << "0. Back to main menu" << std::endl;
std::cout << "Choice: ";
std::cin >> mainChoice;
if (mainChoice == 1) {
inv1.DisplayInventory();
} else if (mainChoice == 2) {
weapon_1->ShowInfo();
} else if (mainChoice == 3) {
weapon_1->Use();
} else if (mainChoice == 4) {
weapon_1->Reset();
} else if (mainChoice == 5) {
armor_1->ShowInfo();
} else if (mainChoice == 6) {
armor_1->Use();
} else if (mainChoice == 7) {
armor_1->Reset();
} else if (mainChoice == 0) {
break;
} else {
std::cout << "Invalid choice!" << std::endl;
}
} else if (mainChoice == 4) {
Settings(hero , inv1);
} else if (mainChoice == 5) {
Help();
} else if (mainChoice == 0) {
break;
} else {
std::cout << "Invalid choice!" << std::endl;
}
}
}