Game

class games.necrowar.game.Game

Bases: joueur.base_game.BaseGame

The class representing the Game in the Necrowar game.

Send hordes of the undead at your opponent while defending yourself against theirs to win.

property current_player

The player whose turn it is currently. That player can send commands. Other players cannot.

Type

games.necrowar.player.Player

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.necrowar.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.necrowar.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.necrowar.tile.Tile or None

property gold_income_per_unit

The amount of gold income per turn per unit in a mine.

Type

int

property island_income_per_unit

The amount of gold income per turn per unit in the island mine.

Type

int

property mana_income_per_unit

The Amount of gold income per turn per unit fishing on the river side.

Type

int

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 players

List of all the players in the game.

Type

list[games.necrowar.player.Player]

property river_phase

The amount of turns it takes between the river changing phases.

Type

int

property session

A unique identifier for the game instance that is being played.

Type

str

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.necrowar.tile.Tile]

property time_added_per_turn

The amount of time (in nano-seconds) added after each player performs a turn.

Type

int

property tower_jobs

A list of every tower type / job.

Type

list[games.necrowar.tower_job.TowerJob]

property towers

Every Tower in the game.

Type

list[games.necrowar.tower.Tower]

property unit_jobs

A list of every unit type / job.

Type

list[games.necrowar.unit_job.UnitJob]

property units

Every Unit in the game.

Type

list[games.necrowar.unit.Unit]