d03 ex03 a priori ok

This commit is contained in:
Hugo LAMY
2022-02-23 17:05:56 +01:00
parent b24335a78e
commit 718fe08eae
21 changed files with 229 additions and 47 deletions

View File

@@ -26,7 +26,7 @@ FragTrap::FragTrap( FragTrap const & src ) {
*********************************************/
FragTrap::~FragTrap( void ) {
std::cout << _class << " " << FragTrap::_name << " destructed\n";
std::cout << _class << " " << _name << "-" << _number << " destructed\n";
return;
}
@@ -43,8 +43,36 @@ FragTrap & FragTrap::operator=( FragTrap const & rhs ) {
* PUBLIC MEMBER FUNCTIONS
*********************************************/
//void FragTrap::attack(const std::string & target) {
//
// std::ostringstream action;
// std::ostringstream state;
//
// state << B_CYAN "[" B_GREEN << _class[0] << _number << B_PURPLE "h,e,a" B_CYAN ":" B_BLUE << _hit << "," << _energy << "," << _attack << B_CYAN "->";
// action << _class << " " << _name << "-" << _number << B_CYAN " SPECIAL FRAG" RESET;
//
// if (_energy > 0 && _hit > 0)
// {
// _energy--;
// if (_energy < 0)
// _energy = 0;
// action << " attacked " << target << ", causing " B_YELLOW << _attack << RESET << " points of damage" << '\n';
// }
// else
// {
// _attack = 0;
// if (_energy <= 0)
// action << " cannot attack because " B_RED " is out of energy" RESET"\n";
// else if (_hit <= 0)
// action << " cannot attack because " B_RED " is out of hit" RESET "\n";
// }
//
// state << B_BLUE << _hit << "," << _energy << "," << _attack << B_CYAN "]" RESET;
// std::cout << state.str() << action.str();
//}
void FragTrap::highFivesGuys() {
std::cout << _class << " " << FragTrap::_name << " wait for a high fives, common guys\n";
std::cout << _class << " " << _name << "-" << _number << " wait for a high fives, common guys\n";
}
/*********************************************
@@ -55,5 +83,5 @@ std::string const FragTrap::_dName = "robot";
std::string const FragTrap::_dClass = "FragTrap";
int const FragTrap::_dHit = 100;
int const FragTrap::_dEnergy = 100;
int const FragTrap::_dAttack = 50;
int const FragTrap::_dAttack = 30;