-
Notifications
You must be signed in to change notification settings - Fork 0
/
Letthebattlecommence.cpp
354 lines (273 loc) · 9.35 KB
/
Letthebattlecommence.cpp
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
#include <iostream>
#include <ctime>
using namespace std;
void GameStory()
{
cout <<
" *****Rezero:Cursed***** \n";
cout <<
" .......................... \n";
cout <<
" \n";
cout <<
"1. Mansi relocates to her late husband's village home with her son "
"after his death.\n";
cout <<
"2. She soon hears disturbing rumors about sinister rituals that "
"occurred in the mansion.\n";
cout <<
"3. While exploring the home, Mansi discovers a book revealing that "
"the evil spirit is her late husband's father.\n";
cout <<
"4. A fierce battle for survival starts as Mansi fights to protect "
"her son from the evil presence.\n";
cout << "5. In the end, she was able to defeat the evil spirit but not "
"without paying the ultimate price \n";
}
int GetRandomNumber(int min, int max)
{
srand(time(0));
int randomNumber = min + (rand() % (max - min + 1));
return randomNumber;
}
class Player
{
private:
int health = 100;
int minHealingPower = 3;
int maxHealingPower = 8;
int minDamage = 5;
int maxDamage = 20;
public:
Player()
{
cout << "Mansi stood at the edge of the village, holding her son's hand." << endl;
cout << "They looked at the old mansion that was now their home. The sun was setting, casting long shadows."
<< endl;
cout << "After her husband's sudden death, Mansi was heartbroken but determined."
<< endl;
cout << "She wanted to protect her son and uncover the secrets the mansion held."
<< endl;
cout << "The villagers spoke of strange rituals and a terrifying presence within the mansion,"
<< endl;
cout << "but Mansi was not afraid. She was ready to confront whatever lay inside."
<< endl;
cout << "As they walked into the mansion, Mansi held her son's hand tightly." << endl;
cout << "A battle for their lives was about to begin, but she was prepared." << endl;
cout << "Mansi was strong, and nothing could stop her from protecting her son."
<< endl;
cout << "..............................................................." << endl;
cout << "Your Current Health is::" << health << endl;
}
int GetHealth()
{
return health;
}
void TakeDamage(int damage)
{
if (health > 0)
{
cout << "Spirit Attacks with damage of " <<damage<<" Take care of your health" << endl;
health = health - damage;
cout << "Mansi new Health is ::" << health << endl;
}
else
{
cout << "Mansi is dead." << endl;
}
}
int GiveDamage()
{
srand(time(0));
int randomDamage = minDamage + (rand() % (maxDamage - minDamage + 1));
return randomDamage;
}
void PlayerDead()
{
health=0;
}
void Heal()
{
srand(time(0));
int randomHeal = minHealingPower + (rand() % (maxHealingPower - minHealingPower + 1));
health += randomHeal;
cout << "Mansi Healed with a HP of::" << randomHeal << endl;
cout << "Mansi new health is::" << health << endl;
}
};
class Spirit
{
private:
int health = 100;
int minHealingPower = 3;
int maxHealingPower = 8;
int minDamage = 5;
int maxDamage = 15;
public:
Spirit()
{
cout<<"The evil spirit appears with glowing eyes and a cold, dark aura. It’s a dangerous, angry force from another world."<<endl;
}
int GetHealth()
{
return health;
}
void TakeDamage(int damage)
{
if (health > 0)
{
cout << "Spirit is hurt with damage of "<<damage<<"." << endl;
health = health - damage;
cout << "Spirit new health is ::" << health << endl;
}
else
{
cout << "Spirit is dead." << endl;
}
}
int GiveDamage()
{
srand(time(0));
int randomDamage = minDamage + (rand() % (maxDamage - minDamage + 1));
return randomDamage;
}
void SpiritDead()
{
health=0;
}
};
int main()
{
srand(time(0));
int choice;
Player *player = new Player();
Spirit *spirit = new Spirit();
char userInput;
GameStory();
cout << endl;
cout << endl;
cout << "Hi, Welcome to Rezero:Cursed" << endl;
cout << "*******Please Read me*******" << endl;
cout << "There are two choices in the game." << endl;
cout << "If you press 1, you will choose option 1. If you press any other button, you will choose option 2." << endl;
cout << endl;
cout << "As you arrive at the village, do you: (1) Explore the village to gather supplies, or (2) Head straight into the mansion?" << endl;
cin>>choice;
if(choice==1)
{
cout << "You gather health potions and first aid kits." << endl;
}
else
{
cout << "You head straight into the mansion." << endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "You encounter a hostile spirit with 100 health." << endl;
cout << "Do you: (1) Use your improvised weapon to deal damage to the spirit, or (2) Use knowledge from the book to create a protective barrier?" << endl;
cin>>choice;
if (choice == 1) {
spirit->TakeDamage(player->GiveDamage());
player->TakeDamage(spirit->GiveDamage());
} else {
cout << "You create a protective barrier." << endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "You’ve sustained injuries. Do you: (1) Use a healing item, or (2) Continue exploring despite your injuries?" << endl;
cin >> choice;
if (choice == 1)
{
player->Heal();
}
else
{
player->TakeDamage(spirit->GiveDamage());
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "You find an ancient book. What will you do? (1) Study the book to unlock spells, or (2) Focus on immediate threats?" << endl;
cin >> choice;
if (choice == 1)
{
cout << "You gain the ability to heal or deal additional damage in future encounters." << endl;
}
else
{
cout << "You continue without the book’s advantages." << endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "You hear the spirit approaching your son. Do you: (1) Rush to protect him, (2) Set a trap to distract the spirit" << endl;
cin >> choice;
if (choice == 1)
{
player->TakeDamage(spirit->GiveDamage());
}
else
{
cout << "The trap distracts the spirit." << endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "The spirit is approaching. How do you approach the confrontation? (1) Engage in direct combat, (2) Use a ritual from the book, or (3) Attempt to escape and regroup?" << endl;
cin >> choice;
if (choice == 1)
{
spirit->TakeDamage(player->GiveDamage());
player->TakeDamage(spirit->GiveDamage());
}
else if (choice == 2)
{
spirit->TakeDamage(player->GiveDamage());
player->TakeDamage(spirit->GiveDamage() / 2);
}
else
{
cout << "You avoid immediate damage but face a tougher encounter later." << endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
cout << "In the final showdown, do you: (1) Sacrifice yourself to ensure your son’s survival, or (2) Attempt a risky attack?" << endl;
cin >> choice;
if (choice == 1)
{
player->PlayerDead();
spirit->SpiritDead();
}
else
{
if (GetRandomNumber(0, 1) == 0)
{
spirit->TakeDamage(player->GiveDamage() + 40);
cout << "The risky attack succeeded." << endl;
spirit->SpiritDead();
}
else
{
player->TakeDamage(spirit->GiveDamage() + 20);
cout << "The risky attack failed." << endl;
player->PlayerDead();
}
}
if(spirit->GetHealth()==0&&player->GetHealth()==0)
{
cout<<"You saved your son but you died"<<endl;
}
else if(spirit->GetHealth()>0 || player->GetHealth()==0)
{
cout<<"You Lost. Try Again "<<endl;
}
else if(spirit->GetHealth()==0||player->GetHealth()>0)
{
cout<<"You won"<<endl;
}
cout<<"Current Health of Spirit and Player"<<endl;
cout<<"Spirit->"<< spirit->GetHealth()<<endl;
cout<<"Player->"<<player->GetHealth()<<endl;
}