#include "stdafx.h"
#include "../../../../PerceptualState/World/CurrentWorld.h"
#include "Research.h"
#include <Exp/Logical/AndExp.h>
#include <Exp/Comparison/GreaterCompExp.h>
#include <Exp/Numeric/Number.h>

UpgradeResearch::UpgradeResearch(const Process* parent, unsigned int priority, UpgradeTypeObject* upgrade)
  : Research(parent, priority)
  , TacticalAction(parent, priority)
  , Process(parent)
  , m_upgrade(upgrade)
{
  //std::vector<planning::ILogicalExp*> subExps;
  //if (m_upgrade->getUpgrade().whatUpgrades() != BWAPI::UnitTypes::None)
  //{
  //  BuildingTypeObject* whatUpgrades = CurrentWorld::getBuildingTypeObject(m_upgrade->getUpgrade().whatUpgrades());
  //  subExps.push_back(new planning::GreaterCompExp(CurrentWorld::NrUnitCompleted->getFormulaApplication(&whatUpgrades, &whatUpgrades+1), new planning::Number(0)));
  //}
  //if (m_upgrade->getUpgrade().whatsRequired() != BWAPI::UnitTypes::None)
  //{
  //  BuildingTypeObject* whatsRequired = CurrentWorld::getBuildingTypeObject(m_upgrade->getUpgrade().whatsRequired());
  //  subExps.push_back(new planning::GreaterCompExp(CurrentWorld::NrUnitCompleted->getFormulaApplication(&whatsRequired, &whatsRequired+1), new planning::Number(0)));
  //}

  //m_precondition = planning::AndExp::instantiate(subExps.size(), subExps.begin(), subExps.end());

  //m_effect = CurrentWorld::TechAcquired->getFormulaApplication(&upgrade, &upgrade+1);
}

TechResearch::TechResearch(const Process* parent, unsigned int priority, TechTypeObject* tech)
  : Research(parent, priority)
  , TacticalAction(parent, priority)
  , Process(parent)
  , m_tech(tech)
{
  //BuildingTypeObject* whatResearches = CurrentWorld::getBuildingTypeObject(m_tech->getTech().whatResearches());
  //TechTypeObject* techTypeTech = CurrentWorld::getTechTypeObject(m_tech->getTech());

  //m_precondition = new planning::GreaterCompExp(CurrentWorld::NrUnitCompleted->getFormulaApplication(&whatResearches, &whatResearches+1), new planning::Number(0));

  //m_effect = CurrentWorld::TechAcquired->getFormulaApplication(&techTypeTech, &techTypeTech+1);
}