# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_Location(self._ptr)
_check_errors()
@staticmethod
def new_on_map(map_location):
# type: (MapLocation) -> Location
'''Constructs a new location on the map.
:type map_location: MapLocation
:rtype: Location
'''
result = _lib.bc_Location_new_on_map(map_location._ptr)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@staticmethod
def new_in_garrison(id):
# type: (int) -> Location
'''Constructs a new location in a garrison.
:type id: int
:rtype: Location
'''
result = _lib.bc_Location_new_in_garrison(id)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@staticmethod
def new_in_space():
# type: () -> Location
'''Constructs a new location in space.
:rtype: Location
'''
result = _lib.bc_Location_new_in_space()
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_on_map(self):
# type: () -> bool
'''Whether the unit is on a map.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_on_map(self._ptr)
_check_errors()
result = bool(result)
return result
def is_on_planet(self, planet):
# type: (Planet) -> bool
'''True if and only if the location is on the map and on this planet.
:type self: Location
:type planet: Planet
:rtype: bool
'''
result = _lib.bc_Location_is_on_planet(self._ptr, planet)
_check_errors()
result = bool(result)
return result
def map_location(self):
# type: () -> MapLocation
'''The map location of the unit.
* UnitNotOnMap - The unit is in a garrison or in space, and does not
have a map location.
:type self: Location
:rtype: MapLocation
'''
result = _lib.bc_Location_map_location(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_in_garrison(self):
# type: () -> bool
'''Whether the unit is in a garrison.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_in_garrison(self._ptr)
_check_errors()
result = bool(result)
return result
def structure(self):
# type: () -> int
'''The structure whose garrison the unit is in.
* UnitNotInGarrison - the unit is not in a garrison.
:type self: Location
:rtype: int
'''
result = _lib.bc_Location_structure(self._ptr)
_check_errors()
return result
def is_in_space(self):
# type: () -> bool
'''Whether the unit is in space.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_in_space(self._ptr)
_check_errors()
result = bool(result)
return result
def is_adjacent_to(self, o):
# type: (Location) -> bool
'''Determines whether this location is adjacent to the specified location,
including diagonally. Note that squares are not adjacent to themselves,
and squares on different planets are not adjacent to each other. Also,
nothing is adjacent to something not on a map.
:type self: Location
:type o: Location
:rtype: bool
'''
result = _lib.bc_Location_is_adjacent_to(self._ptr, o._ptr)
_check_errors()
result = bool(result)
return result
def is_within_range(self, range, o):
# type: (int, Location) -> bool
'''Whether this location is within the distance squared range of the
specified location, inclusive. False for locations on different planets.
Note that nothing is within the range of something not on the map.
:type self: Location
:type range: int
:type o: Location
:rtype: bool
'''
result = _lib.bc_Location_is_within_range(self._ptr, range, o._ptr)
_check_errors()
result = bool(result)
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a Location
:type self: Location
:rtype: str
'''
result = _lib.bc_Location_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> Location
'''Deep-copy a Location
:type self: Location
:rtype: Location
'''
result = _lib.bc_Location_clone(self._ptr)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __eq__(self, other):
# type: (Location) -> bool
'''Compare two Locations for deep equality.
:type self: Location
:type other: Location
:rtype: bool
'''
result = _lib.bc_Location_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
@staticmethod
def from_json(s):
# type: (str) -> Location
'''Deserialize a Location from a JSON string
:type s: str
:rtype: Location
'''
result = _lib.bc_Location_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a Location to a JSON string
:type self: Location
:rtype: str
'''
result = _lib.bc_Location_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Location
- builtins.object
Static methods
def __init__(
self)
:type self: Location :rtype: Location
def __init__(self):
# type: () -> Location
'''
:type self: Location
:rtype: Location
'''
ptr = _lib.new_bc_Location()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a Location :type self: Location :rtype: Location
def clone(self):
# type: () -> Location
'''Deep-copy a Location
:type self: Location
:rtype: Location
'''
result = _lib.bc_Location_clone(self._ptr)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a Location from a JSON string :type s: str :rtype: Location
@staticmethod
def from_json(s):
# type: (str) -> Location
'''Deserialize a Location from a JSON string
:type s: str
:rtype: Location
'''
result = _lib.bc_Location_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_adjacent_to(
self, o)
Determines whether this location is adjacent to the specified location, including diagonally. Note that squares are not adjacent to themselves, and squares on different planets are not adjacent to each other. Also, nothing is adjacent to something not on a map. :type self: Location :type o: Location :rtype: bool
def is_adjacent_to(self, o):
# type: (Location) -> bool
'''Determines whether this location is adjacent to the specified location,
including diagonally. Note that squares are not adjacent to themselves,
and squares on different planets are not adjacent to each other. Also,
nothing is adjacent to something not on a map.
:type self: Location
:type o: Location
:rtype: bool
'''
result = _lib.bc_Location_is_adjacent_to(self._ptr, o._ptr)
_check_errors()
result = bool(result)
return result
def is_in_garrison(
self)
Whether the unit is in a garrison. :type self: Location :rtype: bool
def is_in_garrison(self):
# type: () -> bool
'''Whether the unit is in a garrison.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_in_garrison(self._ptr)
_check_errors()
result = bool(result)
return result
def is_in_space(
self)
Whether the unit is in space. :type self: Location :rtype: bool
def is_in_space(self):
# type: () -> bool
'''Whether the unit is in space.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_in_space(self._ptr)
_check_errors()
result = bool(result)
return result
def is_on_map(
self)
Whether the unit is on a map. :type self: Location :rtype: bool
def is_on_map(self):
# type: () -> bool
'''Whether the unit is on a map.
:type self: Location
:rtype: bool
'''
result = _lib.bc_Location_is_on_map(self._ptr)
_check_errors()
result = bool(result)
return result
def is_on_planet(
self, planet)
True if and only if the location is on the map and on this planet. :type self: Location :type planet: Planet :rtype: bool
def is_on_planet(self, planet):
# type: (Planet) -> bool
'''True if and only if the location is on the map and on this planet.
:type self: Location
:type planet: Planet
:rtype: bool
'''
result = _lib.bc_Location_is_on_planet(self._ptr, planet)
_check_errors()
result = bool(result)
return result
def is_within_range(
self, range, o)
Whether this location is within the distance squared range of the specified location, inclusive. False for locations on different planets. Note that nothing is within the range of something not on the map. :type self: Location :type range: int :type o: Location :rtype: bool
def is_within_range(self, range, o):
# type: (int, Location) -> bool
'''Whether this location is within the distance squared range of the
specified location, inclusive. False for locations on different planets.
Note that nothing is within the range of something not on the map.
:type self: Location
:type range: int
:type o: Location
:rtype: bool
'''
result = _lib.bc_Location_is_within_range(self._ptr, range, o._ptr)
_check_errors()
result = bool(result)
return result
def map_location(
self)
The map location of the unit.
- UnitNotOnMap - The unit is in a garrison or in space, and does not have a map location. :type self: Location :rtype: MapLocation
def map_location(self):
# type: () -> MapLocation
'''The map location of the unit.
* UnitNotOnMap - The unit is in a garrison or in space, and does not
have a map location.
:type self: Location
:rtype: MapLocation
'''
result = _lib.bc_Location_map_location(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def new_in_garrison(
id)
Constructs a new location in a garrison. :type id: int :rtype: Location
@staticmethod
def new_in_garrison(id):
# type: (int) -> Location
'''Constructs a new location in a garrison.
:type id: int
:rtype: Location
'''
result = _lib.bc_Location_new_in_garrison(id)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def new_in_space(
)
Constructs a new location in space. :rtype: Location
@staticmethod
def new_in_space():
# type: () -> Location
'''Constructs a new location in space.
:rtype: Location
'''
result = _lib.bc_Location_new_in_space()
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def new_on_map(
map_location)
Constructs a new location on the map. :type map_location: MapLocation :rtype: Location
@staticmethod
def new_on_map(map_location):
# type: (MapLocation) -> Location
'''Constructs a new location on the map.
:type map_location: MapLocation
:rtype: Location
'''
result = _lib.bc_Location_new_on_map(map_location._ptr)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def structure(
self)
The structure whose garrison the unit is in.
- UnitNotInGarrison - the unit is not in a garrison. :type self: Location :rtype: int
def structure(self):
# type: () -> int
'''The structure whose garrison the unit is in.
* UnitNotInGarrison - the unit is not in a garrison.
:type self: Location
:rtype: int
'''
result = _lib.bc_Location_structure(self._ptr)
_check_errors()
return result
def to_json(
self)
Serialize a Location to a JSON string :type self: Location :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a Location to a JSON string
:type self: Location
:rtype: str
'''
result = _lib.bc_Location_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class MapLocation
class MapLocation(object):
__slots__ = ['_ptr']
def __init__(self, planet, x, y):
# type: (Planet, int, int) -> MapLocation
'''Returns a new MapLocation representing the location with the given
coordinates on a planet.
:type self: MapLocation
:type planet: Planet
:type x: int
:type y: int
:rtype: MapLocation
'''
ptr = _lib.new_bc_MapLocation(planet, x, y)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: MapLocation
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_MapLocation(self._ptr)
_check_errors()
@property
def planet(self):
# type: () -> Planet
'''The planet of the map location.
:type self: MapLocation
:rtype: Planet
'''
result = _lib.bc_MapLocation_planet_get(self._ptr)
_check_errors()
result = Planet(result)
return result
@property
def x(self):
# type: () -> int
'''The x coordinate of the map location.
:type self: MapLocation
:rtype: int
'''
result = _lib.bc_MapLocation_x_get(self._ptr)
_check_errors()
return result
@property
def y(self):
# type: () -> int
'''The y coordinate of the map location.
:type self: MapLocation
:rtype: int
'''
result = _lib.bc_MapLocation_y_get(self._ptr)
_check_errors()
return result
@planet.setter
def planet(self, planet):
# type: (Planet) -> None
'''The planet of the map location.
:type self: MapLocation
:type planet: Planet
:rtype: None
'''
result = _lib.bc_MapLocation_planet_set(self._ptr, planet)
_check_errors()
return result
@x.setter
def x(self, x):
# type: (int) -> None
'''The x coordinate of the map location.
:type self: MapLocation
:type x: int
:rtype: None
'''
result = _lib.bc_MapLocation_x_set(self._ptr, x)
_check_errors()
return result
@y.setter
def y(self, y):
# type: (int) -> None
'''The y coordinate of the map location.
:type self: MapLocation
:type y: int
:rtype: None
'''
result = _lib.bc_MapLocation_y_set(self._ptr, y)
_check_errors()
return result
def add(self, direction):
# type: (Direction) -> MapLocation
'''Returns the location one square from this one in the given direction.
:type self: MapLocation
:type direction: Direction
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_add(self._ptr, direction)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def subtract(self, direction):
# type: (Direction) -> MapLocation
'''Returns the location one square from this one in the opposite direction.
:type self: MapLocation
:type direction: Direction
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_subtract(self._ptr, direction)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def add_multiple(self, direction, multiple):
# type: (Direction, int) -> MapLocation
'''Returns the location `multiple` squares from this one in the given
direction.
:type self: MapLocation
:type direction: Direction
:type multiple: int
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_add_multiple(self._ptr, direction, multiple)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def translate(self, dx, dy):
# type: (int, int) -> MapLocation
'''Returns the location translated from this location by `dx` in the x
direction and `dy` in the y direction.
:type self: MapLocation
:type dx: int
:type dy: int
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_translate(self._ptr, dx, dy)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def distance_squared_to(self, o):
# type: (MapLocation) -> int
'''Computes the square of the distance from this location to the specified
location. If on different planets, returns the maximum integer.
:type self: MapLocation
:type o: MapLocation
:rtype: int
'''
result = _lib.bc_MapLocation_distance_squared_to(self._ptr, o._ptr)
_check_errors()
return result
def direction_to(self, o):
# type: (MapLocation) -> Direction
'''Returns the Direction from this location to the specified location.
If the locations are equal this method returns Center.
* DifferentPlanet - The locations are on different planets.
:type self: MapLocation
:type o: MapLocation
:rtype: Direction
'''
result = _lib.bc_MapLocation_direction_to(self._ptr, o._ptr)
_check_errors()
result = Direction(result)
return result
def is_adjacent_to(self, o):
# type: (MapLocation) -> bool
'''
Determines whether this location is adjacent to the specified location,
including diagonally. Note that squares are not adjacent to themselves,
and squares on different planets are not adjacent to each other.
:type self: MapLocation
:type o: MapLocation
:rtype: bool
'''
result = _lib.bc_MapLocation_is_adjacent_to(self._ptr, o._ptr)
_check_errors()
result = bool(result)
return result
def is_within_range(self, range, o):
# type: (int, MapLocation) -> bool
'''
Whether this location is within the distance squared range of the
specified location, inclusive. False for locations on different planets.
:type self: MapLocation
:type range: int
:type o: MapLocation
:rtype: bool
'''
result = _lib.bc_MapLocation_is_within_range(self._ptr, range, o._ptr)
_check_errors()
result = bool(result)
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a MapLocation
:type self: MapLocation
:rtype: str
'''
result = _lib.bc_MapLocation_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> MapLocation
'''Deep-copy a MapLocation
:type self: MapLocation
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_clone(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __eq__(self, other):
# type: (MapLocation) -> bool
'''Compare two MapLocations for deep equality.
:type self: MapLocation
:type other: MapLocation
:rtype: bool
'''
result = _lib.bc_MapLocation_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
@staticmethod
def from_json(s):
# type: (str) -> MapLocation
'''Deserialize a MapLocation from a JSON string
:type s: str
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_from_json(_ffi.new("char[]", s))
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a MapLocation to a JSON string
:type self: MapLocation
:rtype: str
'''
result = _lib.bc_MapLocation_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- MapLocation
- builtins.object
Static methods
def __init__(
self, planet, x, y)
Returns a new MapLocation representing the location with the given coordinates on a planet. :type self: MapLocation :type planet: Planet :type x: int :type y: int :rtype: MapLocation
def __init__(self, planet, x, y):
# type: (Planet, int, int) -> MapLocation
'''Returns a new MapLocation representing the location with the given
coordinates on a planet.
:type self: MapLocation
:type planet: Planet
:type x: int
:type y: int
:rtype: MapLocation
'''
ptr = _lib.new_bc_MapLocation(planet, x, y)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def add(
self, direction)
Returns the location one square from this one in the given direction. :type self: MapLocation :type direction: Direction :rtype: MapLocation
def add(self, direction):
# type: (Direction) -> MapLocation
'''Returns the location one square from this one in the given direction.
:type self: MapLocation
:type direction: Direction
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_add(self._ptr, direction)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def add_multiple(
self, direction, multiple)
Returns the location multiple
squares from this one in the given
direction.
:type self: MapLocation
:type direction: Direction
:type multiple: int
:rtype: MapLocation
def add_multiple(self, direction, multiple):
# type: (Direction, int) -> MapLocation
'''Returns the location `multiple` squares from this one in the given
direction.
:type self: MapLocation
:type direction: Direction
:type multiple: int
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_add_multiple(self._ptr, direction, multiple)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def clone(
self)
Deep-copy a MapLocation :type self: MapLocation :rtype: MapLocation
def clone(self):
# type: () -> MapLocation
'''Deep-copy a MapLocation
:type self: MapLocation
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_clone(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def direction_to(
self, o)
Returns the Direction from this location to the specified location. If the locations are equal this method returns Center.
- DifferentPlanet - The locations are on different planets. :type self: MapLocation :type o: MapLocation :rtype: Direction
def direction_to(self, o):
# type: (MapLocation) -> Direction
'''Returns the Direction from this location to the specified location.
If the locations are equal this method returns Center.
* DifferentPlanet - The locations are on different planets.
:type self: MapLocation
:type o: MapLocation
:rtype: Direction
'''
result = _lib.bc_MapLocation_direction_to(self._ptr, o._ptr)
_check_errors()
result = Direction(result)
return result
def distance_squared_to(
self, o)
Computes the square of the distance from this location to the specified location. If on different planets, returns the maximum integer. :type self: MapLocation :type o: MapLocation :rtype: int
def distance_squared_to(self, o):
# type: (MapLocation) -> int
'''Computes the square of the distance from this location to the specified
location. If on different planets, returns the maximum integer.
:type self: MapLocation
:type o: MapLocation
:rtype: int
'''
result = _lib.bc_MapLocation_distance_squared_to(self._ptr, o._ptr)
_check_errors()
return result
def from_json(
s)
Deserialize a MapLocation from a JSON string :type s: str :rtype: MapLocation
@staticmethod
def from_json(s):
# type: (str) -> MapLocation
'''Deserialize a MapLocation from a JSON string
:type s: str
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_from_json(_ffi.new("char[]", s))
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_adjacent_to(
self, o)
Determines whether this location is adjacent to the specified location, including diagonally. Note that squares are not adjacent to themselves, and squares on different planets are not adjacent to each other. :type self: MapLocation :type o: MapLocation :rtype: bool
def is_adjacent_to(self, o):
# type: (MapLocation) -> bool
'''
Determines whether this location is adjacent to the specified location,
including diagonally. Note that squares are not adjacent to themselves,
and squares on different planets are not adjacent to each other.
:type self: MapLocation
:type o: MapLocation
:rtype: bool
'''
result = _lib.bc_MapLocation_is_adjacent_to(self._ptr, o._ptr)
_check_errors()
result = bool(result)
return result
def is_within_range(
self, range, o)
Whether this location is within the distance squared range of the specified location, inclusive. False for locations on different planets. :type self: MapLocation :type range: int :type o: MapLocation :rtype: bool
def is_within_range(self, range, o):
# type: (int, MapLocation) -> bool
'''
Whether this location is within the distance squared range of the
specified location, inclusive. False for locations on different planets.
:type self: MapLocation
:type range: int
:type o: MapLocation
:rtype: bool
'''
result = _lib.bc_MapLocation_is_within_range(self._ptr, range, o._ptr)
_check_errors()
result = bool(result)
return result
def subtract(
self, direction)
Returns the location one square from this one in the opposite direction. :type self: MapLocation :type direction: Direction :rtype: MapLocation
def subtract(self, direction):
# type: (Direction) -> MapLocation
'''Returns the location one square from this one in the opposite direction.
:type self: MapLocation
:type direction: Direction
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_subtract(self._ptr, direction)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a MapLocation to a JSON string :type self: MapLocation :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a MapLocation to a JSON string
:type self: MapLocation
:rtype: str
'''
result = _lib.bc_MapLocation_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def translate(
self, dx, dy)
Returns the location translated from this location by dx
in the x
direction and dy
in the y direction.
:type self: MapLocation
:type dx: int
:type dy: int
:rtype: MapLocation
def translate(self, dx, dy):
# type: (int, int) -> MapLocation
'''Returns the location translated from this location by `dx` in the x
direction and `dy` in the y direction.
:type self: MapLocation
:type dx: int
:type dy: int
:rtype: MapLocation
'''
result = _lib.bc_MapLocation_translate(self._ptr, dx, dy)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
Instance variables
var planet
The planet of the map location. :type self: MapLocation :rtype: Planet
var x
The x coordinate of the map location. :type self: MapLocation :rtype: int
var y
The y coordinate of the map location. :type self: MapLocation :rtype: int
class OrbitPattern
class OrbitPattern(object):
__slots__ = ['_ptr']
def __init__(self, amplitude, period, center):
# type: (int, int, int) -> OrbitPattern
'''Construct a new orbit pattern. This pattern is a sinusoidal function y=a*sin(bx)+c, where the x-axis is the round number of takeoff and the the y-axis is the duration of flight to the nearest integer.
The amplitude, period, and center are measured in rounds.
:type self: OrbitPattern
:type amplitude: int
:type period: int
:type center: int
:rtype: OrbitPattern
'''
ptr = _lib.new_bc_OrbitPattern(amplitude, period, center)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: OrbitPattern
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_OrbitPattern(self._ptr)
_check_errors()
@property
def amplitude(self):
# type: () -> int
'''Amplitude of the orbit.
:type self: OrbitPattern
:rtype: int
'''
result = _lib.bc_OrbitPattern_amplitude_get(self._ptr)
_check_errors()
return result
@property
def period(self):
# type: () -> int
'''The period of the orbit.
:type self: OrbitPattern
:rtype: int
'''
result = _lib.bc_OrbitPattern_period_get(self._ptr)
_check_errors()
return result
@property
def center(self):
# type: () -> int
'''The center of the orbit.
:type self: OrbitPattern
:rtype: int
'''
result = _lib.bc_OrbitPattern_center_get(self._ptr)
_check_errors()
return result
@amplitude.setter
def amplitude(self, amplitude):
# type: (int) -> None
'''Amplitude of the orbit.
:type self: OrbitPattern
:type amplitude: int
:rtype: None
'''
result = _lib.bc_OrbitPattern_amplitude_set(self._ptr, amplitude)
_check_errors()
return result
@period.setter
def period(self, period):
# type: (int) -> None
'''The period of the orbit.
:type self: OrbitPattern
:type period: int
:rtype: None
'''
result = _lib.bc_OrbitPattern_period_set(self._ptr, period)
_check_errors()
return result
@center.setter
def center(self, center):
# type: (int) -> None
'''The center of the orbit.
:type self: OrbitPattern
:type center: int
:rtype: None
'''
result = _lib.bc_OrbitPattern_center_set(self._ptr, center)
_check_errors()
return result
def validate(self):
# type: () -> None
'''Validates the orbit pattern.
* InvalidMapObject - the orbit pattern is invalid.
:type self: OrbitPattern
:rtype: None
'''
result = _lib.bc_OrbitPattern_validate(self._ptr)
_check_errors()
return result
def duration(self, round):
# type: (int) -> int
'''Get the duration of flight if the rocket were to take off from either planet on the given round.
:type self: OrbitPattern
:type round: int
:rtype: int
'''
result = _lib.bc_OrbitPattern_duration(self._ptr, round)
_check_errors()
return result
@staticmethod
def from_json(s):
# type: (str) -> OrbitPattern
'''Deserialize a OrbitPattern from a JSON string
:type s: str
:rtype: OrbitPattern
'''
result = _lib.bc_OrbitPattern_from_json(_ffi.new("char[]", s))
_check_errors()
_result = OrbitPattern.__new__(OrbitPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a OrbitPattern to a JSON string
:type self: OrbitPattern
:rtype: str
'''
result = _lib.bc_OrbitPattern_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- OrbitPattern
- builtins.object
Static methods
def __init__(
self, amplitude, period, center)
Construct a new orbit pattern. This pattern is a sinusoidal function y=a*sin(bx)+c, where the x-axis is the round number of takeoff and the the y-axis is the duration of flight to the nearest integer.
The amplitude, period, and center are measured in rounds. :type self: OrbitPattern :type amplitude: int :type period: int :type center: int :rtype: OrbitPattern
def __init__(self, amplitude, period, center):
# type: (int, int, int) -> OrbitPattern
'''Construct a new orbit pattern. This pattern is a sinusoidal function y=a*sin(bx)+c, where the x-axis is the round number of takeoff and the the y-axis is the duration of flight to the nearest integer.
The amplitude, period, and center are measured in rounds.
:type self: OrbitPattern
:type amplitude: int
:type period: int
:type center: int
:rtype: OrbitPattern
'''
ptr = _lib.new_bc_OrbitPattern(amplitude, period, center)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def duration(
self, round)
Get the duration of flight if the rocket were to take off from either planet on the given round. :type self: OrbitPattern :type round: int :rtype: int
def duration(self, round):
# type: (int) -> int
'''Get the duration of flight if the rocket were to take off from either planet on the given round.
:type self: OrbitPattern
:type round: int
:rtype: int
'''
result = _lib.bc_OrbitPattern_duration(self._ptr, round)
_check_errors()
return result
def from_json(
s)
Deserialize a OrbitPattern from a JSON string :type s: str :rtype: OrbitPattern
@staticmethod
def from_json(s):
# type: (str) -> OrbitPattern
'''Deserialize a OrbitPattern from a JSON string
:type s: str
:rtype: OrbitPattern
'''
result = _lib.bc_OrbitPattern_from_json(_ffi.new("char[]", s))
_check_errors()
_result = OrbitPattern.__new__(OrbitPattern)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a OrbitPattern to a JSON string :type self: OrbitPattern :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a OrbitPattern to a JSON string
:type self: OrbitPattern
:rtype: str
'''
result = _lib.bc_OrbitPattern_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def validate(
self)
Validates the orbit pattern.
- InvalidMapObject - the orbit pattern is invalid. :type self: OrbitPattern :rtype: None
def validate(self):
# type: () -> None
'''Validates the orbit pattern.
* InvalidMapObject - the orbit pattern is invalid.
:type self: OrbitPattern
:rtype: None
'''
result = _lib.bc_OrbitPattern_validate(self._ptr)
_check_errors()
return result
Instance variables
var amplitude
Amplitude of the orbit. :type self: OrbitPattern :rtype: int
var center
The center of the orbit. :type self: OrbitPattern :rtype: int
var period
The period of the orbit. :type self: OrbitPattern :rtype: int
class Planet
An enumeration.
class Planet(enum.IntEnum):
Earth = 0
Mars = 1
def other(self):
# type: () -> Planet
'''The other planet.
:type self: Planet
:rtype: Planet
'''
result = _lib.bc_Planet_other(self)
_check_errors()
result = Planet(result)
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a Planet
:type self: Planet
:rtype: str
'''
result = _lib.bc_Planet_debug(self)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __eq__(self, other):
# type: (Planet) -> bool
'''Compare two Planets for deep equality.
:type self: Planet
:type other: Planet
:rtype: bool
'''
result = _lib.bc_Planet_eq(self, other)
_check_errors()
result = bool(result)
return result
@staticmethod
def from_json(s):
# type: (str) -> Planet
'''Deserialize a Planet from a JSON string
:type s: str
:rtype: Planet
'''
result = _lib.bc_Planet_from_json(_ffi.new("char[]", s))
_check_errors()
result = Planet(result)
return result
def to_json(self):
# type: () -> str
'''Serialize a Planet to a JSON string
:type self: Planet
:rtype: str
'''
result = _lib.bc_Planet_to_json(self)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Planet
- enum.IntEnum
- builtins.int
- enum.Enum
- builtins.object
Class variables
var Earth
var Mars
class PlanetMap
class PlanetMap(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> PlanetMap
'''The map for one of the planets in the Battlecode world. This information defines the terrain, dimensions, and initial units of the planet.
:type self: PlanetMap
:rtype: PlanetMap
'''
ptr = _lib.new_bc_PlanetMap()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: PlanetMap
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_PlanetMap(self._ptr)
_check_errors()
@property
def planet(self):
# type: () -> Planet
'''The planet of the map.
:type self: PlanetMap
:rtype: Planet
'''
result = _lib.bc_PlanetMap_planet_get(self._ptr)
_check_errors()
result = Planet(result)
return result
@property
def height(self):
# type: () -> int
'''The height of this map, in squares. Must be in the range [MAP_HEIGHT_MIN, MAP_HEIGHT_MAX], inclusive.
:type self: PlanetMap
:rtype: int
'''
result = _lib.bc_PlanetMap_height_get(self._ptr)
_check_errors()
return result
@property
def width(self):
# type: () -> int
'''The height of this map, in squares. Must be in the range [MAP_WIDTH_MIN, MAP_WIDTH_MAX], inclusive.
:type self: PlanetMap
:rtype: int
'''
result = _lib.bc_PlanetMap_width_get(self._ptr)
_check_errors()
return result
@property
def initial_units(self):
# type: () -> VecUnit
'''The initial units on the map. Each team starts with 1 to 3 Workers on Earth.
:type self: PlanetMap
:rtype: VecUnit
'''
result = _lib.bc_PlanetMap_initial_units_get(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@planet.setter
def planet(self, planet):
# type: (Planet) -> None
'''The planet of the map.
:type self: PlanetMap
:type planet: Planet
:rtype: None
'''
result = _lib.bc_PlanetMap_planet_set(self._ptr, planet)
_check_errors()
return result
@height.setter
def height(self, height):
# type: (int) -> None
'''The height of this map, in squares. Must be in the range [MAP_HEIGHT_MIN, MAP_HEIGHT_MAX], inclusive.
:type self: PlanetMap
:type height: int
:rtype: None
'''
result = _lib.bc_PlanetMap_height_set(self._ptr, height)
_check_errors()
return result
@width.setter
def width(self, width):
# type: (int) -> None
'''The height of this map, in squares. Must be in the range [MAP_WIDTH_MIN, MAP_WIDTH_MAX], inclusive.
:type self: PlanetMap
:type width: int
:rtype: None
'''
result = _lib.bc_PlanetMap_width_set(self._ptr, width)
_check_errors()
return result
@initial_units.setter
def initial_units(self, initial_units):
# type: (VecUnit) -> None
'''The initial units on the map. Each team starts with 1 to 3 Workers on Earth.
:type self: PlanetMap
:type initial_units: VecUnit
:rtype: None
'''
result = _lib.bc_PlanetMap_initial_units_set(self._ptr, initial_units._ptr)
_check_errors()
return result
def validate(self):
# type: () -> None
'''Validates the map and checks some invariants are followed.
* InvalidMapObject - the planet map is invalid.
:type self: PlanetMap
:rtype: None
'''
result = _lib.bc_PlanetMap_validate(self._ptr)
_check_errors()
return result
def on_map(self, location):
# type: (MapLocation) -> bool
'''Whether a location is on the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_PlanetMap_on_map(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def is_passable_terrain_at(self, location):
# type: (MapLocation) -> bool
'''
Whether the location on the map contains passable terrain. Is only false when the square contains impassable terrain (distinct from containing a building, for instance).
LocationOffMap - the location is off the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_PlanetMap_is_passable_terrain_at(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def initial_karbonite_at(self, location):
# type: (MapLocation) -> int
'''The amount of Karbonite initially deposited at the given location.
LocationOffMap - the location is off the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: int
'''
result = _lib.bc_PlanetMap_initial_karbonite_at(self._ptr, location._ptr)
_check_errors()
return result
def clone(self):
# type: () -> PlanetMap
'''Deep-copy a PlanetMap
:type self: PlanetMap
:rtype: PlanetMap
'''
result = _lib.bc_PlanetMap_clone(self._ptr)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> PlanetMap
'''Deserialize a PlanetMap from a JSON string
:type s: str
:rtype: PlanetMap
'''
result = _lib.bc_PlanetMap_from_json(_ffi.new("char[]", s))
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a PlanetMap to a JSON string
:type self: PlanetMap
:rtype: str
'''
result = _lib.bc_PlanetMap_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- PlanetMap
- builtins.object
Static methods
def __init__(
self)
The map for one of the planets in the Battlecode world. This information defines the terrain, dimensions, and initial units of the planet. :type self: PlanetMap :rtype: PlanetMap
def __init__(self):
# type: () -> PlanetMap
'''The map for one of the planets in the Battlecode world. This information defines the terrain, dimensions, and initial units of the planet.
:type self: PlanetMap
:rtype: PlanetMap
'''
ptr = _lib.new_bc_PlanetMap()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a PlanetMap :type self: PlanetMap :rtype: PlanetMap
def clone(self):
# type: () -> PlanetMap
'''Deep-copy a PlanetMap
:type self: PlanetMap
:rtype: PlanetMap
'''
result = _lib.bc_PlanetMap_clone(self._ptr)
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a PlanetMap from a JSON string :type s: str :rtype: PlanetMap
@staticmethod
def from_json(s):
# type: (str) -> PlanetMap
'''Deserialize a PlanetMap from a JSON string
:type s: str
:rtype: PlanetMap
'''
result = _lib.bc_PlanetMap_from_json(_ffi.new("char[]", s))
_check_errors()
_result = PlanetMap.__new__(PlanetMap)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def initial_karbonite_at(
self, location)
The amount of Karbonite initially deposited at the given location.
LocationOffMap - the location is off the map. :type self: PlanetMap :type location: MapLocation :rtype: int
def initial_karbonite_at(self, location):
# type: (MapLocation) -> int
'''The amount of Karbonite initially deposited at the given location.
LocationOffMap - the location is off the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: int
'''
result = _lib.bc_PlanetMap_initial_karbonite_at(self._ptr, location._ptr)
_check_errors()
return result
def is_passable_terrain_at(
self, location)
Whether the location on the map contains passable terrain. Is only false when the square contains impassable terrain (distinct from containing a building, for instance).
LocationOffMap - the location is off the map. :type self: PlanetMap :type location: MapLocation :rtype: bool
def is_passable_terrain_at(self, location):
# type: (MapLocation) -> bool
'''
Whether the location on the map contains passable terrain. Is only false when the square contains impassable terrain (distinct from containing a building, for instance).
LocationOffMap - the location is off the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_PlanetMap_is_passable_terrain_at(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def on_map(
self, location)
Whether a location is on the map. :type self: PlanetMap :type location: MapLocation :rtype: bool
def on_map(self, location):
# type: (MapLocation) -> bool
'''Whether a location is on the map.
:type self: PlanetMap
:type location: MapLocation
:rtype: bool
'''
result = _lib.bc_PlanetMap_on_map(self._ptr, location._ptr)
_check_errors()
result = bool(result)
return result
def to_json(
self)
Serialize a PlanetMap to a JSON string :type self: PlanetMap :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a PlanetMap to a JSON string
:type self: PlanetMap
:rtype: str
'''
result = _lib.bc_PlanetMap_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def validate(
self)
Validates the map and checks some invariants are followed.
- InvalidMapObject - the planet map is invalid. :type self: PlanetMap :rtype: None
def validate(self):
# type: () -> None
'''Validates the map and checks some invariants are followed.
* InvalidMapObject - the planet map is invalid.
:type self: PlanetMap
:rtype: None
'''
result = _lib.bc_PlanetMap_validate(self._ptr)
_check_errors()
return result
Instance variables
var height
The height of this map, in squares. Must be in the range [MAP_HEIGHT_MIN, MAP_HEIGHT_MAX], inclusive. :type self: PlanetMap :rtype: int
var initial_units
The initial units on the map. Each team starts with 1 to 3 Workers on Earth. :type self: PlanetMap :rtype: VecUnit
var planet
The planet of the map. :type self: PlanetMap :rtype: Planet
var width
The height of this map, in squares. Must be in the range [MAP_WIDTH_MIN, MAP_WIDTH_MAX], inclusive. :type self: PlanetMap :rtype: int
class Player
class Player(object):
__slots__ = ['_ptr']
def __init__(self, team, planet):
# type: (Team, Planet) -> Player
'''
:type self: Player
:type team: Team
:type planet: Planet
:rtype: Player
'''
ptr = _lib.new_bc_Player(team, planet)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: Player
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_Player(self._ptr)
_check_errors()
@property
def team(self):
# type: () -> Team
'''
:type self: Player
:rtype: Team
'''
result = _lib.bc_Player_team_get(self._ptr)
_check_errors()
result = Team(result)
return result
@property
def planet(self):
# type: () -> Planet
'''
:type self: Player
:rtype: Planet
'''
result = _lib.bc_Player_planet_get(self._ptr)
_check_errors()
result = Planet(result)
return result
@team.setter
def team(self, team):
# type: (Team) -> None
'''
:type self: Player
:type team: Team
:rtype: None
'''
result = _lib.bc_Player_team_set(self._ptr, team)
_check_errors()
return result
@planet.setter
def planet(self, planet):
# type: (Planet) -> None
'''
:type self: Player
:type planet: Planet
:rtype: None
'''
result = _lib.bc_Player_planet_set(self._ptr, planet)
_check_errors()
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a Player
:type self: Player
:rtype: str
'''
result = _lib.bc_Player_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> Player
'''Deep-copy a Player
:type self: Player
:rtype: Player
'''
result = _lib.bc_Player_clone(self._ptr)
_check_errors()
_result = Player.__new__(Player)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __eq__(self, other):
# type: (Player) -> bool
'''Compare two Players for deep equality.
:type self: Player
:type other: Player
:rtype: bool
'''
result = _lib.bc_Player_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
@staticmethod
def from_json(s):
# type: (str) -> Player
'''Deserialize a Player from a JSON string
:type s: str
:rtype: Player
'''
result = _lib.bc_Player_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Player.__new__(Player)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a Player to a JSON string
:type self: Player
:rtype: str
'''
result = _lib.bc_Player_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Player
- builtins.object
Static methods
def __init__(
self, team, planet)
:type self: Player :type team: Team :type planet: Planet :rtype: Player
def __init__(self, team, planet):
# type: (Team, Planet) -> Player
'''
:type self: Player
:type team: Team
:type planet: Planet
:rtype: Player
'''
ptr = _lib.new_bc_Player(team, planet)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a Player :type self: Player :rtype: Player
def clone(self):
# type: () -> Player
'''Deep-copy a Player
:type self: Player
:rtype: Player
'''
result = _lib.bc_Player_clone(self._ptr)
_check_errors()
_result = Player.__new__(Player)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a Player from a JSON string :type s: str :rtype: Player
@staticmethod
def from_json(s):
# type: (str) -> Player
'''Deserialize a Player from a JSON string
:type s: str
:rtype: Player
'''
result = _lib.bc_Player_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Player.__new__(Player)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a Player to a JSON string :type self: Player :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a Player to a JSON string
:type self: Player
:rtype: str
'''
result = _lib.bc_Player_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var planet
:type self: Player :rtype: Planet
var team
:type self: Player :rtype: Team
class ResearchInfo
class ResearchInfo(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> ResearchInfo
'''Construct an initial research state.
:type self: ResearchInfo
:rtype: ResearchInfo
'''
ptr = _lib.new_bc_ResearchInfo()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: ResearchInfo
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_ResearchInfo(self._ptr)
_check_errors()
def get_level(self, branch):
# type: (UnitType) -> int
'''Returns the current level of the research branch.
:type self: ResearchInfo
:type branch: UnitType
:rtype: int
'''
result = _lib.bc_ResearchInfo_get_level(self._ptr, branch)
_check_errors()
return result
@property
def queue(self):
# type: () -> VecUnitType
'''Returns the research queue, where the front of the queue is at the beginning of the list.
:type self: ResearchInfo
:rtype: VecUnitType
'''
result = _lib.bc_ResearchInfo_queue(self._ptr)
_check_errors()
_result = VecUnitType.__new__(VecUnitType)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def has_next_in_queue(self):
# type: () -> bool
'''Whether there is a branch in the research queue.
:type self: ResearchInfo
:rtype: bool
'''
result = _lib.bc_ResearchInfo_has_next_in_queue(self._ptr)
_check_errors()
result = bool(result)
return result
def next_in_queue(self):
# type: () -> UnitType
'''Returns the next branch to be researched, which is the branch at the front of the research queue.
* NullValue - There is no branch to be researched.
:type self: ResearchInfo
:rtype: UnitType
'''
result = _lib.bc_ResearchInfo_next_in_queue(self._ptr)
_check_errors()
result = UnitType(result)
return result
def rounds_left(self):
# type: () -> int
'''Returns the number of rounds left until the upgrade at the front of the research queue is applied.
* NullValue - There is no branch to be researched.
:type self: ResearchInfo
:rtype: int
'''
result = _lib.bc_ResearchInfo_rounds_left(self._ptr)
_check_errors()
return result
@staticmethod
def from_json(s):
# type: (str) -> ResearchInfo
'''Deserialize a ResearchInfo from a JSON string
:type s: str
:rtype: ResearchInfo
'''
result = _lib.bc_ResearchInfo_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ResearchInfo.__new__(ResearchInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a ResearchInfo to a JSON string
:type self: ResearchInfo
:rtype: str
'''
result = _lib.bc_ResearchInfo_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- ResearchInfo
- builtins.object
Static methods
def __init__(
self)
Construct an initial research state. :type self: ResearchInfo :rtype: ResearchInfo
def __init__(self):
# type: () -> ResearchInfo
'''Construct an initial research state.
:type self: ResearchInfo
:rtype: ResearchInfo
'''
ptr = _lib.new_bc_ResearchInfo()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a ResearchInfo from a JSON string :type s: str :rtype: ResearchInfo
@staticmethod
def from_json(s):
# type: (str) -> ResearchInfo
'''Deserialize a ResearchInfo from a JSON string
:type s: str
:rtype: ResearchInfo
'''
result = _lib.bc_ResearchInfo_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ResearchInfo.__new__(ResearchInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def get_level(
self, branch)
Returns the current level of the research branch. :type self: ResearchInfo :type branch: UnitType :rtype: int
def get_level(self, branch):
# type: (UnitType) -> int
'''Returns the current level of the research branch.
:type self: ResearchInfo
:type branch: UnitType
:rtype: int
'''
result = _lib.bc_ResearchInfo_get_level(self._ptr, branch)
_check_errors()
return result
def has_next_in_queue(
self)
Whether there is a branch in the research queue. :type self: ResearchInfo :rtype: bool
def has_next_in_queue(self):
# type: () -> bool
'''Whether there is a branch in the research queue.
:type self: ResearchInfo
:rtype: bool
'''
result = _lib.bc_ResearchInfo_has_next_in_queue(self._ptr)
_check_errors()
result = bool(result)
return result
def next_in_queue(
self)
Returns the next branch to be researched, which is the branch at the front of the research queue.
- NullValue - There is no branch to be researched. :type self: ResearchInfo :rtype: UnitType
def next_in_queue(self):
# type: () -> UnitType
'''Returns the next branch to be researched, which is the branch at the front of the research queue.
* NullValue - There is no branch to be researched.
:type self: ResearchInfo
:rtype: UnitType
'''
result = _lib.bc_ResearchInfo_next_in_queue(self._ptr)
_check_errors()
result = UnitType(result)
return result
def rounds_left(
self)
Returns the number of rounds left until the upgrade at the front of the research queue is applied.
- NullValue - There is no branch to be researched. :type self: ResearchInfo :rtype: int
def rounds_left(self):
# type: () -> int
'''Returns the number of rounds left until the upgrade at the front of the research queue is applied.
* NullValue - There is no branch to be researched.
:type self: ResearchInfo
:rtype: int
'''
result = _lib.bc_ResearchInfo_rounds_left(self._ptr)
_check_errors()
return result
def to_json(
self)
Serialize a ResearchInfo to a JSON string :type self: ResearchInfo :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a ResearchInfo to a JSON string
:type self: ResearchInfo
:rtype: str
'''
result = _lib.bc_ResearchInfo_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var queue
Returns the research queue, where the front of the queue is at the beginning of the list. :type self: ResearchInfo :rtype: VecUnitType
class RocketLanding
class RocketLanding(object):
__slots__ = ['_ptr']
def __init__(self, rocket_id, destination):
# type: (int, MapLocation) -> RocketLanding
'''
:type self: RocketLanding
:type rocket_id: int
:type destination: MapLocation
:rtype: RocketLanding
'''
ptr = _lib.new_bc_RocketLanding(rocket_id, destination._ptr)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: RocketLanding
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_RocketLanding(self._ptr)
_check_errors()
@property
def rocket_id(self):
# type: () -> int
'''The ID of the rocket.
:type self: RocketLanding
:rtype: int
'''
result = _lib.bc_RocketLanding_rocket_id_get(self._ptr)
_check_errors()
return result
@property
def destination(self):
# type: () -> MapLocation
'''The landing destination of the rocket.
:type self: RocketLanding
:rtype: MapLocation
'''
result = _lib.bc_RocketLanding_destination_get(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@rocket_id.setter
def rocket_id(self, rocket_id):
# type: (int) -> None
'''The ID of the rocket.
:type self: RocketLanding
:type rocket_id: int
:rtype: None
'''
result = _lib.bc_RocketLanding_rocket_id_set(self._ptr, rocket_id)
_check_errors()
return result
@destination.setter
def destination(self, destination):
# type: (MapLocation) -> None
'''The landing destination of the rocket.
:type self: RocketLanding
:type destination: MapLocation
:rtype: None
'''
result = _lib.bc_RocketLanding_destination_set(self._ptr, destination._ptr)
_check_errors()
return result
def clone(self):
# type: () -> RocketLanding
'''Deep-copy a RocketLanding
:type self: RocketLanding
:rtype: RocketLanding
'''
result = _lib.bc_RocketLanding_clone(self._ptr)
_check_errors()
_result = RocketLanding.__new__(RocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a RocketLanding
:type self: RocketLanding
:rtype: str
'''
result = _lib.bc_RocketLanding_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> RocketLanding
'''Deserialize a RocketLanding from a JSON string
:type s: str
:rtype: RocketLanding
'''
result = _lib.bc_RocketLanding_from_json(_ffi.new("char[]", s))
_check_errors()
_result = RocketLanding.__new__(RocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a RocketLanding to a JSON string
:type self: RocketLanding
:rtype: str
'''
result = _lib.bc_RocketLanding_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __eq__(self, other):
# type: (RocketLanding) -> bool
'''Compare two RocketLandings for deep equality.
:type self: RocketLanding
:type other: RocketLanding
:rtype: bool
'''
result = _lib.bc_RocketLanding_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
Ancestors (in MRO)
- RocketLanding
- builtins.object
Static methods
def __init__(
self, rocket_id, destination)
:type self: RocketLanding :type rocket_id: int :type destination: MapLocation :rtype: RocketLanding
def __init__(self, rocket_id, destination):
# type: (int, MapLocation) -> RocketLanding
'''
:type self: RocketLanding
:type rocket_id: int
:type destination: MapLocation
:rtype: RocketLanding
'''
ptr = _lib.new_bc_RocketLanding(rocket_id, destination._ptr)
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a RocketLanding :type self: RocketLanding :rtype: RocketLanding
def clone(self):
# type: () -> RocketLanding
'''Deep-copy a RocketLanding
:type self: RocketLanding
:rtype: RocketLanding
'''
result = _lib.bc_RocketLanding_clone(self._ptr)
_check_errors()
_result = RocketLanding.__new__(RocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a RocketLanding from a JSON string :type s: str :rtype: RocketLanding
@staticmethod
def from_json(s):
# type: (str) -> RocketLanding
'''Deserialize a RocketLanding from a JSON string
:type s: str
:rtype: RocketLanding
'''
result = _lib.bc_RocketLanding_from_json(_ffi.new("char[]", s))
_check_errors()
_result = RocketLanding.__new__(RocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a RocketLanding to a JSON string :type self: RocketLanding :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a RocketLanding to a JSON string
:type self: RocketLanding
:rtype: str
'''
result = _lib.bc_RocketLanding_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var destination
The landing destination of the rocket. :type self: RocketLanding :rtype: MapLocation
var rocket_id
The ID of the rocket. :type self: RocketLanding :rtype: int
class RocketLandingInfo
class RocketLandingInfo(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> RocketLandingInfo
'''Construct an empty rocket landing info.
:type self: RocketLandingInfo
:rtype: RocketLandingInfo
'''
ptr = _lib.new_bc_RocketLandingInfo()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: RocketLandingInfo
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_RocketLandingInfo(self._ptr)
_check_errors()
def landings_on(self, round):
# type: (int) -> VecRocketLanding
'''Get the rocket landings on this round.
:type self: RocketLandingInfo
:type round: int
:rtype: VecRocketLanding
'''
result = _lib.bc_RocketLandingInfo_landings_on(self._ptr, round)
_check_errors()
_result = VecRocketLanding.__new__(VecRocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def clone(self):
# type: () -> RocketLandingInfo
'''Deep-copy a RocketLandingInfo
:type self: RocketLandingInfo
:rtype: RocketLandingInfo
'''
result = _lib.bc_RocketLandingInfo_clone(self._ptr)
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a RocketLandingInfo
:type self: RocketLandingInfo
:rtype: str
'''
result = _lib.bc_RocketLandingInfo_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> RocketLandingInfo
'''Deserialize a RocketLandingInfo from a JSON string
:type s: str
:rtype: RocketLandingInfo
'''
result = _lib.bc_RocketLandingInfo_from_json(_ffi.new("char[]", s))
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a RocketLandingInfo to a JSON string
:type self: RocketLandingInfo
:rtype: str
'''
result = _lib.bc_RocketLandingInfo_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __eq__(self, other):
# type: (RocketLandingInfo) -> bool
'''Compare two RocketLandingInfos for deep equality.
:type self: RocketLandingInfo
:type other: RocketLandingInfo
:rtype: bool
'''
result = _lib.bc_RocketLandingInfo_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
Ancestors (in MRO)
- RocketLandingInfo
- builtins.object
Static methods
def __init__(
self)
Construct an empty rocket landing info. :type self: RocketLandingInfo :rtype: RocketLandingInfo
def __init__(self):
# type: () -> RocketLandingInfo
'''Construct an empty rocket landing info.
:type self: RocketLandingInfo
:rtype: RocketLandingInfo
'''
ptr = _lib.new_bc_RocketLandingInfo()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a RocketLandingInfo :type self: RocketLandingInfo :rtype: RocketLandingInfo
def clone(self):
# type: () -> RocketLandingInfo
'''Deep-copy a RocketLandingInfo
:type self: RocketLandingInfo
:rtype: RocketLandingInfo
'''
result = _lib.bc_RocketLandingInfo_clone(self._ptr)
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def from_json(
s)
Deserialize a RocketLandingInfo from a JSON string :type s: str :rtype: RocketLandingInfo
@staticmethod
def from_json(s):
# type: (str) -> RocketLandingInfo
'''Deserialize a RocketLandingInfo from a JSON string
:type s: str
:rtype: RocketLandingInfo
'''
result = _lib.bc_RocketLandingInfo_from_json(_ffi.new("char[]", s))
_check_errors()
_result = RocketLandingInfo.__new__(RocketLandingInfo)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def landings_on(
self, round)
Get the rocket landings on this round. :type self: RocketLandingInfo :type round: int :rtype: VecRocketLanding
def landings_on(self, round):
# type: (int) -> VecRocketLanding
'''Get the rocket landings on this round.
:type self: RocketLandingInfo
:type round: int
:rtype: VecRocketLanding
'''
result = _lib.bc_RocketLandingInfo_landings_on(self._ptr, round)
_check_errors()
_result = VecRocketLanding.__new__(VecRocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a RocketLandingInfo to a JSON string :type self: RocketLandingInfo :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a RocketLandingInfo to a JSON string
:type self: RocketLandingInfo
:rtype: str
'''
result = _lib.bc_RocketLandingInfo_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class StartGameMessage
class StartGameMessage(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> StartGameMessage
'''
:type self: StartGameMessage
:rtype: StartGameMessage
'''
ptr = _lib.new_bc_StartGameMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: StartGameMessage
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_StartGameMessage(self._ptr)
_check_errors()
@staticmethod
def from_json(s):
# type: (str) -> StartGameMessage
'''Deserialize a StartGameMessage from a JSON string
:type s: str
:rtype: StartGameMessage
'''
result = _lib.bc_StartGameMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = StartGameMessage.__new__(StartGameMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a StartGameMessage to a JSON string
:type self: StartGameMessage
:rtype: str
'''
result = _lib.bc_StartGameMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- StartGameMessage
- builtins.object
Static methods
def __init__(
self)
:type self: StartGameMessage :rtype: StartGameMessage
def __init__(self):
# type: () -> StartGameMessage
'''
:type self: StartGameMessage
:rtype: StartGameMessage
'''
ptr = _lib.new_bc_StartGameMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a StartGameMessage from a JSON string :type s: str :rtype: StartGameMessage
@staticmethod
def from_json(s):
# type: (str) -> StartGameMessage
'''Deserialize a StartGameMessage from a JSON string
:type s: str
:rtype: StartGameMessage
'''
result = _lib.bc_StartGameMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = StartGameMessage.__new__(StartGameMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a StartGameMessage to a JSON string :type self: StartGameMessage :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a StartGameMessage to a JSON string
:type self: StartGameMessage
:rtype: str
'''
result = _lib.bc_StartGameMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class StartTurnMessage
class StartTurnMessage(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> StartTurnMessage
'''
:type self: StartTurnMessage
:rtype: StartTurnMessage
'''
ptr = _lib.new_bc_StartTurnMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: StartTurnMessage
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_StartTurnMessage(self._ptr)
_check_errors()
@property
def round(self):
# type: () -> int
'''
:type self: StartTurnMessage
:rtype: int
'''
result = _lib.bc_StartTurnMessage_round_get(self._ptr)
_check_errors()
return result
@round.setter
def round(self, round):
# type: (int) -> None
'''
:type self: StartTurnMessage
:type round: int
:rtype: None
'''
result = _lib.bc_StartTurnMessage_round_set(self._ptr, round)
_check_errors()
return result
@staticmethod
def from_json(s):
# type: (str) -> StartTurnMessage
'''Deserialize a StartTurnMessage from a JSON string
:type s: str
:rtype: StartTurnMessage
'''
result = _lib.bc_StartTurnMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = StartTurnMessage.__new__(StartTurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a StartTurnMessage to a JSON string
:type self: StartTurnMessage
:rtype: str
'''
result = _lib.bc_StartTurnMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- StartTurnMessage
- builtins.object
Static methods
def __init__(
self)
:type self: StartTurnMessage :rtype: StartTurnMessage
def __init__(self):
# type: () -> StartTurnMessage
'''
:type self: StartTurnMessage
:rtype: StartTurnMessage
'''
ptr = _lib.new_bc_StartTurnMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a StartTurnMessage from a JSON string :type s: str :rtype: StartTurnMessage
@staticmethod
def from_json(s):
# type: (str) -> StartTurnMessage
'''Deserialize a StartTurnMessage from a JSON string
:type s: str
:rtype: StartTurnMessage
'''
result = _lib.bc_StartTurnMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = StartTurnMessage.__new__(StartTurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a StartTurnMessage to a JSON string :type self: StartTurnMessage :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a StartTurnMessage to a JSON string
:type self: StartTurnMessage
:rtype: str
'''
result = _lib.bc_StartTurnMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Instance variables
var round
:type self: StartTurnMessage :rtype: int
class Team
An enumeration.
class Team(enum.IntEnum):
Red = 0
Blue = 1
@staticmethod
def from_json(s):
# type: (str) -> Team
'''Deserialize a Team from a JSON string
:type s: str
:rtype: Team
'''
result = _lib.bc_Team_from_json(_ffi.new("char[]", s))
_check_errors()
result = Team(result)
return result
def to_json(self):
# type: () -> str
'''Serialize a Team to a JSON string
:type self: Team
:rtype: str
'''
result = _lib.bc_Team_to_json(self)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- Team
- enum.IntEnum
- builtins.int
- enum.Enum
- builtins.object
Class variables
var Blue
var Red
class TurnApplication
class TurnApplication(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> TurnApplication
'''
:type self: TurnApplication
:rtype: TurnApplication
'''
ptr = _lib.new_bc_TurnApplication()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: TurnApplication
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_TurnApplication(self._ptr)
_check_errors()
@property
def start_turn(self):
# type: () -> StartTurnMessage
'''
:type self: TurnApplication
:rtype: StartTurnMessage
'''
result = _lib.bc_TurnApplication_start_turn_get(self._ptr)
_check_errors()
_result = StartTurnMessage.__new__(StartTurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def viewer(self):
# type: () -> ViewerMessage
'''
:type self: TurnApplication
:rtype: ViewerMessage
'''
result = _lib.bc_TurnApplication_viewer_get(self._ptr)
_check_errors()
_result = ViewerMessage.__new__(ViewerMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@start_turn.setter
def start_turn(self, start_turn):
# type: (StartTurnMessage) -> None
'''
:type self: TurnApplication
:type start_turn: StartTurnMessage
:rtype: None
'''
result = _lib.bc_TurnApplication_start_turn_set(self._ptr, start_turn._ptr)
_check_errors()
return result
@viewer.setter
def viewer(self, viewer):
# type: (ViewerMessage) -> None
'''
:type self: TurnApplication
:type viewer: ViewerMessage
:rtype: None
'''
result = _lib.bc_TurnApplication_viewer_set(self._ptr, viewer._ptr)
_check_errors()
return result
Ancestors (in MRO)
- TurnApplication
- builtins.object
Static methods
def __init__(
self)
:type self: TurnApplication :rtype: TurnApplication
def __init__(self):
# type: () -> TurnApplication
'''
:type self: TurnApplication
:rtype: TurnApplication
'''
ptr = _lib.new_bc_TurnApplication()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
Instance variables
var start_turn
:type self: TurnApplication :rtype: StartTurnMessage
var viewer
:type self: TurnApplication :rtype: ViewerMessage
class TurnMessage
class TurnMessage(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> TurnMessage
'''
:type self: TurnMessage
:rtype: TurnMessage
'''
ptr = _lib.new_bc_TurnMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: TurnMessage
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_TurnMessage(self._ptr)
_check_errors()
@staticmethod
def from_json(s):
# type: (str) -> TurnMessage
'''Deserialize a TurnMessage from a JSON string
:type s: str
:rtype: TurnMessage
'''
result = _lib.bc_TurnMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = TurnMessage.__new__(TurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a TurnMessage to a JSON string
:type self: TurnMessage
:rtype: str
'''
result = _lib.bc_TurnMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- TurnMessage
- builtins.object
Static methods
def __init__(
self)
:type self: TurnMessage :rtype: TurnMessage
def __init__(self):
# type: () -> TurnMessage
'''
:type self: TurnMessage
:rtype: TurnMessage
'''
ptr = _lib.new_bc_TurnMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a TurnMessage from a JSON string :type s: str :rtype: TurnMessage
@staticmethod
def from_json(s):
# type: (str) -> TurnMessage
'''Deserialize a TurnMessage from a JSON string
:type s: str
:rtype: TurnMessage
'''
result = _lib.bc_TurnMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = TurnMessage.__new__(TurnMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a TurnMessage to a JSON string :type self: TurnMessage :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a TurnMessage to a JSON string
:type self: TurnMessage
:rtype: str
'''
result = _lib.bc_TurnMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class Unit
class Unit(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> Unit
'''A single unit in the game and all its associated properties.
:type self: Unit
:rtype: Unit
'''
ptr = _lib.new_bc_Unit()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: Unit
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_Unit(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a Unit
:type self: Unit
:rtype: str
'''
result = _lib.bc_Unit_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> Unit
'''Deep-copy a Unit
:type self: Unit
:rtype: Unit
'''
result = _lib.bc_Unit_clone(self._ptr)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@staticmethod
def from_json(s):
# type: (str) -> Unit
'''Deserialize a Unit from a JSON string
:type s: str
:rtype: Unit
'''
result = _lib.bc_Unit_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a Unit to a JSON string
:type self: Unit
:rtype: str
'''
result = _lib.bc_Unit_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def __eq__(self, other):
# type: (Unit) -> bool
'''Compare two Units for deep equality.
:type self: Unit
:type other: Unit
:rtype: bool
'''
result = _lib.bc_Unit_eq(self._ptr, other._ptr)
_check_errors()
result = bool(result)
return result
@property
def id(self):
# type: () -> int
'''The unique ID of a unit.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_id(self._ptr)
_check_errors()
return result
@property
def team(self):
# type: () -> Team
'''The team the unit belongs to.
:type self: Unit
:rtype: Team
'''
result = _lib.bc_Unit_team(self._ptr)
_check_errors()
result = Team(result)
return result
@property
def research_level(self):
# type: () -> int
'''The current research level.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_research_level(self._ptr)
_check_errors()
return result
@property
def unit_type(self):
# type: () -> UnitType
'''The unit type.
:type self: Unit
:rtype: UnitType
'''
result = _lib.bc_Unit_unit_type(self._ptr)
_check_errors()
result = UnitType(result)
return result
@property
def location(self):
# type: () -> Location
'''The location of the unit.
:type self: Unit
:rtype: Location
'''
result = _lib.bc_Unit_location(self._ptr)
_check_errors()
_result = Location.__new__(Location)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
@property
def health(self):
# type: () -> int
'''The current health.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_health(self._ptr)
_check_errors()
return result
@property
def max_health(self):
# type: () -> int
'''The maximum health.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_max_health(self._ptr)
_check_errors()
return result
@property
def vision_range(self):
# type: () -> int
'''The unit vision range.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_vision_range(self._ptr)
_check_errors()
return result
def damage(self):
# type: () -> int
'''The damage inflicted by the robot during a normal attack.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_damage(self._ptr)
_check_errors()
return result
def attack_range(self):
# type: () -> int
'''The attack range.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_range(self._ptr)
_check_errors()
return result
def movement_heat(self):
# type: () -> int
'''The movement heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_movement_heat(self._ptr)
_check_errors()
return result
def attack_heat(self):
# type: () -> int
'''The attack heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_heat(self._ptr)
_check_errors()
return result
def movement_cooldown(self):
# type: () -> int
'''The movement cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_movement_cooldown(self._ptr)
_check_errors()
return result
def attack_cooldown(self):
# type: () -> int
'''The attack cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_cooldown(self._ptr)
_check_errors()
return result
def is_ability_unlocked(self):
# type: () -> bool
'''Whether the active ability is unlocked.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_is_ability_unlocked(self._ptr)
_check_errors()
result = bool(result)
return result
def ability_heat(self):
# type: () -> int
'''The active ability heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_heat(self._ptr)
_check_errors()
return result
def ability_cooldown(self):
# type: () -> int
'''The active ability cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_cooldown(self._ptr)
_check_errors()
return result
def ability_range(self):
# type: () -> int
'''The active ability range. This is the range in which: workers can replicate, knights can javelin, rangers can snipe, mages can blink, and healers can overcharge.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_range(self._ptr)
_check_errors()
return result
def worker_has_acted(self):
# type: () -> bool
'''Whether the worker has already acted (harveted, blueprinted, built, or repaired) this round.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_worker_has_acted(self._ptr)
_check_errors()
result = bool(result)
return result
def worker_build_health(self):
# type: () -> int
'''The health restored when building a structure.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_build_health(self._ptr)
_check_errors()
return result
def worker_repair_health(self):
# type: () -> int
'''The health restored when repairing a structure.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_repair_health(self._ptr)
_check_errors()
return result
def worker_harvest_amount(self):
# type: () -> int
'''The maximum amount of karbonite harvested from a deposit in one turn.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_harvest_amount(self._ptr)
_check_errors()
return result
def knight_defense(self):
# type: () -> int
'''The amount of damage resisted by a knight when attacked.
* InappropriateUnitType - the unit is not a knight.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_knight_defense(self._ptr)
_check_errors()
return result
def ranger_cannot_attack_range(self):
# type: () -> int
'''The range within a ranger cannot attack.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_cannot_attack_range(self._ptr)
_check_errors()
return result
def ranger_max_countdown(self):
# type: () -> int
'''The maximum countdown for ranger's snipe, which is the number of turns that must pass before the snipe is executed.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_max_countdown(self._ptr)
_check_errors()
return result
def ranger_is_sniping(self):
# type: () -> bool
'''Whether the ranger is sniping.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_ranger_is_sniping(self._ptr)
_check_errors()
result = bool(result)
return result
def ranger_target_location(self):
# type: () -> MapLocation
'''The target location for ranger's snipe.
* InappropriateUnitType - the unit is not a ranger.
* NullValue - the ranger is not sniping.
:type self: Unit
:rtype: MapLocation
'''
result = _lib.bc_Unit_ranger_target_location(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def ranger_countdown(self):
# type: () -> int
'''The countdown for ranger's snipe. Errors if the ranger is not sniping.
* InappropriateUnitType - the unit is not a ranger.
* NullValue - the ranger is not sniping.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_countdown(self._ptr)
_check_errors()
return result
def healer_self_heal_amount(self):
# type: () -> int
'''The amount of health passively restored to itself each round.
* InappropriateUnitType - the unit is not a healer.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_healer_self_heal_amount(self._ptr)
_check_errors()
return result
def structure_is_built(self):
# type: () -> bool
'''Whether this structure has been built.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_structure_is_built(self._ptr)
_check_errors()
result = bool(result)
return result
def structure_max_capacity(self):
# type: () -> int
'''The max capacity of a structure.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_structure_max_capacity(self._ptr)
_check_errors()
return result
def structure_garrison(self):
# type: () -> VecUnitID
'''Returns the units in the structure's garrison.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: VecUnitID
'''
result = _lib.bc_Unit_structure_garrison(self._ptr)
_check_errors()
_result = VecUnitID.__new__(VecUnitID)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def is_factory_producing(self):
# type: () -> bool
'''Whether the factory is currently producing a unit.
* InappropriateUnitType - the unit is not a factory.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_is_factory_producing(self._ptr)
_check_errors()
result = bool(result)
return result
def factory_unit_type(self):
# type: () -> UnitType
'''The unit type currently being produced by the factory.
* InappropriateUnitType - the unit is not a factory.
* NullValue - the factory is not producing.
:type self: Unit
:rtype: UnitType
'''
result = _lib.bc_Unit_factory_unit_type(self._ptr)
_check_errors()
result = UnitType(result)
return result
def factory_rounds_left(self):
# type: () -> int
'''The number of rounds left to produce a robot in this factory.
* InappropriateUnitType - the unit is not a factory.
* NullValue - the factory is not producing.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_factory_rounds_left(self._ptr)
_check_errors()
return result
def factory_max_rounds_left(self):
# type: () -> int
'''The maximum number of rounds left to produce a robot in this factory.
* InappropriateUnitType - the unit is not a factory.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_factory_max_rounds_left(self._ptr)
_check_errors()
return result
def rocket_is_used(self):
# type: () -> bool
'''Whether the rocket has already been used.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_rocket_is_used(self._ptr)
_check_errors()
result = bool(result)
return result
def rocket_blast_damage(self):
# type: () -> int
'''The damage a rocket deals to adjacent units upon landing.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_rocket_blast_damage(self._ptr)
_check_errors()
return result
def rocket_travel_time_decrease(self):
# type: () -> int
'''The number of rounds the rocket travel time is reduced by compared to the travel time determined by the orbit of the planets.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_rocket_travel_time_decrease(self._ptr)
_check_errors()
return result
Ancestors (in MRO)
- Unit
- builtins.object
Static methods
def __init__(
self)
A single unit in the game and all its associated properties. :type self: Unit :rtype: Unit
def __init__(self):
# type: () -> Unit
'''A single unit in the game and all its associated properties.
:type self: Unit
:rtype: Unit
'''
ptr = _lib.new_bc_Unit()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def ability_cooldown(
self)
The active ability cooldown.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def ability_cooldown(self):
# type: () -> int
'''The active ability cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_cooldown(self._ptr)
_check_errors()
return result
def ability_heat(
self)
The active ability heat.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def ability_heat(self):
# type: () -> int
'''The active ability heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_heat(self._ptr)
_check_errors()
return result
def ability_range(
self)
The active ability range. This is the range in which: workers can replicate, knights can javelin, rangers can snipe, mages can blink, and healers can overcharge.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def ability_range(self):
# type: () -> int
'''The active ability range. This is the range in which: workers can replicate, knights can javelin, rangers can snipe, mages can blink, and healers can overcharge.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ability_range(self._ptr)
_check_errors()
return result
def attack_cooldown(
self)
The attack cooldown.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def attack_cooldown(self):
# type: () -> int
'''The attack cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_cooldown(self._ptr)
_check_errors()
return result
def attack_heat(
self)
The attack heat.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def attack_heat(self):
# type: () -> int
'''The attack heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_heat(self._ptr)
_check_errors()
return result
def attack_range(
self)
The attack range.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def attack_range(self):
# type: () -> int
'''The attack range.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_attack_range(self._ptr)
_check_errors()
return result
def clone(
self)
Deep-copy a Unit :type self: Unit :rtype: Unit
def clone(self):
# type: () -> Unit
'''Deep-copy a Unit
:type self: Unit
:rtype: Unit
'''
result = _lib.bc_Unit_clone(self._ptr)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def damage(
self)
The damage inflicted by the robot during a normal attack.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def damage(self):
# type: () -> int
'''The damage inflicted by the robot during a normal attack.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_damage(self._ptr)
_check_errors()
return result
def factory_max_rounds_left(
self)
The maximum number of rounds left to produce a robot in this factory.
- InappropriateUnitType - the unit is not a factory. :type self: Unit :rtype: int
def factory_max_rounds_left(self):
# type: () -> int
'''The maximum number of rounds left to produce a robot in this factory.
* InappropriateUnitType - the unit is not a factory.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_factory_max_rounds_left(self._ptr)
_check_errors()
return result
def factory_rounds_left(
self)
The number of rounds left to produce a robot in this factory.
- InappropriateUnitType - the unit is not a factory.
- NullValue - the factory is not producing. :type self: Unit :rtype: int
def factory_rounds_left(self):
# type: () -> int
'''The number of rounds left to produce a robot in this factory.
* InappropriateUnitType - the unit is not a factory.
* NullValue - the factory is not producing.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_factory_rounds_left(self._ptr)
_check_errors()
return result
def factory_unit_type(
self)
The unit type currently being produced by the factory.
- InappropriateUnitType - the unit is not a factory.
- NullValue - the factory is not producing. :type self: Unit :rtype: UnitType
def factory_unit_type(self):
# type: () -> UnitType
'''The unit type currently being produced by the factory.
* InappropriateUnitType - the unit is not a factory.
* NullValue - the factory is not producing.
:type self: Unit
:rtype: UnitType
'''
result = _lib.bc_Unit_factory_unit_type(self._ptr)
_check_errors()
result = UnitType(result)
return result
def from_json(
s)
Deserialize a Unit from a JSON string :type s: str :rtype: Unit
@staticmethod
def from_json(s):
# type: (str) -> Unit
'''Deserialize a Unit from a JSON string
:type s: str
:rtype: Unit
'''
result = _lib.bc_Unit_from_json(_ffi.new("char[]", s))
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def healer_self_heal_amount(
self)
The amount of health passively restored to itself each round.
- InappropriateUnitType - the unit is not a healer. :type self: Unit :rtype: int
def healer_self_heal_amount(self):
# type: () -> int
'''The amount of health passively restored to itself each round.
* InappropriateUnitType - the unit is not a healer.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_healer_self_heal_amount(self._ptr)
_check_errors()
return result
def is_ability_unlocked(
self)
Whether the active ability is unlocked.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: bool
def is_ability_unlocked(self):
# type: () -> bool
'''Whether the active ability is unlocked.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_is_ability_unlocked(self._ptr)
_check_errors()
result = bool(result)
return result
def is_factory_producing(
self)
Whether the factory is currently producing a unit.
- InappropriateUnitType - the unit is not a factory. :type self: Unit :rtype: bool
def is_factory_producing(self):
# type: () -> bool
'''Whether the factory is currently producing a unit.
* InappropriateUnitType - the unit is not a factory.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_is_factory_producing(self._ptr)
_check_errors()
result = bool(result)
return result
def knight_defense(
self)
The amount of damage resisted by a knight when attacked.
- InappropriateUnitType - the unit is not a knight. :type self: Unit :rtype: int
def knight_defense(self):
# type: () -> int
'''The amount of damage resisted by a knight when attacked.
* InappropriateUnitType - the unit is not a knight.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_knight_defense(self._ptr)
_check_errors()
return result
def movement_cooldown(
self)
The movement cooldown.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def movement_cooldown(self):
# type: () -> int
'''The movement cooldown.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_movement_cooldown(self._ptr)
_check_errors()
return result
def movement_heat(
self)
The movement heat.
- InappropriateUnitType - the unit is not a robot. :type self: Unit :rtype: int
def movement_heat(self):
# type: () -> int
'''The movement heat.
* InappropriateUnitType - the unit is not a robot.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_movement_heat(self._ptr)
_check_errors()
return result
def ranger_cannot_attack_range(
self)
The range within a ranger cannot attack.
- InappropriateUnitType - the unit is not a ranger. :type self: Unit :rtype: int
def ranger_cannot_attack_range(self):
# type: () -> int
'''The range within a ranger cannot attack.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_cannot_attack_range(self._ptr)
_check_errors()
return result
def ranger_countdown(
self)
The countdown for ranger's snipe. Errors if the ranger is not sniping.
- InappropriateUnitType - the unit is not a ranger.
- NullValue - the ranger is not sniping. :type self: Unit :rtype: int
def ranger_countdown(self):
# type: () -> int
'''The countdown for ranger's snipe. Errors if the ranger is not sniping.
* InappropriateUnitType - the unit is not a ranger.
* NullValue - the ranger is not sniping.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_countdown(self._ptr)
_check_errors()
return result
def ranger_is_sniping(
self)
Whether the ranger is sniping.
- InappropriateUnitType - the unit is not a ranger. :type self: Unit :rtype: bool
def ranger_is_sniping(self):
# type: () -> bool
'''Whether the ranger is sniping.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_ranger_is_sniping(self._ptr)
_check_errors()
result = bool(result)
return result
def ranger_max_countdown(
self)
The maximum countdown for ranger's snipe, which is the number of turns that must pass before the snipe is executed.
- InappropriateUnitType - the unit is not a ranger. :type self: Unit :rtype: int
def ranger_max_countdown(self):
# type: () -> int
'''The maximum countdown for ranger's snipe, which is the number of turns that must pass before the snipe is executed.
* InappropriateUnitType - the unit is not a ranger.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_ranger_max_countdown(self._ptr)
_check_errors()
return result
def ranger_target_location(
self)
The target location for ranger's snipe.
- InappropriateUnitType - the unit is not a ranger.
- NullValue - the ranger is not sniping. :type self: Unit :rtype: MapLocation
def ranger_target_location(self):
# type: () -> MapLocation
'''The target location for ranger's snipe.
* InappropriateUnitType - the unit is not a ranger.
* NullValue - the ranger is not sniping.
:type self: Unit
:rtype: MapLocation
'''
result = _lib.bc_Unit_ranger_target_location(self._ptr)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def rocket_blast_damage(
self)
The damage a rocket deals to adjacent units upon landing.
- InappropriateUnitType - the unit is not a rocket. :type self: Unit :rtype: int
def rocket_blast_damage(self):
# type: () -> int
'''The damage a rocket deals to adjacent units upon landing.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_rocket_blast_damage(self._ptr)
_check_errors()
return result
def rocket_is_used(
self)
Whether the rocket has already been used.
- InappropriateUnitType - the unit is not a rocket. :type self: Unit :rtype: bool
def rocket_is_used(self):
# type: () -> bool
'''Whether the rocket has already been used.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_rocket_is_used(self._ptr)
_check_errors()
result = bool(result)
return result
def rocket_travel_time_decrease(
self)
The number of rounds the rocket travel time is reduced by compared to the travel time determined by the orbit of the planets.
- InappropriateUnitType - the unit is not a rocket. :type self: Unit :rtype: int
def rocket_travel_time_decrease(self):
# type: () -> int
'''The number of rounds the rocket travel time is reduced by compared to the travel time determined by the orbit of the planets.
* InappropriateUnitType - the unit is not a rocket.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_rocket_travel_time_decrease(self._ptr)
_check_errors()
return result
def structure_garrison(
self)
Returns the units in the structure's garrison.
- InappropriateUnitType - the unit is not a structure. :type self: Unit :rtype: VecUnitID
def structure_garrison(self):
# type: () -> VecUnitID
'''Returns the units in the structure's garrison.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: VecUnitID
'''
result = _lib.bc_Unit_structure_garrison(self._ptr)
_check_errors()
_result = VecUnitID.__new__(VecUnitID)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def structure_is_built(
self)
Whether this structure has been built.
- InappropriateUnitType - the unit is not a structure. :type self: Unit :rtype: bool
def structure_is_built(self):
# type: () -> bool
'''Whether this structure has been built.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_structure_is_built(self._ptr)
_check_errors()
result = bool(result)
return result
def structure_max_capacity(
self)
The max capacity of a structure.
- InappropriateUnitType - the unit is not a structure. :type self: Unit :rtype: int
def structure_max_capacity(self):
# type: () -> int
'''The max capacity of a structure.
* InappropriateUnitType - the unit is not a structure.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_structure_max_capacity(self._ptr)
_check_errors()
return result
def to_json(
self)
Serialize a Unit to a JSON string :type self: Unit :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a Unit to a JSON string
:type self: Unit
:rtype: str
'''
result = _lib.bc_Unit_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def worker_build_health(
self)
The health restored when building a structure.
- InappropriateUnitType - the unit is not a worker. :type self: Unit :rtype: int
def worker_build_health(self):
# type: () -> int
'''The health restored when building a structure.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_build_health(self._ptr)
_check_errors()
return result
def worker_harvest_amount(
self)
The maximum amount of karbonite harvested from a deposit in one turn.
- InappropriateUnitType - the unit is not a worker. :type self: Unit :rtype: int
def worker_harvest_amount(self):
# type: () -> int
'''The maximum amount of karbonite harvested from a deposit in one turn.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_harvest_amount(self._ptr)
_check_errors()
return result
def worker_has_acted(
self)
Whether the worker has already acted (harveted, blueprinted, built, or repaired) this round.
- InappropriateUnitType - the unit is not a worker. :type self: Unit :rtype: bool
def worker_has_acted(self):
# type: () -> bool
'''Whether the worker has already acted (harveted, blueprinted, built, or repaired) this round.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: bool
'''
result = _lib.bc_Unit_worker_has_acted(self._ptr)
_check_errors()
result = bool(result)
return result
def worker_repair_health(
self)
The health restored when repairing a structure.
- InappropriateUnitType - the unit is not a worker. :type self: Unit :rtype: int
def worker_repair_health(self):
# type: () -> int
'''The health restored when repairing a structure.
* InappropriateUnitType - the unit is not a worker.
:type self: Unit
:rtype: int
'''
result = _lib.bc_Unit_worker_repair_health(self._ptr)
_check_errors()
return result
Instance variables
var health
The current health. :type self: Unit :rtype: int
var id
The unique ID of a unit. :type self: Unit :rtype: int
var location
The location of the unit. :type self: Unit :rtype: Location
var max_health
The maximum health. :type self: Unit :rtype: int
var research_level
The current research level. :type self: Unit :rtype: int
var team
The team the unit belongs to. :type self: Unit :rtype: Team
var unit_type
The unit type. :type self: Unit :rtype: UnitType
var vision_range
The unit vision range. :type self: Unit :rtype: int
class UnitType
An enumeration.
class UnitType(enum.IntEnum):
Worker = 0
Knight = 1
Ranger = 2
Mage = 3
Healer = 4
Factory = 5
Rocket = 6
@staticmethod
def from_json(s):
# type: (str) -> UnitType
'''Deserialize a UnitType from a JSON string
:type s: str
:rtype: UnitType
'''
result = _lib.bc_UnitType_from_json(_ffi.new("char[]", s))
_check_errors()
result = UnitType(result)
return result
def to_json(self):
# type: () -> str
'''Serialize a UnitType to a JSON string
:type self: UnitType
:rtype: str
'''
result = _lib.bc_UnitType_to_json(self)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def factory_cost(self):
# type: () -> int
'''The cost of the unit in a factory.
* InappropriateUnitType - the unit type cannot be produced in a factory.
:type self: UnitType
:rtype: int
'''
result = _lib.bc_UnitType_factory_cost(self)
_check_errors()
return result
def blueprint_cost(self):
# type: () -> int
'''The cost to blueprint the unit.
* InappropriateUnitType - the unit type cannot be blueprinted.
:type self: UnitType
:rtype: int
'''
result = _lib.bc_UnitType_blueprint_cost(self)
_check_errors()
return result
def replicate_cost(self):
# type: () -> int
'''The cost to replicate the unit.
* InappropriateUnitType - the unit type is not a worker.
:type self: UnitType
:rtype: int
'''
result = _lib.bc_UnitType_replicate_cost(self)
_check_errors()
return result
def value(self):
# type: () -> int
'''The value of a unit, as relevant to tiebreakers.
:type self: UnitType
:rtype: int
'''
result = _lib.bc_UnitType_value(self)
_check_errors()
return result
Ancestors (in MRO)
- UnitType
- enum.IntEnum
- builtins.int
- enum.Enum
- builtins.object
Class variables
var Factory
var Healer
var Knight
var Mage
var Ranger
var Rocket
var Worker
class VecMapLocation
class VecMapLocation(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> VecMapLocation
'''An immutable list of bc::location::MapLocation objects
:type self: VecMapLocation
:rtype: VecMapLocation
'''
ptr = _lib.new_bc_VecMapLocation()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: VecMapLocation
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_VecMapLocation(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a VecMapLocation
:type self: VecMapLocation
:rtype: str
'''
result = _lib.bc_VecMapLocation_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> VecMapLocation
'''Deep-copy a VecMapLocation
:type self: VecMapLocation
:rtype: VecMapLocation
'''
result = _lib.bc_VecMapLocation_clone(self._ptr)
_check_errors()
_result = VecMapLocation.__new__(VecMapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: VecMapLocation
:rtype: int
'''
result = _lib.bc_VecMapLocation_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> MapLocation
'''Copy an element out of the vector.
:type self: VecMapLocation
:type index: int
:rtype: MapLocation
'''
result = _lib.bc_VecMapLocation_index(self._ptr, index)
_check_errors()
_result = MapLocation.__new__(MapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- VecMapLocation
- builtins.object
Static methods
def __init__(
self)
An immutable list of bc::location::MapLocation objects :type self: VecMapLocation :rtype: VecMapLocation
def __init__(self):
# type: () -> VecMapLocation
'''An immutable list of bc::location::MapLocation objects
:type self: VecMapLocation
:rtype: VecMapLocation
'''
ptr = _lib.new_bc_VecMapLocation()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a VecMapLocation :type self: VecMapLocation :rtype: VecMapLocation
def clone(self):
# type: () -> VecMapLocation
'''Deep-copy a VecMapLocation
:type self: VecMapLocation
:rtype: VecMapLocation
'''
result = _lib.bc_VecMapLocation_clone(self._ptr)
_check_errors()
_result = VecMapLocation.__new__(VecMapLocation)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class VecRocketLanding
class VecRocketLanding(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> VecRocketLanding
'''An immutable list of bc::rockets::RocketLanding objects
:type self: VecRocketLanding
:rtype: VecRocketLanding
'''
ptr = _lib.new_bc_VecRocketLanding()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: VecRocketLanding
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_VecRocketLanding(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a VecRocketLanding
:type self: VecRocketLanding
:rtype: str
'''
result = _lib.bc_VecRocketLanding_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> VecRocketLanding
'''Deep-copy a VecRocketLanding
:type self: VecRocketLanding
:rtype: VecRocketLanding
'''
result = _lib.bc_VecRocketLanding_clone(self._ptr)
_check_errors()
_result = VecRocketLanding.__new__(VecRocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: VecRocketLanding
:rtype: int
'''
result = _lib.bc_VecRocketLanding_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> RocketLanding
'''Copy an element out of the vector.
:type self: VecRocketLanding
:type index: int
:rtype: RocketLanding
'''
result = _lib.bc_VecRocketLanding_index(self._ptr, index)
_check_errors()
_result = RocketLanding.__new__(RocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- VecRocketLanding
- builtins.object
Static methods
def __init__(
self)
An immutable list of bc::rockets::RocketLanding objects :type self: VecRocketLanding :rtype: VecRocketLanding
def __init__(self):
# type: () -> VecRocketLanding
'''An immutable list of bc::rockets::RocketLanding objects
:type self: VecRocketLanding
:rtype: VecRocketLanding
'''
ptr = _lib.new_bc_VecRocketLanding()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a VecRocketLanding :type self: VecRocketLanding :rtype: VecRocketLanding
def clone(self):
# type: () -> VecRocketLanding
'''Deep-copy a VecRocketLanding
:type self: VecRocketLanding
:rtype: VecRocketLanding
'''
result = _lib.bc_VecRocketLanding_clone(self._ptr)
_check_errors()
_result = VecRocketLanding.__new__(VecRocketLanding)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class VecUnit
class VecUnit(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> VecUnit
'''An immutable list of bc::unit::Unit objects
:type self: VecUnit
:rtype: VecUnit
'''
ptr = _lib.new_bc_VecUnit()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: VecUnit
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_VecUnit(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a VecUnit
:type self: VecUnit
:rtype: str
'''
result = _lib.bc_VecUnit_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> VecUnit
'''Deep-copy a VecUnit
:type self: VecUnit
:rtype: VecUnit
'''
result = _lib.bc_VecUnit_clone(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: VecUnit
:rtype: int
'''
result = _lib.bc_VecUnit_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> Unit
'''Copy an element out of the vector.
:type self: VecUnit
:type index: int
:rtype: Unit
'''
result = _lib.bc_VecUnit_index(self._ptr, index)
_check_errors()
_result = Unit.__new__(Unit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- VecUnit
- builtins.object
Static methods
def __init__(
self)
An immutable list of bc::unit::Unit objects :type self: VecUnit :rtype: VecUnit
def __init__(self):
# type: () -> VecUnit
'''An immutable list of bc::unit::Unit objects
:type self: VecUnit
:rtype: VecUnit
'''
ptr = _lib.new_bc_VecUnit()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a VecUnit :type self: VecUnit :rtype: VecUnit
def clone(self):
# type: () -> VecUnit
'''Deep-copy a VecUnit
:type self: VecUnit
:rtype: VecUnit
'''
result = _lib.bc_VecUnit_clone(self._ptr)
_check_errors()
_result = VecUnit.__new__(VecUnit)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class VecUnitID
class VecUnitID(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> VecUnitID
'''An immutable list of bc::unit::UnitID objects
:type self: VecUnitID
:rtype: VecUnitID
'''
ptr = _lib.new_bc_VecUnitID()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: VecUnitID
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_VecUnitID(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a VecUnitID
:type self: VecUnitID
:rtype: str
'''
result = _lib.bc_VecUnitID_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> VecUnitID
'''Deep-copy a VecUnitID
:type self: VecUnitID
:rtype: VecUnitID
'''
result = _lib.bc_VecUnitID_clone(self._ptr)
_check_errors()
_result = VecUnitID.__new__(VecUnitID)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: VecUnitID
:rtype: int
'''
result = _lib.bc_VecUnitID_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> int
'''Copy an element out of the vector.
:type self: VecUnitID
:type index: int
:rtype: int
'''
result = _lib.bc_VecUnitID_index(self._ptr, index)
_check_errors()
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- VecUnitID
- builtins.object
Static methods
def __init__(
self)
An immutable list of bc::unit::UnitID objects :type self: VecUnitID :rtype: VecUnitID
def __init__(self):
# type: () -> VecUnitID
'''An immutable list of bc::unit::UnitID objects
:type self: VecUnitID
:rtype: VecUnitID
'''
ptr = _lib.new_bc_VecUnitID()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a VecUnitID :type self: VecUnitID :rtype: VecUnitID
def clone(self):
# type: () -> VecUnitID
'''Deep-copy a VecUnitID
:type self: VecUnitID
:rtype: VecUnitID
'''
result = _lib.bc_VecUnitID_clone(self._ptr)
_check_errors()
_result = VecUnitID.__new__(VecUnitID)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class VecUnitType
class VecUnitType(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> VecUnitType
'''An immutable list of bc::unit::UnitType objects
:type self: VecUnitType
:rtype: VecUnitType
'''
ptr = _lib.new_bc_VecUnitType()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: VecUnitType
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_VecUnitType(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a VecUnitType
:type self: VecUnitType
:rtype: str
'''
result = _lib.bc_VecUnitType_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> VecUnitType
'''Deep-copy a VecUnitType
:type self: VecUnitType
:rtype: VecUnitType
'''
result = _lib.bc_VecUnitType_clone(self._ptr)
_check_errors()
_result = VecUnitType.__new__(VecUnitType)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: VecUnitType
:rtype: int
'''
result = _lib.bc_VecUnitType_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> UnitType
'''Copy an element out of the vector.
:type self: VecUnitType
:type index: int
:rtype: UnitType
'''
result = _lib.bc_VecUnitType_index(self._ptr, index)
_check_errors()
result = UnitType(result)
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- VecUnitType
- builtins.object
Static methods
def __init__(
self)
An immutable list of bc::unit::UnitType objects :type self: VecUnitType :rtype: VecUnitType
def __init__(self):
# type: () -> VecUnitType
'''An immutable list of bc::unit::UnitType objects
:type self: VecUnitType
:rtype: VecUnitType
'''
ptr = _lib.new_bc_VecUnitType()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a VecUnitType :type self: VecUnitType :rtype: VecUnitType
def clone(self):
# type: () -> VecUnitType
'''Deep-copy a VecUnitType
:type self: VecUnitType
:rtype: VecUnitType
'''
result = _lib.bc_VecUnitType_clone(self._ptr)
_check_errors()
_result = VecUnitType.__new__(VecUnitType)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class Veci32
class Veci32(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> Veci32
'''An immutable list of i32 objects
:type self: Veci32
:rtype: Veci32
'''
ptr = _lib.new_bc_Veci32()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: Veci32
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_Veci32(self._ptr)
_check_errors()
def __repr__(self):
# type: () -> str
'''Create a human-readable representation of a Veci32
:type self: Veci32
:rtype: str
'''
result = _lib.bc_Veci32_debug(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
def clone(self):
# type: () -> Veci32
'''Deep-copy a Veci32
:type self: Veci32
:rtype: Veci32
'''
result = _lib.bc_Veci32_clone(self._ptr)
_check_errors()
_result = Veci32.__new__(Veci32)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def __len__(self):
# type: () -> int
'''The length of the vector.
:type self: Veci32
:rtype: int
'''
result = _lib.bc_Veci32_len(self._ptr)
_check_errors()
return result
def __getitem__(self, index):
# type: (int) -> int
'''Copy an element out of the vector.
:type self: Veci32
:type index: int
:rtype: int
'''
result = _lib.bc_Veci32_index(self._ptr, index)
_check_errors()
return result
def __iter__(self):
l = len(self)
for i in range(l):
yield self[i]
Ancestors (in MRO)
- Veci32
- builtins.object
Static methods
def __init__(
self)
An immutable list of i32 objects :type self: Veci32 :rtype: Veci32
def __init__(self):
# type: () -> Veci32
'''An immutable list of i32 objects
:type self: Veci32
:rtype: Veci32
'''
ptr = _lib.new_bc_Veci32()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def clone(
self)
Deep-copy a Veci32 :type self: Veci32 :rtype: Veci32
def clone(self):
# type: () -> Veci32
'''Deep-copy a Veci32
:type self: Veci32
:rtype: Veci32
'''
result = _lib.bc_Veci32_clone(self._ptr)
_check_errors()
_result = Veci32.__new__(Veci32)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
class ViewerKeyframe
class ViewerKeyframe(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> ViewerKeyframe
'''
:type self: ViewerKeyframe
:rtype: ViewerKeyframe
'''
ptr = _lib.new_bc_ViewerKeyframe()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: ViewerKeyframe
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_ViewerKeyframe(self._ptr)
_check_errors()
@staticmethod
def from_json(s):
# type: (str) -> ViewerKeyframe
'''Deserialize a ViewerKeyframe from a JSON string
:type s: str
:rtype: ViewerKeyframe
'''
result = _lib.bc_ViewerKeyframe_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ViewerKeyframe.__new__(ViewerKeyframe)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a ViewerKeyframe to a JSON string
:type self: ViewerKeyframe
:rtype: str
'''
result = _lib.bc_ViewerKeyframe_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- ViewerKeyframe
- builtins.object
Static methods
def __init__(
self)
:type self: ViewerKeyframe :rtype: ViewerKeyframe
def __init__(self):
# type: () -> ViewerKeyframe
'''
:type self: ViewerKeyframe
:rtype: ViewerKeyframe
'''
ptr = _lib.new_bc_ViewerKeyframe()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a ViewerKeyframe from a JSON string :type s: str :rtype: ViewerKeyframe
@staticmethod
def from_json(s):
# type: (str) -> ViewerKeyframe
'''Deserialize a ViewerKeyframe from a JSON string
:type s: str
:rtype: ViewerKeyframe
'''
result = _lib.bc_ViewerKeyframe_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ViewerKeyframe.__new__(ViewerKeyframe)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a ViewerKeyframe to a JSON string :type self: ViewerKeyframe :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a ViewerKeyframe to a JSON string
:type self: ViewerKeyframe
:rtype: str
'''
result = _lib.bc_ViewerKeyframe_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
class ViewerMessage
class ViewerMessage(object):
__slots__ = ['_ptr']
def __init__(self):
# type: () -> ViewerMessage
'''
:type self: ViewerMessage
:rtype: ViewerMessage
'''
ptr = _lib.new_bc_ViewerMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def __del__(self):
# type: () -> None
'''Clean up the object.
:type self: ViewerMessage
:rtype: None
'''
if hasattr(self, '_ptr'):
# if there was an error in the constructor, we'll have no _ptr
_lib.delete_bc_ViewerMessage(self._ptr)
_check_errors()
@staticmethod
def from_json(s):
# type: (str) -> ViewerMessage
'''Deserialize a ViewerMessage from a JSON string
:type s: str
:rtype: ViewerMessage
'''
result = _lib.bc_ViewerMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ViewerMessage.__new__(ViewerMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(self):
# type: () -> str
'''Serialize a ViewerMessage to a JSON string
:type self: ViewerMessage
:rtype: str
'''
result = _lib.bc_ViewerMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result
Ancestors (in MRO)
- ViewerMessage
- builtins.object
Static methods
def __init__(
self)
:type self: ViewerMessage :rtype: ViewerMessage
def __init__(self):
# type: () -> ViewerMessage
'''
:type self: ViewerMessage
:rtype: ViewerMessage
'''
ptr = _lib.new_bc_ViewerMessage()
if ptr != _ffi.NULL: self._ptr = ptr
_check_errors()
def from_json(
s)
Deserialize a ViewerMessage from a JSON string :type s: str :rtype: ViewerMessage
@staticmethod
def from_json(s):
# type: (str) -> ViewerMessage
'''Deserialize a ViewerMessage from a JSON string
:type s: str
:rtype: ViewerMessage
'''
result = _lib.bc_ViewerMessage_from_json(_ffi.new("char[]", s))
_check_errors()
_result = ViewerMessage.__new__(ViewerMessage)
if result != _ffi.NULL:
_result._ptr = result
result = _result
return result
def to_json(
self)
Serialize a ViewerMessage to a JSON string :type self: ViewerMessage :rtype: str
def to_json(self):
# type: () -> str
'''Serialize a ViewerMessage to a JSON string
:type self: ViewerMessage
:rtype: str
'''
result = _lib.bc_ViewerMessage_to_json(self._ptr)
_check_errors()
_result = _ffi.string(result)
_lib.bc_free_string(result)
result = _result
return result