style: adding the boradcast and the moulinette character

This commit is contained in:
Raphael 2025-01-14 22:05:48 +01:00
parent 016ddd0846
commit 51f2946231
2 changed files with 12 additions and 7 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/13 14:58:53 by rparodi ### ########.fr */
/* Updated: 2025/01/14 21:59:42 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -27,12 +27,12 @@ ClapTrap::~ClapTrap() {
}
void ClapTrap::attack(const std::string& target) {
if (_energy_point <= 0 && _hit_point <= 0) {
std::cerr << "Not enough energy to attack" << std::endl;
if (_energy_point <= 0 || _hit_point <= 0) {
std::cerr << "\n[Attack] ClapTrap:\n\t" << "Not enough energy to attack" << std::endl;
return ;
}
_energy_point--;
std::cout << "[Attack] ClapTrap:\n\t" << _name << " attacks " << target << ", causing " << _attack_damage << " points of damage!" << std::endl;
std::cout << "\n[Attack] ClapTrap:\n\t" << _name << " attacks " << target << ", causing " << _attack_damage << " points of damage!" << std::endl;
}
void ClapTrap::takeDamage(unsigned int amount) {
@ -41,8 +41,8 @@ void ClapTrap::takeDamage(unsigned int amount) {
}
void ClapTrap::beRepaired(unsigned int amount) {
if (_energy_point <= 0 && _hit_point <= 0) {
std::cerr << "Not enough energy to repair" << std::endl;
if (_energy_point <= 0 || _hit_point <= 0) {
std::cerr << "\n[Repair] ClapTrap:\n\t" << "Not enough energy to repair" << std::endl;
return ;
}
_energy_point--;