Beaver¶
-
class
games.stumped.beaver.
Beaver
¶ Bases:
games.stumped.game_object.GameObject
The class representing the Beaver in the Stumped game.
A beaver in the game.
-
property
actions
¶ The number of actions remaining for the Beaver this turn.
- Type
int
-
attack
(beaver: games.stumped.beaver.Beaver) → bool¶ Attacks another adjacent beaver.
- Parameters
beaver (games.stumped.beaver.Beaver) – The Beaver to attack. Must be on an adjacent Tile.
- Returns
True if successfully attacked, False otherwise.
- Return type
bool
-
property
branches
¶ The amount of branches this Beaver is holding.
- Type
int
-
build_lodge
() → bool¶ Builds a lodge on the Beavers current Tile.
- Returns
True if successfully built a lodge, False otherwise.
- Return type
bool
-
drop
(tile: games.stumped.tile.Tile, resource: str, amount: int = 0) → bool¶ Drops some of the given resource on the beaver’s Tile.
- Parameters
tile (games.stumped.tile.Tile) – The Tile to drop branches/food on. Must be the same Tile that the Beaver is on, or an adjacent one.
resource ('branches' or 'food') – The type of resource to drop (‘branches’ or ‘food’).
amount (int) – The amount of the resource to drop, numbers <= 0 will drop all the resource type.
- Returns
True if successfully dropped the resource, False otherwise.
- Return type
bool
-
property
food
¶ The amount of food this Beaver is holding.
- 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
-
harvest
(spawner: games.stumped.spawner.Spawner) → bool¶ Harvests the branches or food from a Spawner on an adjacent Tile.
- Parameters
spawner (games.stumped.spawner.Spawner) – The Spawner you want to harvest. Must be on an adjacent Tile.
- Returns
True if successfully harvested, False otherwise.
- Return type
bool
-
property
health
¶ How much health this Beaver has left.
- 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
¶ The Job this Beaver was recruited to do.
-
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]
-
move
(tile: games.stumped.tile.Tile) → bool¶ Moves this Beaver from its current Tile to an adjacent Tile.
- Parameters
tile (games.stumped.tile.Tile) – The Tile this Beaver should move to.
- Returns
True if the move worked, False otherwise.
- Return type
bool
-
property
moves
¶ How many moves this Beaver has left this turn.
- Type
int
-
property
owner
¶ The Player that owns and can control this Beaver.
-
pickup
(tile: games.stumped.tile.Tile, resource: str, amount: int = 0) → bool¶ Picks up some branches or food on the beaver’s tile.
- Parameters
tile (games.stumped.tile.Tile) – The Tile to pickup branches/food from. Must be the same Tile that the Beaver is on, or an adjacent one.
resource ('branches' or 'food') – The type of resource to pickup (‘branches’ or ‘food’).
amount (int) – The amount of the resource to drop, numbers <= 0 will pickup all of the resource type.
- Returns
True if successfully picked up a resource, False otherwise.
- Return type
bool
-
property
recruited
¶ True if the Beaver has finished being recruited and can do things, False otherwise.
- Type
bool
-
property
tile
¶ The Tile this Beaver is on.
- Type
games.stumped.tile.Tile or None
-
property
turns_distracted
¶ Number of turns this Beaver is distracted for (0 means not distracted).
- Type
int
-
property