m_hp = 100;
m_energy = 50;
m_attack = 20;
- m_is_guading = 0;
+ m_is_guarding = 0;
}
ScavTrap::ScavTrap(const ScavTrap &other)
if (this == &other)
return (*this);
ClapTrap::operator=(other);
- m_is_guading = other.m_is_guading;
+ m_is_guarding = other.m_is_guarding;
return (*this);
}
--m_energy;
}
}
+
+void ScavTrap::guardGate()
+{
+ if (m_hp == 0)
+ std::cout << m_name << " is dead and cannot guard the gate.\n";
+ else if (m_is_guarding == 0)
+ {
+ std::cout << m_name << " is now guarding the gate.\n";
+ m_is_guarding = 1;
+ }
+ else
+ std::cout << m_name << " is already guarding the gate.\n";
+}