-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
113 lines (112 loc) · 4.29 KB
/
main.cpp
File metadata and controls
113 lines (112 loc) · 4.29 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
112
113
#include <iostream>
#include "gameUtil.h"
using namespace std;
int main() {
int playerSelection;
Hero** allyTeam;
cout << "Hello traveler! An epic adventure awaits!\n";
while(true){
cout << "Do you have allies? How many heroes are entering the dungeon? (Available:1-3)\n";
cout << "Insert selection:";
cin >> playerSelection;
cout << "----------------------------------\n";
if (playerSelection >=1 and playerSelection <=3){
break;
}
else{
cout << "Invalid input.\n";
}
}
switch (playerSelection) {
case 1:
cout << "So you are entering alone. How brave of you!\n";
allyTeam = new Hero*[1];
allyTeam[0] = heroSelection();
break;
case 2:
cout << "I see you have some company. Good luck!\n";
allyTeam = new Hero*[2];
allyTeam[0] = heroSelection();
allyTeam[1] = heroSelection();
break;
case 3:
cout << "Entering with maximum force. Wise choice!\n";
allyTeam = new Hero*[3];
allyTeam[0] = heroSelection();
allyTeam[1] = heroSelection();
allyTeam[2] = heroSelection();
break;
}
gameMap* map = new gameMap(playerSelection,allyTeam);
map->generateMap();
cout << "Map generated. The game now begins! Prepare yourself for an exciting adventure.\n";
cout << "You entered the dungeon. Be aware. Each movement might end up with a fight.\n";
bool exit = false;
int selection;
int charSelection;
while (!exit){
cout << "What's your next move?\n";
cout << "Options: 1)Inspect characters. 2)Display Map. 3)Move a square. 4)Check equipment. 5)Quit game.\n";
cout << "Make your selection:";
cin >> selection;
cout << "----------------------------------\n";
switch (selection) {
case 1:
map->displayHeroStats();
break;
case 2:
map->displayMap();
break;
case 3:
map->playerMove();
break;
case 4:
map->displayHeroInventory();
cout << "Would you like to swap gear or use a potion?\n";
cout << "1.Swap Weapon.\n2.Swap Armor.\n3.Use a Potion.\n4.Cancel Selection.\n";
cout << "Input your selection:";
cin >> selection;
cout << "----------------------------------\n";
if (selection<=3 and selection >=1){
if (playerSelection == 1){
charSelection = 1;
}
else {
cout << "Your team consists of " << playerSelection << " Heroes.\n[";
for (int i=0;i<playerSelection;i++){
cout << i+1 << "." << allyTeam[i]->getName() << ", ";
}
cout << "]\n";
cout << "Select a hero by its number to initiate the action:";
cin >> charSelection;
cout << "----------------------------------\n";
}
if (charSelection <= playerSelection){
if (selection == 1){
allyTeam[charSelection - 1]->swapWeapon();
}
else if (selection == 2){
allyTeam[charSelection - 1]->swapArmor();
}
else if (selection == 3){
allyTeam[charSelection - 1]->usePotion();
}
else {
cout << "Option Cancelled.\n";
}
}
else {
cout << "Invalid Input. Option Cancelled.\n";
}
}
break;
case 5:
exit = true;
cout << "I guess not everyone is cut out for adventures. Thanks for playing. Goodbye~\n";
break;
default:
cout << "Sorry. This is not a valid option.\n";
}
}
return 0;
}