Documentation ¶
Index ¶
- Constants
- type BlockEntity
- type Game
- type MapEntity
- type Player
- func (p *Player) Attack() (enemyHealth int, err error)
- func (p *Player) Defend() (err error)
- func (p *Player) GetHealth() (health int, err error)
- func (p *Player) Move(direction string) error
- func (p *Player) MustAttack() (enemyHealth int)
- func (p *Player) MustDefend()
- func (p *Player) MustGetHealth() (health int)
- func (p *Player) MustMove(direction string)
- func (p *Player) MustRadar() (count int)
- func (p *Player) MustRotate(angle string)
- func (p *Player) MustScout(distance int) (count int)
- func (p *Player) MustUndefend()
- func (p *Player) MustWatch() (healthMatrix [][]int)
- func (p *Player) Radar() (count int, err error)
- func (p *Player) Rotate(angle string) error
- func (p *Player) Scout(distance int) (count int, err error)
- func (p *Player) Undefend() (err error)
- func (p *Player) Watch() (healthMatrix [][]int, err error)
Constants ¶
const ( // AngleLeft is a constant for the 'left' AngleLeft = "left" // AngleRight is a constant for 'right' AngleRight = "right" // DirectionNorth is a constant for 'north' DirectionNorth = "north" // DirectionEast is a constant for 'east' DirectionEast = "east" // DirectionSouth is a constant for 'south' DirectionSouth = "south" // DirectionWest is a constant for 'west' DirectionWest = "west" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
Game manages all connections and authorizations for the client. Also holds the state of the active player
func Join ¶
Join exchanges the `authtoken` for server credentials and establishes a secure connection (`AES256-GCM`) to the game-server. Afterwards it returns a game object containing basic infos and the player's state.
type MapEntity ¶
type MapEntity struct {
// contains filtered or unexported fields
}
MapEntity is a struct with the width and height of the map
func (*MapEntity) Block ¶
func (me *MapEntity) Block(x int, y int) *BlockEntity
Block is not implemented yet
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player represents a single controllable game entitiy (also called character).
func (*Player) Attack ¶
Attack performs an attack into the direction the player is currently looking.
func (*Player) Defend ¶
Defend implements the function of 'sdk-wiki.vikebot.com/#defend-and-undefend'
func (*Player) Move ¶
Move instructs the player to run in the neighbor block specified by the direction parameter. Directions are cardinal-directions and predefined in package constants: `vikebot.Direction*`
func (*Player) MustAttack ¶
MustAttack is like `Attack` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustDefend ¶
func (p *Player) MustDefend()
MustDefend is like `Defend` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustGetHealth ¶
MustGetHealth is like `GetHealth` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustMove ¶
MustMove is like `Move` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustRadar ¶
MustRadar is like `Radar` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustRotate ¶
MustRotate is like `Rotate` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustScout ¶
MustScout is like `Scout` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustUndefend ¶
func (p *Player) MustUndefend()
MustUndefend is like `Undefend` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.
func (*Player) MustWatch ¶
MustWatch is like `Watch` but panics if any errors occur. It simplifies calling if you aren't interested in error handling.