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

#include <iostream>

using namespace std;

const std::string SecondaryShootCommand::_id = "secondaryShoot";

SecondaryShootCommand::SecondaryShootCommand(Player *player)
:_player(player)
{
}

SecondaryShootCommand::SecondaryShootCommand(List *command)
{
	command = command->rest();
	_player = (Player *)Level::instance()->getObject(command->firstString());
}

void SecondaryShootCommand::execute()
{
	_player->shootSecondary();
}

std::string SecondaryShootCommand::getString()
{
	List *command = new List();
	command->snoc(new Atom(_id));
	command->snoc(new Atom(_player->id()));

	string commandString = command->getString();
	delete command;

	return commandString;
}