-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
74 lines (65 loc) · 2.48 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wcorrea- <wcorrea-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 14:02:28 by wcorrea- #+# #+# */
/* Updated: 2023/07/17 17:53:28 by wcorrea- ### ########.fr */
/* */
/* ************************************************************************** */
#include "ClapTrap.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("CLAPTRAP DEFAULT");
ClapTrap firstRobot;
firstRobot.attack("invasors");
std::cout << firstRobot << std::endl;
firstRobot.takeDamage(5);
std::cout << firstRobot << std::endl;
firstRobot.beRepaired(5);
std::cout << firstRobot << std::endl;
firstRobot.takeDamage(15);
std::cout << firstRobot << std::endl;
firstRobot.attack("traitors");
pressEnter();
titleHeader("CLAPTRAP SPECIFIC");
ClapTrap secondRobot("Version 2.0");
secondRobot.attack("invasors");
std::cout << secondRobot << std::endl;
secondRobot.takeDamage(9);
std::cout << secondRobot << std::endl;
secondRobot.beRepaired(1);
std::cout << secondRobot << std::endl;
secondRobot.takeDamage(2);
std::cout << secondRobot << std::endl;
secondRobot.beRepaired(2);
pressEnter();
titleHeader("CLAPTRAP COPY");
ClapTrap thirdRobot(secondRobot);
thirdRobot.attack("traitors");
std::cout << thirdRobot << std::endl;
pressEnter();
titleHeader("CLAPTRAPS DESTUCTORS");
}