new Stumped.Beaver()
Initializes a Beaver with basic logic as provided by the Creer code generator.
Never use this directly. It is for internal Joueur use.
Extends
Members
-
number actions
-
The number of actions remaining for the Beaver this turn.
-
number branches
-
The amount of branches this Beaver is holding.
-
number food
-
The amount of food this Beaver is holding.
-
string gameObjectName
- Inherited From:
- Stumped.GameObject#gameObjectName
-
number health
-
How much health this Beaver has left.
-
string id
- Inherited From:
- Stumped.GameObject#id
-
Stumped.Job job
-
The Job this Beaver was recruited to do.
-
Array.<string> logs
- Inherited From:
- Stumped.GameObject#logs
-
number moves
-
How many moves this Beaver has left this turn.
-
Stumped.Player owner
-
The Player that owns and can control this Beaver.
-
boolean recruited
-
True if the Beaver has finished being recruited and can do things, False otherwise.
-
Stumped.Tile tile
-
The Tile this Beaver is on.
-
number turnsDistracted
-
Number of turns this Beaver is distracted for (0 means not distracted).
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.
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.
Any strings logged will be stored here. Intended for debugging.
Methods
-
boolean attack(beaver)
-
Attacks another adjacent beaver.
Name Type Description beaver
Stumped.Beaver The Beaver to attack. Must be on an adjacent Tile. Returns: boolean
True if successfully attacked, false otherwise. -
boolean buildLodge()
-
Builds a lodge on the Beavers current Tile.
Returns: boolean
True if successfully built a lodge, false otherwise. -
boolean drop(tile, resource, amount)
-
Drops some of the given resource on the beaver's Tile.
Name Type Description tile
Stumped.Tile The Tile to drop branches/food on. Must be the same Tile that the Beaver is on, or an adjacent one. resource
string The type of resource to drop ('branches' or 'food'). amount
number optional The amount of the resource to drop, numbers <= 0 will drop all the resource type. Returns: boolean
True if successfully dropped the resource, false otherwise. -
boolean harvest(spawner)
-
Harvests the branches or food from a Spawner on an adjacent Tile.
Name Type Description spawner
Stumped.Spawner The Spawner you want to harvest. Must be on an adjacent Tile. Returns: boolean
True if successfully harvested, false otherwise. -
log(message)
- Inherited From:
- Stumped.GameObject#log
-
boolean move(tile)
-
Moves this Beaver from its current Tile to an adjacent Tile.
Name Type Description tile
Stumped.Tile The Tile this Beaver should move to. Returns: boolean
True if the move worked, false otherwise. -
boolean pickup(tile, resource, amount)
-
Picks up some branches or food on the beaver's tile.
Name Type Description tile
Stumped.Tile The Tile to pickup branches/food from. Must be the same Tile that the Beaver is on, or an adjacent one. resource
string The type of resource to pickup ('branches' or 'food'). amount
number optional The amount of the resource to drop, numbers <= 0 will pickup all of the resource type. Returns: boolean
True if successfully picked up a resource, false otherwise. -
string toString()
- Inherited From:
- BaseGameObject#toString
Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.
Name | Type | Description |
---|---|---|
message |
string | A string to add to this GameObject's log. Intended for debugging. |
toString override for easier debugging