style: using the canonical form

This commit is contained in:
Raphael 2025-02-10 10:59:48 +01:00
parent d59e35466b
commit a909970d76
18 changed files with 201 additions and 37 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/10 13:59:49 by rparodi #+# #+# */
/* Updated: 2025/01/24 18:32:35 by rparodi ### ########.fr */
/* Updated: 2025/02/10 10:53:38 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,7 +15,12 @@
#include <iostream>
ClapTrap::ClapTrap() {
_name = "";
_hit_point = 0;
_energy_point = 0;
_attack_damage = 0;
std::cout << "\n[Init] ClapTrap (no_name):\n\t" << "Name: " << _name << std::endl;
}
ClapTrap::ClapTrap(std::string name) {
@ -26,6 +31,14 @@ ClapTrap::ClapTrap(std::string name) {
std::cout << "\n[Init] ClapTrap:\n\t" << "Name: " << _name << std::endl;
}
ClapTrap::ClapTrap(ClapTrap const &copy) {
_name = copy._name;
_hit_point = copy._hit_point;
_energy_point = copy._energy_point;
_attack_damage = copy._attack_damage;
std::cout << "\n[Init] ClapTrap (copy):\n\t" << "Name: " << _name << std::endl;
}
ClapTrap::~ClapTrap() {
std::cout << "\n[Delete] ClapTrap:\n\t" << "Name: " << _name << std::endl;
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/10 14:54:21 by rparodi #+# #+# */
/* Updated: 2025/01/24 18:32:41 by rparodi ### ########.fr */
/* Updated: 2025/02/10 10:24:18 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,6 +18,7 @@
class ClapTrap {
public:
ClapTrap();
ClapTrap(ClapTrap const &copy);
ClapTrap(std::string name);
~ClapTrap();
void attack(const std::string& target);

View file

@ -6,12 +6,30 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/24 17:41:01 by rparodi #+# #+# */
/* Updated: 2025/01/24 20:31:45 by rparodi ### ########.fr */
/* Updated: 2025/02/10 10:56:14 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
ScavTrap::ScavTrap() {
_name = "";
_hit_point = 0;
_energy_point = 0;
_attack_damage = 0;
_gateKeeperMode = false;
std::cout << "\n[Init] ScavTrap (no_name)" << std::endl;
}
ScavTrap::ScavTrap(ScavTrap const &copy) {
_name = copy._name;
_hit_point = copy._hit_point;
_energy_point = copy._energy_point;
_attack_damage = copy._attack_damage;
_gateKeeperMode = copy._gateKeeperMode;
std::cout << "\n[Init] ScavTrap (copy):\n\t" << "Name: " << _name << std::endl;
}
ScavTrap::ScavTrap (std::string name) {
_name = name;
_hit_point = 100;
@ -21,7 +39,11 @@ ScavTrap::ScavTrap (std::string name) {
std::cout << "\n[Init] ScavTrap:\n\t" << "Name: " << _name << std::endl;
}
ScavTrap::~ScavTrap() {
}
void ScavTrap::guardGate() {
_gateKeeperMode = !_gateKeeperMode;
_gateKeeperMode = !_gateKeeperMode;
std::cout << "\n[Mode] ScavTrap:\n\t" << "Name: " << _name << " the mode gate keeper is now: " << (_gateKeeperMode ? "enable" : "disable") << std::endl;
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/20 23:13:16 by rparodi #+# #+# */
/* Updated: 2025/01/24 18:46:42 by rparodi ### ########.fr */
/* Updated: 2025/02/10 10:43:14 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,7 +18,10 @@
class ScavTrap : public ClapTrap {
public:
ScavTrap();
ScavTrap(ScavTrap const &copy);
ScavTrap(std::string name);
~ScavTrap();
void guardGate();
protected:

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/10 15:50:07 by rparodi #+# #+# */
/* Updated: 2025/01/24 18:51:51 by rparodi ### ########.fr */
/* Updated: 2025/02/10 10:52:36 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,16 +15,16 @@
#include <iostream>
int main(void) {
std::cout << "[Broadcast]\n\tIn the Red corner the first cat of the 42 school !" << std::endl;
ScavTrap test("Norminet");
test.attack("Moulinette");
test.takeDamage(42);
test.beRepaired(42);
test.guardGate();
test.guardGate();
test.guardGate();
std::cout << "\n\n[Broadcast]\n\tIn the Blue corner the actual cat of the 42 school !" << std::endl;
ClapTrap test2("Moulinette");
test2.beRepaired(32);
std::cout << "[Broadcast]\n\tIn the Blue corner the actual cat of the 42 school !" << std::endl;
ClapTrap test("Moulinette");
test.beRepaired(32);
std::cout << "\n\n[Broadcast]\n\tIn the Red corner the first cat of the 42 school !" << std::endl;
ScavTrap test2("Norminet");
test2.attack("Moulinette");
test2.takeDamage(42);
test2.beRepaired(42);
test2.guardGate();
test2.guardGate();
test2.guardGate();
return (0);
}