-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFunction.cpp
More file actions
75 lines (66 loc) · 2.7 KB
/
Copy pathMainFunction.cpp
File metadata and controls
75 lines (66 loc) · 2.7 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
#include <iostream>
#include "Header.h"
//This file is for adding main functions that wiil start my programm
void MainFunction() {
Character hero;
hero.RandomizeStats();
hero.DisplayStats();
Weapon* weapon_1 = new Weapon();
Weapon* weapon_2 = new Weapon();
weapon_1->RandomizeWeaponStart(hero.GetProfession());
weapon_2->RandomizeWeaponStart(hero.GetProfession());
Armory* armor_1 = new Armory();
armor_1->RandomizeArmorStart(hero.GetProfession());
MyInventory inv1;
inv1.AddItem(weapon_1);
inv1.AddItem(weapon_2);
MyInventory inv2;
inv2.AddItem(armor_1);
int mainChoice = 0;
while (true) {
std::cout << "\n=== MAIN MENU ===" << std::endl;
std::cout << "1. Show character stats" << std::endl;
std::cout << "2. Show weapon inventory" << std::endl;
std::cout << "3. Manage weapon inventory" << std::endl;
std::cout << "4. Show armor inventory" << std::endl;
std::cout << "5. Equip first weapon" << std::endl;
std::cout << "6. Equip first armor" << std::endl;
std::cout << "7. Unequip weapon" << std::endl;
std::cout << "8. Unequip armor" << std::endl;
std::cout << "9. Show equipped stats" << std::endl;
std::cout << "0. Exit" << std::endl;
std::cout << "Choice: ";
std::cin >> mainChoice;
if (mainChoice == 1) {
hero.DisplayStats();
} else if (mainChoice == 2) {
inv1.DisplayInventory();
} else if (mainChoice == 3) {
inv1.InventoryFunctions(); // повертається сюди після виходу з інвентаря
} else if (mainChoice == 4) {
inv2.DisplayInventory();
} else if (mainChoice == 5) {
hero.EquipWeapon(weapon_1);
std::cout << "Weapon equipped! Total Attack: " << hero.GetTotalAttack() << std::endl;
} else if (mainChoice == 6) {
hero.EquipArmor(armor_1);
std::cout << "Armor equipped! Total Defense: " << hero.GetTotalDefense() << std::endl;
} else if (mainChoice == 7) {
hero.UnequipWeapon();
std::cout << "Weapon unequipped!" << std::endl;
} else if (mainChoice == 8) {
hero.UnequipArmor();
std::cout << "Armor unequipped!" << std::endl;
} else if (mainChoice == 9) {
std::cout << "Total Attack: " << hero.GetTotalAttack() << std::endl;
std::cout << "Total Defense: " << hero.GetTotalDefense() << std::endl;
} else if (mainChoice == 0) {
break;
} else {
std::cout << "Invalid choice!" << std::endl;
}
}
delete weapon_1;
delete weapon_2;
delete armor_1;
}