diff --git a/python-api-src/lib_unit.cpp b/python-api-src/lib_unit.cpp index 0462c8d46d2eeafa63adb510898cd3388e188ec8..51026485aecca7d226050e89c003c40ad559ead1 100644 --- a/python-api-src/lib_unit.cpp +++ b/python-api-src/lib_unit.cpp @@ -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) diff --git a/python-api-src/lib_unittype.cpp b/python-api-src/lib_unittype.cpp index 935b58c10987e186929d577122dd572791011f7d..35313deacf2f308b88347d6c789d200b3ab5f333 100644 --- a/python-api-src/lib_unittype.cpp +++ b/python-api-src/lib_unittype.cpp @@ -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") diff --git a/python-api-src/library.cpp b/python-api-src/library.cpp index 7d883378fd8870c1e0a9cb7c65eb905332e69eba..721ad62e2d4ac4bd9eefe663670befaf7c85065f 100644 --- a/python-api-src/library.cpp +++ b/python-api-src/library.cpp @@ -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") diff --git a/src/Unit.cpp b/src/Unit.cpp index 4c6290216f33da0068237e394bd28600e114a93e..15277c8cb352e78a630186c39e66581aa6535660 100644 --- a/src/Unit.cpp +++ b/src/Unit.cpp @@ -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 diff --git a/src/Unit.h b/src/Unit.h index 0872d7bfd29a160cafac1280eb81dc3132c7fcf3..f9c51a711658f49ed53787aba5e4832c3236bc7d 100644 --- a/src/Unit.h +++ b/src/Unit.h @@ -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; diff --git a/src/UnitType.cpp b/src/UnitType.cpp index b3478af36a9064436d90a89ddb3535312d3a87a7..2ace51fcb02044edfcb3c3209d94787526e3962b 100644 --- a/src/UnitType.cpp +++ b/src/UnitType.cpp @@ -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; +} diff --git a/src/UnitType.h b/src/UnitType.h index b3458fa83d65b6ca3316b29db1327efcb765c4b1..8f9d9755a634e6058bff62eca9cf0cbd0679ec7b 100644 --- a/src/UnitType.h +++ b/src/UnitType.h @@ -22,6 +22,8 @@ public: std::string getName() const; CCRace getRace() const; + + int getMovementSpeed() const; bool isValid() const; bool isBuilding() const;