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

class UseArchonWarpCommand : public Command
{
public:
  UseArchonWarpCommand(BehaviorState& state, BWAPI::Unit* otherTemplar)
    : Command(state)
    , m_otherTemplar(otherTemplar)
  {
    assert(m_otherTemplar->getType() == BWAPI::UnitTypes::Protoss_High_Templar);
  }
  virtual bool execute(BWAPI::Unit* unit) const
  {
    assert(unit->getType() == BWAPI::UnitTypes::Protoss_High_Templar);

    bool success1 = unit->useTech(BWAPI::TechTypes::Archon_Warp, m_otherTemplar);
    bool success2 = m_otherTemplar->useTech(BWAPI::TechTypes::Archon_Warp, unit);
    assert(success1 == success2);
    return (success1 && success2);
  }
protected:
  virtual void _output(std::ostream& out) const
  {
    out << "Archon-Warp with " << *m_otherTemplar;
  }

  BWAPI::Unit* const m_otherTemplar;
};
