Tile

class games.necrowar.tile.Tile

Bases: games.necrowar.game_object.GameObject

The class representing the Tile in the Necrowar game.

A Tile in the game that makes up the 2D map grid.

property corpses

The amount of corpses on this tile.

Type

int

directions = ['North', 'East', 'South', 'West']

The valid directions that tiles can be in, “North”, “East”, “South”, or “West”

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

get_neighbors() → List[games.necrowar.tile.Tile]

Gets the neighbors of this Tile

Returns

The list of neighboring Tiles of this Tile.

Return type

list[games.necrowar.tile.Tile]

has_neighbor(tile: games.necrowar.tile.Tile) → bool

Checks if this Tile has a specific neighboring Tile.

Parameters

tile (games.necrowar.tile.Tile) – The Tile to check against.

Returns

True if the tile is a neighbor of this Tile, False otherwise

Return type

bool

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_castle

Whether or not the tile is a castle tile.

Type

bool

property is_gold_mine

Whether or not the tile is considered to be a gold mine or not.

Type

bool

property is_grass

Whether or not the tile is considered grass or not (Workers can walk on grass).

Type

bool

property is_island_gold_mine

Whether or not the tile is considered to be the island gold mine or not.

Type

bool

property is_path

Whether or not the tile is considered a path or not (Units can walk on paths).

Type

bool

is_pathable() → bool

Checks if a Tile is pathable to units

Returns

True if pathable, False otherwise.

Return type

bool

property is_river

Whether or not the tile is considered a river or not.

Type

bool

property is_tower

Whether or not the tile is considered a tower or not.

Type

bool

property is_unit_spawn

Whether or not the tile is the unit spawn.

Type

bool

property is_wall

Whether or not the tile can be moved on by workers.

Type

bool

property is_worker_spawn

Whether or not the tile is the worker spawn.

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 num_ghouls

The amount of Ghouls on this tile.

Type

int

property num_hounds

The amount of Hounds on this tile.

Type

int

property num_zombies

The amount of Zombies on this tile.

Type

int

property owner

Which player owns this tile, only applies to grass tiles for workers, NULL otherwise.

Type

games.necrowar.player.Player or None

res(num: int) → bool

Resurrect the corpses on this tile into Zombies.

Parameters

num (int) – Number of zombies to resurrect.

Returns

True if successful res, False otherwise.

Return type

bool

spawn_unit(title: str) → bool

Spawns a fighting unit on the correct tile.

Parameters

title (str) – The title of the desired unit type.

Returns

True if successfully spawned, False otherwise.

Return type

bool

spawn_worker() → bool

Spawns a worker on the correct tile.

Returns

True if successfully spawned, False otherwise.

Return type

bool

property tile_east

The Tile to the ‘East’ of this one (x+1, y). None if out of bounds of the map.

Type

games.necrowar.tile.Tile or None

property tile_north

The Tile to the ‘North’ of this one (x, y-1). None if out of bounds of the map.

Type

games.necrowar.tile.Tile or None

property tile_south

The Tile to the ‘South’ of this one (x, y+1). None if out of bounds of the map.

Type

games.necrowar.tile.Tile or None

property tile_west

The Tile to the ‘West’ of this one (x-1, y). None if out of bounds of the map.

Type

games.necrowar.tile.Tile or None

property tower

The Tower on this Tile if present, otherwise None.

Type

games.necrowar.tower.Tower or None

property unit

The Unit on this Tile if present, otherwise None.

Type

games.necrowar.unit.Unit or None

property x

The x (horizontal) position of this Tile.

Type

int

property y

The y (vertical) position of this Tile.

Type

int