Skip to content
Snippets Groups Projects
Commit d4ae9862 authored by Sopi Abaied's avatar Sopi Abaied :alien:
Browse files

Added access to unit movement speed and max health

parent baeb0c71
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ void define_unit(py::module & m)
.def_property_readonly("is_blip", &Unit::isBlip)
.def_property_readonly("target", &Unit::getTarget)
.def_property_readonly("has_target", &Unit::hasTarget)
.def_property_readonly("max_hit_points", &Unit::getMaxHitPoints)
.def("stop", &Unit::stop)
.def("attack_unit", &Unit::attackUnit)
.def("attack_move", &Unit::attackMove)
......
......@@ -10,6 +10,7 @@ void define_unittype(py::module & m)
.def_property_readonly("unit_typeid", [](UnitType & unit_type) { return static_cast<sc2::UNIT_TYPEID>(unit_type.getAPIUnitType()); })
.def_property_readonly("name", &UnitType::getName)
.def_property_readonly("race", &UnitType::getRace)
.def_property_readonly("movement_speed", &UnitType::getMovementSpeed)
.def_property_readonly("is_valid", &UnitType::isValid)
.def_property_readonly("is_building", &UnitType::isBuilding)
.def_property_readonly("is_combat_unit", &UnitType::isCombatUnit, "The unit is not any of the following: worker, supply provider, building, larva, egg")
......
......@@ -75,7 +75,7 @@ PYBIND11_MODULE(library, m)
.def_property_readonly("map_tools", &IDABot::Map)
.def_property_readonly("building_placer", &IDABot::GetBuildingPlacer)
.def_property_readonly("start_location", &IDABot::GetStartLocation, "CCPosition representing the start location")
.def_property_readonly("start_locations", &IDABot::GetStartLocations, "CCPosition representing the start locations")
.def_property_readonly("start_locations", &IDABot::GetStartLocations, "CCPosition representing the start locations")
.def_property_readonly("minerals", &IDABot::GetMinerals, "How much minerals we currently have")
.def_property_readonly("current_supply", &IDABot::GetCurrentSupply, "How much supply we are currently using")
.def_property_readonly("max_supply", &IDABot::GetMaxSupply, "How much supply we can currently use")
......
......@@ -339,3 +339,9 @@ bool Unit::isBlip() const
return m_unit->isBlip();
#endif
}
CCHealth Unit::getMaxHitPoints() const
{
BOT_ASSERT(isValid(), "Unit is not valid");
return m_unit->health_max;
}
\ No newline at end of file
......@@ -50,6 +50,7 @@ public:
bool isBlip() const;
bool hasTarget() const;
Unit getTarget() const;
CCHealth getMaxHitPoints() const;
void stop () const;
void attackUnit (const Unit & target) const;
......
......@@ -372,3 +372,8 @@ bool UnitType::isMorphedBuilding() const
m_type == BWAPI::UnitTypes::Zerg_Greater_Spire;
#endif
}
int UnitType::getMovementSpeed() const
{
return m_bot->Observation()->GetUnitTypeData()[m_type].movement_speed;
}
......@@ -22,6 +22,8 @@ public:
std::string getName() const;
CCRace getRace() const;
int getMovementSpeed() const;
bool isValid() const;
bool isBuilding() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment