This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
142 lines (95 loc) · 3.37 KB
/
Copy pathmain.cpp
File metadata and controls
142 lines (95 loc) · 3.37 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
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include "units.h"
#include <unistd.h>
#define Slow 1000000
#define Slower 4000000
using namespace std;
int main(int argc, char **argv)
{
srand(time(NULL));
Hero gladiator;
Glad enemy, enemy2, enemy3;
Animal beast;
Centurion boss;
Encounter fight;
fight.nameOfHero=gladiator._name;
fight.yourHero(gladiator._name);
for(int i=0; i<=4; i++)
{
switch(i)
{
case 0:
{
cout<<"First fight is about to start!"<<endl; usleep(Slower);
fight.nameOfEnemy=enemy._name;
cout<<fight.nameOfHero<<" will be fighting with "<<fight.nameOfEnemy<<endl; usleep(Slower);
cout<<"FIGHT!"<<endl; usleep(Slow);
enemy.powerup(fight.encounter_number(), enemy.totalHp, enemy._attackPower, enemy._defencePower);
fight.combatLoop(gladiator._hp, gladiator._attackPower, gladiator._defencePower,
gladiator.luck(), enemy.totalHp, enemy._attackPower, enemy._defencePower, i);
} break;
case 1:
{
if(fight.areYouDead(gladiator._hp))
{
return 0;
};
gladiator.victoryAward();
fight.nameOfEnemy=enemy2._name;
cout<<"Second fight is about to start!"<<endl; usleep(Slower);
cout<<fight.nameOfHero<<" will be fighting with "<<fight.nameOfEnemy<<endl; usleep(Slower);
cout<<"FIGHT!"<<endl; usleep(Slow);
enemy2.powerup(fight.encounter_number(), enemy2.totalHp, enemy2._attackPower, enemy2._defencePower);
fight.combatLoop(gladiator._hp, gladiator._attackPower, gladiator._defencePower,
gladiator.luck(), enemy2.totalHp, enemy2._attackPower, enemy2._defencePower, i);
} break;
case 2:
{
if(fight.areYouDead(gladiator._hp))
{
return 0;
};
gladiator.victoryAward();
fight.nameOfEnemy=enemy3._name;
cout<<"Third fight is about to start!"<<endl; usleep(Slower);
cout<<fight.nameOfHero<<" will be fighting with "<<fight.nameOfEnemy<<endl; usleep(Slower);
cout<<"FIGHT!"<<endl; usleep(Slow);
enemy2.powerup(fight.encounter_number(), enemy3.totalHp, enemy3._attackPower, enemy3._defencePower);
fight.combatLoop(gladiator._hp, gladiator._attackPower, gladiator._defencePower,
gladiator.luck(), enemy3.totalHp, enemy3._attackPower, enemy3._defencePower, i);
} break;
case 3:
{
if(fight.areYouDead(gladiator._hp))
{
return 0;
};
gladiator.victoryAward();
fight.nameOfEnemy=beast._name;
cout<<"Fourth fight is about to start!"<<endl; usleep(Slower);
cout<<fight.nameOfHero<<" will be fighting with "<<fight.nameOfEnemy<<endl; usleep(Slower);
cout<<"FIGHT!"<<endl; usleep(Slow);
fight.combatLoop(gladiator._hp, gladiator._attackPower, gladiator._defencePower,
gladiator.luck(), beast.totalHp, beast._attackPower, beast._defencePower, i);
} break;
case 4:
{
if(fight.areYouDead(gladiator._hp))
{
return 0;
};
gladiator.victoryAward();
fight.nameOfEnemy=boss._name;
cout<<"Final fight is about to start!"<<endl; usleep(Slower);
cout<<fight.nameOfHero<<" will be fighting with "<<fight.nameOfEnemy<<endl; usleep(Slower);
cout<<"FIGHT!"<<endl; usleep(Slow);
fight.combatLoop(gladiator._hp, gladiator._attackPower, gladiator._defencePower,
gladiator.luck(), boss.totalHp, boss._attackPower, boss._defencePower, i);
if(gladiator._hp>0)
fight.final_victory_message(gladiator._name);
} break;
}
}
}