Game¶
-
class
games.pirates.game.Game¶ Bases:
joueur.base_game.BaseGameThe class representing the Game in the Pirates game.
Steal from merchants and become the most infamous pirate.
-
property
bury_interest_rate¶ The rate buried gold increases each turn.
- Type
float
-
property
crew_cost¶ How much gold it costs to construct a single crew.
- Type
int
-
property
crew_damage¶ How much damage crew deal to each other.
- Type
int
-
property
crew_health¶ The maximum amount of health a crew member can have.
- Type
int
-
property
crew_moves¶ The number of moves Units with only crew are given each turn.
- Type
int
-
property
crew_range¶ A crew’s attack range. Range is circular.
- Type
float
-
property
current_player¶ The player whose turn it is currently. That player can send commands. Other players cannot.
-
property
current_turn¶ The current turn number, starting at 0 for the first player’s turn.
- Type
int
-
property
game_objects¶ A mapping of every game object’s ID to the actual game object. Primarily used by the server and client to easily refer to the game objects via ID.
- Type
dict[str, games.pirates.game_object.GameObject]
-
get_game_object(id: str) → Optional[joueur.base_game_object.BaseGameObject]¶ gets the game object with the given id, or None
- Returns
BaseGameObject in the game with the given id, or None if not found
-
get_tile_at(x: int, y: int) → Optional[games.pirates.tile.Tile]¶ Gets the Tile at a specified (x, y) position.
- Parameters
x (int) – An integer between 0 and the map_width.
y (int) – An integer between 0 and the map_height.
- Returns
The Tile at (x, y) or None if out of bounds.
- Return type
games.pirates.tile.Tile or None
-
property
heal_factor¶ How much health a Unit recovers when they rest.
- Type
float
-
property
map_height¶ The number of Tiles in the map along the y (vertical) axis.
- Type
int
-
property
map_width¶ The number of Tiles in the map along the x (horizontal) axis.
- Type
int
-
property
max_turns¶ The maximum number of turns before the game will automatically end.
- Type
int
-
property
merchant_gold_rate¶ How much gold merchant Ports get each turn.
- Type
float
-
property
merchant_interest_rate¶ When a merchant ship spawns, the amount of additional gold it has relative to the Port’s investment.
- Type
float
-
property
min_interest_distance¶ The Euclidean distance buried gold must be from the Player’s Port to accumulate interest.
- Type
float
-
property
players¶ List of all the players in the game.
- Type
-
property
ports¶ Every Port in the game. Merchant ports have owner set to None.
- Type
list[games.pirates.port.Port]
-
property
rest_range¶ How far a Unit can be from a Port to rest. Range is circular.
- Type
float
-
property
session¶ A unique identifier for the game instance that is being played.
- Type
str
-
property
ship_cost¶ How much gold it costs to construct a ship.
- Type
int
-
property
ship_damage¶ How much damage ships deal to ships and ports.
- Type
int
-
property
ship_health¶ The maximum amount of health a ship can have.
- Type
int
-
property
ship_moves¶ The number of moves Units with ships are given each turn.
- Type
int
-
property
ship_range¶ A ship’s attack range. Range is circular.
- Type
float
-
property
tiles¶ All the tiles in the map, stored in Row-major order. Use x + y * mapWidth to access the correct index.
- Type
list[games.pirates.tile.Tile]
-
property
time_added_per_turn¶ The amount of time (in nano-seconds) added after each player performs a turn.
- Type
int
-
property
units¶ Every Unit in the game. Merchant units have targetPort set to a port.
- Type
list[games.pirates.unit.Unit]
-
property