server_game

package
v0.0.0-...-a58af4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Shield = "🛡"
	Helmet = "🪖"
	Arrow  = "🏹"
	Axe    = "🪓"
	Thief  = "👌"
)

Variables

This section is empty.

Functions

func ActivateBaldr

func ActivateBaldr(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateBragi

func ActivateBragi(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateBrunhild

func ActivateBrunhild(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateFreyja

func ActivateFreyja(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateFreyr

func ActivateFreyr(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateFrigg

func ActivateFrigg(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateHeimdall

func ActivateHeimdall(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateHel

func ActivateHel(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateIdun

func ActivateIdun(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateLoki

func ActivateLoki(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateMimir

func ActivateMimir(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateOdin

func ActivateOdin(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateSkadi

func ActivateSkadi(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateSkuld

func ActivateSkuld(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateThor

func ActivateThor(_ *ServerGame, _ *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateThrymr

func ActivateThrymr(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateTyr

func ActivateTyr(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateUllr

func ActivateUllr(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateVar

func ActivateVar(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

func ActivateVidar

func ActivateVidar(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

Types

type God

type God struct {
	Emoji       string
	Name        string
	Description string
	Priority    int
	Levels      [3]Power
	Activate    GodActivation
}

func InitGods

func InitGods() []*God

type GodActivation

type GodActivation func(game *ServerGame, self *ServerPlayer, opponent *ServerPlayer, god *God, level int)

type GodChoice

type GodChoice struct {
	// contains filtered or unexported fields
}

type Player

type Player interface {
	GetUsername() string
	GetHealth() int
	GetTokens() int
}

type PlayerDice

type PlayerDice [6]*PlayerDie

type PlayerDie

type PlayerDie struct {
	// contains filtered or unexported fields
}

func NewPlayerDie

func NewPlayerDie() *PlayerDie

func (*PlayerDie) GetFaceIndex

func (die *PlayerDie) GetFaceIndex() int

func (*PlayerDie) GetQuantity

func (die *PlayerDie) GetQuantity() int

func (*PlayerDie) IsKept

func (die *PlayerDie) IsKept() bool

func (*PlayerDie) Keep

func (die *PlayerDie) Keep()

func (*PlayerDie) Reset

func (die *PlayerDie) Reset()

func (*PlayerDie) Roll

func (die *PlayerDie) Roll()

func (*PlayerDie) Unkeep

func (die *PlayerDie) Unkeep()

type Power

type Power struct {
	Description string
	TokenCost   int
	Quantity    int
}

type ServerDie

type ServerDie struct {
	// contains filtered or unexported fields
}

func InitDice

func InitDice() [6]ServerDie

func (ServerDie) GetFaces

func (d ServerDie) GetFaces() [6]ServerFace

type ServerFace

type ServerFace struct {
	// contains filtered or unexported fields
}

func (ServerFace) GetKind

func (f ServerFace) GetKind() string

func (ServerFace) IsMagic

func (f ServerFace) IsMagic() bool

type ServerGame

type ServerGame struct {
	Uuid string

	Rolls        int
	Dice         [6]ServerDie
	Players      cmn.PlayerMap[*ServerPlayer]
	PlayersOrder []string
	Gods         []*God
	// contains filtered or unexported fields
}

func NewServerGame

func NewServerGame() (*ServerGame, error)

func (*ServerGame) AddPlayer

func (g *ServerGame) AddPlayer(conn *websocket.Conn, name string, godIndexes [3]int) error

func (*ServerGame) ChangePlayersPosition

func (g *ServerGame) ChangePlayersPosition()

func (*ServerGame) ComputeRound

func (g *ServerGame) ComputeRound() cmn.PlayerMap[cmn.UpdateGamePlayer]

func (*ServerGame) GetGodsDefinition

func (g *ServerGame) GetGodsDefinition() []cmn.InitGod

func (*ServerGame) GetOpponentName

func (g *ServerGame) GetOpponentName(you string) string

func (*ServerGame) GetRollDiceState

func (g *ServerGame) GetRollDiceState() cmn.PlayerMap[cmn.DiceState]

func (*ServerGame) GetStartingDefinition

func (g *ServerGame) GetStartingDefinition() (cmn.PlayerMap[cmn.InitGamePlayer], []cmn.InitGameDie)

func (*ServerGame) GetTurn

func (g *ServerGame) GetTurn() int

func (*ServerGame) IsGameFinished

func (g *ServerGame) IsGameFinished() bool

func (*ServerGame) IsGameReady

func (g *ServerGame) IsGameReady() bool

func (*ServerGame) Restart

func (g *ServerGame) Restart()

func (*ServerGame) SelectFirstPlayer

func (g *ServerGame) SelectFirstPlayer()

type ServerPlayer

type ServerPlayer struct {
	Conn     *websocket.Conn
	Expected []c.Command
	// contains filtered or unexported fields
}

func NewServerPlayer

func NewServerPlayer(conn *websocket.Conn, username string, godIndexes [3]int) *ServerPlayer

func (*ServerPlayer) AttackPlayer

func (sp *ServerPlayer) AttackPlayer(dices [6]ServerDie, player *ServerPlayer) (int, int)

func (*ServerPlayer) GainTokens

func (sp *ServerPlayer) GainTokens(dices [6]ServerDie) int

func (*ServerPlayer) GetDice

func (sp *ServerPlayer) GetDice() PlayerDice

func (*ServerPlayer) GetGodChoice

func (p *ServerPlayer) GetGodChoice() *GodChoice

func (*ServerPlayer) GetGods

func (sp *ServerPlayer) GetGods() [3]int

func (*ServerPlayer) GetHealth

func (sp *ServerPlayer) GetHealth() int

func (*ServerPlayer) GetTokens

func (sp *ServerPlayer) GetTokens() int

func (*ServerPlayer) GetUsername

func (sp *ServerPlayer) GetUsername() string

func (*ServerPlayer) Reset

func (sp *ServerPlayer) Reset()

func (*ServerPlayer) ResetDice

func (sp *ServerPlayer) ResetDice()

func (*ServerPlayer) RollDice

func (sp *ServerPlayer) RollDice()

func (*ServerPlayer) SelectGod

func (sp *ServerPlayer) SelectGod(godIndex int, godLevel int)

func (*ServerPlayer) StealTokens

func (sp *ServerPlayer) StealTokens(dices [6]ServerDie, player *ServerPlayer) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL