#pragma once
#include "../Command.h"

class BuildScarabCommand : public Command
{
public:
  BuildScarabCommand(BehaviorState& state)
    : Command(state)
  {
  }
  virtual bool execute(BWAPI::Unit* unit) const
  {
    assert(unit->getType() == BWAPI::UnitTypes::Protoss_Reaver);

    return unit->train(BWAPI::UnitTypes::Protoss_Scarab);

    //int queueLength = unit->getTrainingQueue().size();
    //int scarabCount = unit->getScarabCount();
    //int max = 5;
    //if(BWAPI::Broodwar->self()->getUpgradeLevel(BWAPI::UpgradeTypes::Reaver_Capacity) != 0){
    //  max = 10;
    //}

    //int count = queueLength + scarabCount;
    //if((queueLength + scarabCount) < max){
    //  if(unit->getType().canProduce()){
    //    BWAPI::UnitType t = BWAPI::UnitTypes::Protoss_Scarab;
    //    bool a = unit->train(t);
    //    return true;
    //  }
    //}
    //return true;
  }
protected:
  virtual void _output(std::ostream& out) const
  {
    out << "Build and Queue Scarabs";
  }
};
