Tower

class games.necrowar.tower.Tower

Bases: games.necrowar.game_object.GameObject

The class representing the Tower in the Necrowar game.

A tower in the game. Used to combat enemy waves.

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

Attacks an enemy unit on an tile within it’s range.

Parameters

tile (games.necrowar.tile.Tile) – The Tile to attack.

Returns

True if successfully attacked, False otherwise.

Return type

bool

property attacked

Whether this tower has attacked this turn or not.

Type

bool

property cooldown

How many turns are left before it can fire again.

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 remaining health this tower has.

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 job

What type of tower this is (it’s job).

Type

games.necrowar.tower_job.TowerJob

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 built / owns this tower.

Type

games.necrowar.player.Player or None

property tile

The Tile this Tower is on.

Type

games.necrowar.tile.Tile