Data Objects

Objects representing in-game objects.

Unit

class sc2reader.data.Unit(unit_id)

Represents an in-game unit.

is_army

Boolean flagging units as army units.

is_building

Boolean flagging units as buildings.

is_worker

Boolean flagging units as worker units. SCV, MULE, Drone, Probe

minerals

The mineral cost of the unit. None if no type is assigned

name

The name of the unit type currently active. None if no type is assigned

race

The race of this unit. One of Terran, Protoss, Zerg, Neutral, or None

supply

The supply used by this unit. Negative for supply providers. None if no type is assigned

type

The internal type id of the current unit type of this unit. None if no type is assigned

vespene

The vespene cost of the unit. None if no type is assigned

Ability

class sc2reader.data.Ability(id, name=None, title=None, is_build=False, build_time=0, build_unit=None)

Represents an in-game ability

Build

class sc2reader.data.Build(build_id)
Parameters:build_id – The build number identifying this dataset.

The datapack for a particualr group of builds. Maps internal integer ids to Unit and Ability types. Also contains builder methods for creating new units and changing their types.

All build data is valid for standard games only. For arcade maps milage may vary.

change_type(unit, new_type, frame)
Parameters:
  • unit – The changing types.
  • unit_type – The unit type to assign to this unit

Assigns the given type to a unit.

create_unit(unit_id, unit_type, frame)
Parameters:
  • unit_id – The unique id of this unit.
  • unit_type – The unit type to assign to the new unit

Creates a new unit and assigns it to the specified type.