cpp03/ex03/ScavTrap.cpp

33 lines
816 B
C++
Raw Normal View History

2025-05-20 11:24:16 +02:00
#include "ScavTrap.hpp"
#include <iostream>
ScavTrap::ScavTrap() {
std::cout << "ScavTrap::ScavTrap()" << std::endl;
hit_points = 100;
energy_points = 50;
attack_damage = 20;
}
ScavTrap::ScavTrap(std::string name) {
std::cout << "ScavTrap::ScavTrap(" << name << ")" << std::endl;
hit_points = 100;
energy_points = 50;
attack_damage = 20;
this->name = name;
}
ScavTrap::~ScavTrap() { std::cout << "ScavTrap::~ScavTrap()" << std::endl; }
ScavTrap &ScavTrap::operator=(const ScavTrap &other) {
this->hit_points = other.hit_points;
this->energy_points = other.energy_points;
this->attack_damage = other.attack_damage;
this->name = other.name;
return *this;
}
void ScavTrap::guardGate() {
std::cout << "ScavTrap " << name << " is now in gate-guarding mode."
<< std::endl;
}