#include "Command.h"
#include "Control.h"
#include "List.h"
#include "Level.h"
#include "Object.h"
#include "Enemy.h"

using namespace std;

const std::string ActivateEnemyCommand::_id = "activateEnemy";

ActivateEnemyCommand::ActivateEnemyCommand(Enemy *enemy)
:_enemy(enemy->id())
{

}

ActivateEnemyCommand::ActivateEnemyCommand(List *command)
{
	command = command->rest();
	_enemy = command->firstString();
}

void ActivateEnemyCommand::execute()
{
	((Enemy *)Level::instance()->getObject(_enemy))->activate();
}

std::string ActivateEnemyCommand::getString()
{
	List *command = new List();
	command->snoc(new Atom(_id));
	command->snoc(new Atom(_enemy));
	string commandString = command->getString();
	delete command;

	return commandString;
}