Class: Miner

Coreminer. Miner

A Miner in the game.

new Coreminer.Miner()

Initializes a Miner with basic logic as provided by the Creer code generator. Never use this directly. It is for internal Joueur use.

Extends

Members

number bombs

The number of bombs being carried by this Miner.

number buildingMaterials

The number of building materials carried by this Miner.

Coreminer.Upgrade currentUpgrade

The Upgrade this Miner is on.

number dirt

The amount of dirt carried by this Miner.

string gameObjectName

Inherited From:
Coreminer.GameObject#gameObjectName
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.

number health

The remaining health of this Miner.

string id

Inherited From:
Coreminer.GameObject#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.

Array.<string> logs

Inherited From:
Coreminer.GameObject#logs
Any strings logged will be stored here. Intended for debugging.

number miningPower

The remaining mining power this Miner has this turn.

number moves

The number of moves this Miner has left this turn.

number ore

The amount of ore carried by this Miner.
The Player that owns and can control this Miner.
The Tile this Miner is on.

number upgradeLevel

The upgrade level of this Miner. Starts at 0.

Methods

boolean build(tile, type)

Builds a support, shield, or ladder on Miner's Tile, or an adjacent Tile.
Name Type Description
tile Coreminer.Tile The Tile to build on.
type string The structure to build (support, ladder, or shield).
Returns: boolean
True if successfully built, False otherwise.

boolean buy(resource, amount)

Purchase a resource from the Player's base or hopper.
Name Type Description
resource string The type of resource to buy.
amount number The amount of resource to buy. Amounts <= 0 will buy all of that material Player can.
Returns: boolean
True if successfully purchased, false otherwise.

boolean dump(tile, material, amount)

Dumps materials from cargo to an adjacent Tile. If the Tile is a base or a hopper Tile, materials are sold instead of placed.
Name Type Description
tile Coreminer.Tile The Tile the materials will be dumped on.
material string The material the Miner will drop. 'dirt', 'ore', or 'bomb'.
amount number The number of materials to drop. Amounts <= 0 will drop all of the material.
Returns: boolean
True if successfully dumped materials, false otherwise.

log(message)

Inherited From:
Coreminer.GameObject#log
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.

boolean mine(tile, amount)

Mines the Tile the Miner is on or an adjacent Tile.
Name Type Description
tile Coreminer.Tile The Tile the materials will be mined from.
amount number The amount of material to mine up. Amounts <= 0 will mine all the materials that the Miner can.
Returns: boolean
True if successfully mined, false otherwise.

boolean move(tile)

Moves this Miner from its current Tile to an adjacent Tile.
Name Type Description
tile Coreminer.Tile The Tile this Miner should move to.
Returns: boolean
True if it moved, false otherwise.

string toString()

Inherited From:
BaseGameObject#toString
toString override for easier debugging
Returns: string
readable string in the format `GameObjectName #id`

boolean transfer(miner, resource, amount)

Transfers a resource from the one Miner to another.
Name Type Description
miner Coreminer.Miner The Miner to transfer materials to.
resource string The type of resource to transfer.
amount number The amount of resource to transfer. Amounts <= 0 will transfer all the of the material.
Returns: boolean
True if successfully transferred, false otherwise.

boolean upgrade()

Upgrade this Miner by installing an upgrade module.
Returns: boolean
True if successfully upgraded, False otherwise.