PoliceDepartment

class games.anarchy.police_department.PoliceDepartment

Bases: games.anarchy.building.Building

The class representing the PoliceDepartment in the Anarchy game.

Used to keep cities under control and raid Warehouses.

property bribed

When True this building has already been bribed this turn and cannot be bribed again this turn.

Type

bool

property building_east

The Building directly to the east of this building, or None if not present.

Type

games.anarchy.building.Building or None

property building_north

The Building directly to the north of this building, or None if not present.

Type

games.anarchy.building.Building or None

property building_south

The Building directly to the south of this building, or None if not present.

Type

games.anarchy.building.Building or None

property building_west

The Building directly to the west of this building, or None if not present.

Type

games.anarchy.building.Building or None

property fire

How much fire is currently burning the building, and thus how much damage it will take at the end of its owner’s turn. 0 means no fire.

Type

int

property game_object_name

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

Type

str

property health

How much health this building currently has. When this reaches 0 the Building has been burned down.

Type

int

property id

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

Type

str

property is_headquarters

True if this is the Headquarters of the owning player, False otherwise. Burning this down wins the game for the other Player.

Type

bool

log(message: str) → None

Adds a message to this GameObject’s logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

Parameters

message (str) – A string to add to this GameObject’s log. Intended for debugging.

property logs

Any strings logged will be stored here. Intended for debugging.

Type

list[str]

property owner

The player that owns this building. If it burns down (health reaches 0) that player gets an additional bribe(s).

Type

games.anarchy.player.Player

raid(warehouse: games.anarchy.warehouse.Warehouse) → int

Bribe the police to raid a Warehouse, dealing damage equal based on the Warehouse’s current exposure, and then resetting it to 0.

Parameters

warehouse (games.anarchy.warehouse.Warehouse) – The warehouse you want to raid.

Returns

The amount of damage dealt to the warehouse, or -1 if there was an error.

Return type

int

property x

The location of the Building along the x-axis.

Type

int

property y

The location of the Building along the y-axis.

Type

int