Newer
Older
#include "library.h"
namespace py = pybind11;
void define_replay_unit(py::module & m)
{
.def_property_readonly("id", &ReplayUnit::getID, "The ID of the unit")
.def_property_readonly("unit_type", &ReplayUnit::getType, "The :class:`commandcenter.UnitType` of the unit")
.def_property_readonly("position", &ReplayUnit::getPosition, "The :class:`commandcenter.Point2D` of the unit")
.def_property_readonly("tile_position", &ReplayUnit::getTilePosition, "The :class:`commandcenter.Point2DI` of the unit")
.def_property_readonly("hit_points", &ReplayUnit::getHitPoints, "The hit points of the unit")
.def_property_readonly("shields", &ReplayUnit::getShields, "The shields of the unit")
.def_property_readonly("energy", &ReplayUnit::getEnergy, "The energy of the unit")
.def_property_readonly("player", &ReplayUnit::getPlayer, "Returns the constant corresponding to player which this unit belongs to. See :ref:`playerconstants` for more information.")
.def_property_readonly("build_percentage", &ReplayUnit::getBuildPercentage, "The build percentage of the unit")
.def_property_readonly("weapon_cooldown", &ReplayUnit::getWeaponCooldown, "The weapon cooldown of the unit")
.def_property_readonly("is_completed", &ReplayUnit::isCompleted, "Whether the unit is completed, returns build_progress >= 1")
.def_property_readonly("is_being_constructed", &ReplayUnit::isBeingConstructed, "Whether the unit is being constructed, returns build_progress > 0")
.def_property_readonly("is_cloaked", &ReplayUnit::isCloaked, "Whether the unit is cloaked")
.def_property_readonly("is_flying", &ReplayUnit::isFlying, "Whether the unit is flying")
.def_property_readonly("buffs", &ReplayUnit::buffs, "Returns a list of BuffIDs representing the buffs on the unit")
.def_property_readonly("is_alive", &ReplayUnit::isAlive, "Whether the unit is alive")
.def_property_readonly("is_powered", &ReplayUnit::isPowered, "Whether the unit is powered")
.def_property_readonly("is_idle", &ReplayUnit::isIdle, "Whether the unit is idle")
.def_property_readonly("is_burrowed", &ReplayUnit::isBurrowed, "Whether the unit is burrowed")
.def_property_readonly("is_valid", &ReplayUnit::isValid, "Whether the unit is valid")
.def_property_readonly("is_training", &ReplayUnit::isTraining, "Whether the unit is training")
.def_property_readonly("is_blip", &ReplayUnit::isBlip, "Whether the unit is a blip ie a ping on the map")
.def_property_readonly("target", &ReplayUnit::getTarget, "The target of the unit")
.def_property_readonly("has_target", &ReplayUnit::hasTarget, "Whether the unit has a target")
.def_property_readonly("max_hit_points", &ReplayUnit::getMaxHitPoints, "The maximum hit points of the unit")
.def_property_readonly("progress", &ReplayUnit::getProgress, "Returns the progress of currently used ability (-1 if not using ability)")
.def_property_readonly("current_ability_id", &ReplayUnit::getCurrentAbilityID, "The AbilityID of currently used ability")
.def_property_readonly("facing", &ReplayUnit::getFacing, "Returns the direction the unit is facing")
.def_property_readonly("radius", &ReplayUnit::getRadius, "The radius of the unit")
.def_property_readonly("is_carrying_minerals", &ReplayUnit::isCarryingMinerals, "Whether the unit is carrying minerals")
.def("__hash__", [](const ReplayUnit & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); })
.def("__repr__", [](const ReplayUnit & unit) { return "<Unit of type: '" + unit.getType().getName() + "'>"; })
.doc() = R"(
The ReplayUnit class is used to represent a unit in a replay of a game.
A ReplayUnit is a :class:`commandcenter.Unit` white some limitations.
It provides various properties and methods to access information about the unit, such as its ID, type, position, hit points, energy, and more.
It is possible to use ReplayUnit as keys in a dictionary, which might be helpful for bookkeeping.
)";