/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ScavTrap.cpp                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: narnaud <narnaud@student.42.fr>            +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2022/06/23 15:19:54 by narnaud           #+#    #+#             */
/*   Updated: 2022/07/19 02:22:09 by narnaud          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "ScavTrap.hpp"

ScavTrap::ScavTrap (std::string name):ClapTrap(name){
	_health = 100;
	_energy = 50;
	_attack = 20;
	cout << "ClapTrap " << name << " evolved to ScavTrap" << endl;
}

ScavTrap::~ScavTrap (void) {
	cout << "ScavTrap " << _name << " was destroyed" << endl;
}

void	ScavTrap::attack(const std::string& target) {
	if (_energy == 0 || _health == 0)
		cout << _name << " is no more able to attack" << endl;
	else
	{
		cout << _name << " heavily attacked " << target << endl; 
		getClapTrap(target)->takeDamage(_attack);
		_energy--;
	}
}

void	ScavTrap::guardGate(void) {
	if (_health == 0)
		cout << _name << " is no more able to guard" << endl;
	else
		cout << _name << " is now in guard gate mode.\n";
}