-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEndlessQuest.cpp
More file actions
231 lines (203 loc) · 8.34 KB
/
Copy pathEndlessQuest.cpp
File metadata and controls
231 lines (203 loc) · 8.34 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/************************************************************************
* Endless Quest, v1.0.1-IP
* (please refer to release notes for further details)
**************************************************************************/
#include<iostream>
#include<fstream>
#include "start.cpp"
using namespace std;
//--
extern int yn(), chartoint();
extern int inventoryCheck();
extern int inventoryCheckName(string item);
extern void inventoryArrange();
extern int initiateBattles();
extern int saveLoc;
extern int itemUse(string Item);
extern Protag mainchar;
//--
//misc functions
//--
int yn() {
char yven;
cout<<"(insert 'y' for yes or 'n' for no)"<<endl;
cin>>yven;
if(yven=='y')
return 1;
if(yven=='n')
return 0;
else {
cout<<"Invalid choice."<<endl;
yn();
}
}
int chartoint() {
string ch;
cin>>ch;
return ch[0]-'0';
}
string checkClass(string charClass) {
if(charClass == "w" || charClass == "W" || charClass == "warrior" || charClass == "Warrior")
return "w";
if(charClass == "m" || charClass == "M" || charClass == "mage" || charClass == "Mage")
return "m";
if(charClass == "r" || charClass == "R" || charClass == "rogue" || charClass == "Rogue")
return "r";
return "\0";
}
//--
void Intro() {
cout<<"The Alliance of Exenta spans the entire continent, each kingdom an uneasy member of this coalition and all governed by a neutral establishment known as the Stage of Communion. Though each kingdom has its own culture and tales, together they sing many a glorious tales of heroes from an age long past. Such a beautiful time is known as the Age of Peace in history."<<endl;
cout<<"Now, with the death of Averr, the patron divine of the continent, historians have named the time to come as the Age of Darkness."<<endl;
cout<<"In a continent besieged by monsters from all sides, as the skies and earth tear apart alike, heroes are in great need and short supply."<<endl;
cout<<"You are from an ancient bloodline known for possessing the great hero Menara among its descendants, and you have lived your whole life training to become someone that can meet the needs of the time."<<endl;
cout<<endl;
cout<<"Now, as your adulthood has approached, it is time for you to set out, set your blade against the threats to come and measure yourself once and for all."<<endl;
cout<<endl;
cout<<"Welcome to-"<<endl;
cout<<"ENDLESS QUEST"<<endl;
cout<<endl;
}
void about() {
cout<<"\n\"Endless Quest\" is, as the name suggests, a game of endless fighting."<<endl;
cout<<"You will battle various opponents, become stronger, choose different paths to improve yourself in myriad ways, and forge a story of excellence."<<endl;
cout<<"Battles run according to standard JRPG. If you have no experience with it, the in-game tutorial will guide you through your first battle."<<endl;
cout<<"This is currently only a trial version. Hope you enjoy!\n"<<endl;
}
void openingMenu() {
cout<<"1) Start\t 2) Load"<<endl;
cout<<"3) About\t 4) Quit"<<endl;
cout<<"(insert choice)"<<endl;
int opchoice, test=1, surety=0;
string name, charClass;
cin>>opchoice;
switch (opchoice) {
case 1:
while(surety==0) {
int saveLoc;
cout<<"Choose location to save: 1, 2, 3"<<endl;
saveLoc=chartoint();
if(saveLoc<0 || saveLoc>3) {
while(saveLoc<0 || saveLoc>3) {
cout<<"Invalid location. Please input again."<<endl;
saveLoc=chartoint();
}
}
cout<<"Are you sure? If there is an existing save in this location, it will be overwritten."<<endl;
surety=yn();
}
cout<<"Give your character's name."<<endl;
cin>>name;
mainchar.Name = name;
cout<<"Give your character's class."<<endl;
cout<<"Available choices: Warrior (w), Mage (m), Rogue (r)"<<endl;
while(checkClass(charClass)=="\0")
cin>>charClass;
mainchar.charClass = checkClass(charClass);
mainchar.getAbilities();
initiateBattles();
break;
case 2: {
int saveLoc;
cout<<"Choose which to load:"<<endl;
cout<<"1. Save_1\n2. Save_2\n3. Save_3"<<endl;
fstream file;
cin>>saveLoc;
if(saveLoc==1)
file.open("save_1.txt",ios::in);
else if(saveLoc==2)
file.open("save_2.txt",ios::in);
else if(saveLoc==3)
file.open("save_3.txt",ios::in);
else
cout<<"Invalid choice."<<endl;
if(!file)
cout<<"Save cannot be found."<<endl;
cout<<"This function is under construction."<<endl;
}
break;
case 3:
about();
openingMenu();
break;
case 4:
exit(0);
default:
cout<<"Invalid choice.\n";
}
}
int main()
{
Intro();
openingMenu();
return 0;
}
//--
// tutorials
//--
void Tutorial1() {
string blankSpace;
int tutorial;
cout<<"You are about to enter a battle. Would you like a short tutorial on this game's battle aspect?"<<endl;
tutorial=yn();
if(tutorial==1) {
cout<<"In battle, you as the hero will undoubtedly have to face off against some number of opponents."<<endl;
cout<<"This is turn-based, starting with your turn."<<endl;
cout<<"On your turn, you can choose to do one of three things: attack, defend or use an item."<<endl;
cout<<"Attacking damages the opponent and lowers their health."<<endl;
cout<<"Defending puts you in a stance where you take less damage from the opponent than you would otherwise."<<endl;
cout<<"Items can have varied effects, some useful in battle and some not."<<endl;
cout<<"However, items have usage limits. Once they reach that limit, they can no longer be used."<<endl;
cout<<"You will not know the breaking point until it has been reached. So it's good to be careful with item usage, but at the same time, don't stockpile them."<<endl;
cout<<"They're there to be used."<<endl;
cout<<"Now go on and fight the darkness of the world!"<<endl;
cout<<"[tutorial end]"<<endl;
cin>>blankSpace;
cout<<endl;
}
else {
cout<<endl;
}
}
void Tutorial2() {
string blankSpace;
int tutorial;
cout<<"By levelling up, you can allocate stat points. Would you like a short tutorial on this?"<<endl;
tutorial=yn();
if(tutorial==1) {
cout<<"After battling opponents, you may feel that you have gotten stronger."<<endl;
cout<<"This rise in strength is in-game reflected by your level."<<endl;
cout<<"After every rise in level, you will be given 5 stat points to allocate as you wish."<<endl;
cout<<"Your character has six main stats:"<<endl;
cout<<"Health Points (HP) which show the amount of damage you can take and remain standing."<<endl;
cout<<"Attack (ATK) which show the amount of normal damage you can deal to enemies."<<endl;
cout<<"Defense (DEF) which helps reduce damage taken from normal attacks."<<endl;
cout<<"Magic Attack (MATK) which shows the amount of magical damage you can deal to enemies."<<endl;
cout<<"Magic Defense (MDEF) which helps reduce damage taken from magical attacks."<<endl;
cout<<"And finally, Luck (LUCK) which has no battle relevance but affects the course of events around you."<<endl;
cout<<"Each stat has its own importance, so distribute your points wisely."<<endl;
cout<<"[tutorial end]"<<endl;
cin>>blankSpace;
cout<<endl;
}
else {
cout<<endl;
}
}
void battleEnding() {
string blankSpace;
cout<<"\nYou can no longer hold yourself upright."<<endl;
cout<<"Every breath hurts, and your vision blurs at the edges as darkness takes over."<<endl;
cout<<"You collapse, consciousness fleeing you to never return, and only your corpse remains. never to be discovered."<<endl;
cin>>blankSpace;
cout<<"THE END"<<endl;
cout<<"..."<<endl;
cin>>blankSpace;
cout<<"1. Return to Menu\t\t 2. Quit"<<endl;
int ch;
cin>>ch;
if(ch==1)
openingMenu();
else
exit(0);
}