#include "Command.h"
#include "Person.h"
#include "Level.h"
#include "List.h"
#include "Player.h"

using namespace std;

const std::string EndLevelCommand::_id = "endLevel";

EndLevelCommand::EndLevelCommand()
{
}

EndLevelCommand::EndLevelCommand(List *command)
{
}

void EndLevelCommand::execute()
{
	//set the level as "won"
	Level::instance()->setWon(true);
	//kill the player so the level ends.
	Level::instance()->getPlayer()->die();
	//Level::instance()->getPlayer()->addHealth(- Level::instance()->getPlayer()->getHealth());
}

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

	return commandString;
}