ScavTrap guard

This commit is contained in:
2025-09-19 13:23:32 +02:00
parent 5373b7728d
commit e4c2000a4a
4 changed files with 29 additions and 6 deletions

View File

@@ -30,10 +30,7 @@ ScavTrap::ScavTrap(std::string name) : ClapTrap(name)
<< std::endl; << std::endl;
} }
ScavTrap::ScavTrap(const ScavTrap &other) : ClapTrap(other) ScavTrap::ScavTrap(const ScavTrap &other) : ClapTrap(other) { }
{
*this = other;
}
ScavTrap& ScavTrap::operator=(const ScavTrap &other) ScavTrap& ScavTrap::operator=(const ScavTrap &other)
{ {
@@ -71,6 +68,17 @@ void ScavTrap::attack(const std::string &target)
void ScavTrap::guardGate() void ScavTrap::guardGate()
{ {
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" if (this->guardGate)
{
this->guardGate = false;
std::cout << "ScavTrap " << this->name << " is not in Gate keeper mode"
<< std::endl; << std::endl;
}
else
{
this->guardGate = true;
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode"
<< std::endl;
}
} }

View File

@@ -19,6 +19,8 @@
class ScavTrap : public ClapTrap class ScavTrap : public ClapTrap
{ {
private:
boold guarding_gate;
public: public:
ScavTrap(); ScavTrap();
ScavTrap(std::string name); ScavTrap(std::string name);

View File

@@ -68,6 +68,17 @@ void ScavTrap::attack(const std::string &target)
void ScavTrap::guardGate() void ScavTrap::guardGate()
{ {
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode" if (this->guardGate)
{
this->guardGate = false;
std::cout << "ScavTrap " << this->name << " is not in Gate keeper mode"
<< std::endl; << std::endl;
}
else
{
this->guardGate = true;
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode"
<< std::endl;
}
} }

View File

@@ -19,6 +19,8 @@
class ScavTrap : public ClapTrap class ScavTrap : public ClapTrap
{ {
private:
boold guarding_gate;
public: public:
ScavTrap(); ScavTrap();
ScavTrap(std::string name); ScavTrap(std::string name);