-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
81 lines (71 loc) · 2.7 KB
/
main.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wcorrea- <wcorrea-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:02:28 by wcorrea- #+# #+# */
/* Updated: 2023/07/17 22:20:30 by wcorrea- ### ########.fr */
/* */
/* ************************************************************************** */
#include "DiamondTrap.hpp"
void pressEnter(void)
{
std::cout << std::endl << "press ENTER to continue" << std::endl;
std::cin.ignore();
std::cout << "\033c";
}
void titleHeader(const std::string& message)
{
std::cout << "\033c";
int standartSize = 34;
int messageSize = message.length();
int spaces = (standartSize - messageSize) / 2;
std::cout << "************************************" << std::endl << "*";
for (int i = 0; i < spaces; i++)
std::cout << " ";
std::cout << message;
for (int i = 0; i < spaces; i++)
std::cout << " ";
std::cout << "*" << std::endl << "************************************" << std::endl << std::endl;
}
int main(void)
{
titleHeader("DIAMOND DEFAULT");
DiamondTrap firstMonster;
firstMonster.whoAmI();
firstMonster.attack("citizens");
std::cout << firstMonster << std::endl;
firstMonster.takeDamage(90);
std::cout << firstMonster << std::endl;
firstMonster.beRepaired(10);
std::cout << firstMonster << std::endl;
firstMonster.guardGate();
firstMonster.highFivesGuys();
firstMonster.takeDamage(40);
std::cout << firstMonster << std::endl;
firstMonster.attack("citizens");
pressEnter();
titleHeader("DIAMOND SPECIFIC");
DiamondTrap secondMonster("Troll");
secondMonster.whoAmI();
secondMonster.attack("citizens");
std::cout << secondMonster << std::endl;
secondMonster.takeDamage(18);
std::cout << secondMonster << std::endl;
secondMonster.beRepaired(153);
std::cout << secondMonster << std::endl;
secondMonster.guardGate();
secondMonster.highFivesGuys();
secondMonster.takeDamage(240);
std::cout << secondMonster << std::endl;
secondMonster.attack("citizens");
pressEnter();
titleHeader("DIAMOND COPY");
DiamondTrap thirdMonster(secondMonster);
thirdMonster.attack("citizens");
std::cout << thirdMonster << std::endl;
pressEnter();
titleHeader("DIAMOND DESTUCTORS");
}