-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFunction.cpp
More file actions
111 lines (98 loc) · 5.56 KB
/
Copy pathMainFunction.cpp
File metadata and controls
111 lines (98 loc) · 5.56 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#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();
Potion* potion = new Potion();
potion->RandomizePotion();
Artifact* artif = new Artifact(); //Adding artifact for test in inventory
artif->RandomizeArtifact();
MyInventory inv1;
inv1.SetOwner(&hero);
hero.SetInventory(&inv1);
inv1.AddItem(weapon_1); //Added item with ID ---- will be written
inv1.AddItem(armor_1);
inv1.AddItem(weapon_2);
inv1.AddItem(potion);
inv1.AddItem(artif);
potion->SetOwner(&hero);
artif->SetOwner(&hero);
Enemy enemy;
enemy.RandomizeStats();
//====================================================================
int mainChoice = 0;
while (true) {
std::cout << "\n┌───────────────────────────────────────────────────┐\n";
std::cout << "│ MAIN MENU │\n";
std::cout << "├───────────────────────────────────────────────────┤\n";
std::cout << "│ 1. Start game │\n";
std::cout << "│ 2. Manage game saves │\n";
std::cout << "│ 3. Show character stats │\n";
std::cout << "│ 4. Manage your Inventory │\n";
std::cout << "│ 5. Settings │\n";
std::cout << "│ 6. Help │\n";
std::cout << "│ 7. Report bug │\n";
std::cout << "│ 0. Exit │\n";
std::cout << "└───────────────────────────────────────────────────┘\n";
std::cout << "Choice: ";
std::cin >> mainChoice;
if (mainChoice == 1) {
StartGame(enemy, hero);
} else if (mainChoice == 2) {
ManageGameSaves(hero, inv1); //Load game //Save game
} else if (mainChoice == 3) {
hero.DisplayStats(); //Display stats
} else if (mainChoice == 4) {
std::cout << "\n┌───────────────────────────────────────────────────┐\n";
std::cout << "│ INVENTORY MANAGEMENT │\n";
std::cout << "├───────────────────────────────────────────────────┤\n";
std::cout << "│ 1. Display inventory │\n"; //Sub-main functions act1 (Manage inventory)
std::cout << "│ 2. Show weapon status │\n";
std::cout << "│ 3. Equip weapon │\n";
std::cout << "│ 4. Unequip weapon │\n";
std::cout << "│ 5. Show armor stats │\n";
std::cout << "│ 6. Equip armor │\n";
std::cout << "│ 7. Unequip armor │\n";
std::cout << "│ 0. Back to main menu │\n";
std::cout << "└───────────────────────────────────────────────────┘\n";
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 << "\n[!] Invalid choice!\n";
}
} else if (mainChoice == 5) {
Settings(hero , inv1, enemy); //Settings
} else if (mainChoice == 6) {
Help(); //Help
} else if (mainChoice == 7) {
BugReportFunction();
} else if (mainChoice == 0) {
break;
} else {
std::cout << "\n[!] Invalid choice!\n";
}
}
}