Min fixes
This commit is contained in:
@@ -65,14 +65,14 @@ void ClapTrap::attack(const std::string &target)
|
||||
this->energy -= 1;
|
||||
} else {
|
||||
std::cout << "ClapTrap " << this->name
|
||||
<< " cant attack anymore..." << std::endl;
|
||||
<< " can't attack anymore..." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void ClapTrap::takeDamage(unsigned int amount)
|
||||
{
|
||||
std::cout << "ClapTrap " << this->name
|
||||
<< " recieves " << amount
|
||||
<< " receives " << amount
|
||||
<< " points of damage!" << std::endl;
|
||||
if (amount >= this->health)
|
||||
this->health = 0;
|
||||
@@ -82,16 +82,20 @@ void ClapTrap::takeDamage(unsigned int amount)
|
||||
|
||||
void ClapTrap::beRepaired(unsigned int amount)
|
||||
{
|
||||
if (this->energy > 0)
|
||||
if (this->health == 0)
|
||||
{
|
||||
std::cout << "ClapTrap " << this->name
|
||||
<< " repairs itself, recovering " << amount
|
||||
<< " hit points!" << std::endl;
|
||||
|
||||
this->health += amount;
|
||||
this->energy -= 1;
|
||||
} else {
|
||||
std::cout << "ClapTrap " << this->name
|
||||
<< " cant be repaired..." << std::endl;
|
||||
std::cout << "ClapTrap " << this->name << " can't repair itself because it's destroyed" << std::endl;
|
||||
return ;
|
||||
}
|
||||
if (this->energy == 0)
|
||||
{
|
||||
std::cout << "ClapTrap " << this->name << " has no energy left to repair!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
std::cout << "ClapTrap " << this->name
|
||||
<< " repairs itself, recovering " << amount
|
||||
<< " hit points!" << std::endl;
|
||||
|
||||
this->health += amount;
|
||||
this->energy -= 1;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# define FRAGTRAP_HPP
|
||||
|
||||
# include <iostream>
|
||||
# include "../ClapTrap/ClapTrab.hpp"
|
||||
# include "../ClapTrap/ClapTrap.hpp"
|
||||
|
||||
class FragTrap : public ClapTrap
|
||||
{
|
||||
|
||||
@@ -68,16 +68,15 @@ void ScavTrap::attack(const std::string &target)
|
||||
|
||||
void ScavTrap::guardGate()
|
||||
{
|
||||
if (this->guardGate)
|
||||
if (!this->guarding_gate)
|
||||
{
|
||||
this->guardGate = false;
|
||||
std::cout << "ScavTrap " << this->name << " is not in Gate keeper mode"
|
||||
this->guarding_gate = true;
|
||||
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode"
|
||||
<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->guardGate = true;
|
||||
std::cout << "ScavTrap " << this->name << " is in Gate keeper mode"
|
||||
std::cout << "ScavTrap " << this->name << " is already in Gate keeper mode"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
class ScavTrap : public ClapTrap
|
||||
{
|
||||
private:
|
||||
boold guarding_gate;
|
||||
bool guarding_gate;
|
||||
public:
|
||||
ScavTrap();
|
||||
ScavTrap(std::string name);
|
||||
|
||||
Reference in New Issue
Block a user