Documentation ¶
Index ¶
- type Game
- func (g *Game) AddPlayer(p *player.Player)
- func (g *Game) AliveMaxEvils() []*player.Player
- func (g *Game) AlivePlayersByType() (maxes []*player.Player, nonmaxes []*player.Player)
- func (g *Game) Broadcast(t server.MessageType, payload interface{})
- func (g *Game) BroadcastPlayerList()
- func (g *Game) BroadcastView(v *player.View)
- func (g *Game) ChooseRoleset(slug string) error
- func (g *Game) EndGame(winner role.PlayerType)
- func (g *Game) IsDay() bool
- func (g *Game) IsNight() bool
- func (g *Game) KillPlayer(p *player.Player)
- func (g *Game) ListenToGameChannel()
- func (g *Game) Parity() int
- func (g *Game) RevealPlayer(p *player.Player)
- func (g *Game) SendLeaderMessages()
- func (g *Game) SetLeader(p *player.Player)
- func (g *Game) SetNightAction(fp *player.FingerPoint) error
- func (g *Game) Start() error
- func (g *Game) State() GameState
- func (g *Game) ToGameOverMessage() *server.GameOverMessage
- func (g *Game) Vote(fp *player.FingerPoint) error
- type GameState
- type PhaseError
- type PlayerCountError
- type StateError
- type VotingMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct { ID uuid.UUID Leader *player.Player VotingMethod VotingMethod AlivePlayers map[uuid.UUID]*player.Player Players map[uuid.UUID]*player.Player Roleset *roleset.Roleset Phase int Tally *tally.Tally Winner role.PlayerType Password string // contains filtered or unexported fields }
func (*Game) AliveMaxEvils ¶
func (*Game) AlivePlayersByType ¶ added in v0.3.0
func (*Game) Broadcast ¶ added in v0.5.0
func (g *Game) Broadcast(t server.MessageType, payload interface{})
func (*Game) BroadcastPlayerList ¶ added in v0.13.0
func (g *Game) BroadcastPlayerList()
func (*Game) BroadcastView ¶ added in v0.11.0
BroadcastView sends a view to every player, alive and dead. It is primarily used for revealing the roles of dead players.
func (*Game) ChooseRoleset ¶ added in v0.2.0
func (*Game) EndGame ¶ added in v0.3.0
func (g *Game) EndGame(winner role.PlayerType)
func (*Game) KillPlayer ¶ added in v0.3.0
func (*Game) ListenToGameChannel ¶ added in v0.13.0
func (g *Game) ListenToGameChannel()
func (*Game) RevealPlayer ¶ added in v0.4.0
func (*Game) SendLeaderMessages ¶ added in v0.21.0
func (g *Game) SendLeaderMessages()
func (*Game) SetNightAction ¶ added in v0.4.0
func (g *Game) SetNightAction(fp *player.FingerPoint) error
func (*Game) ToGameOverMessage ¶ added in v0.30.0
func (g *Game) ToGameOverMessage() *server.GameOverMessage
type PhaseError ¶ added in v0.3.0
type PhaseError struct {
GamePhase int
}
func (*PhaseError) Error ¶ added in v0.3.0
func (e *PhaseError) Error() string
type PlayerCountError ¶ added in v0.2.0
func (*PlayerCountError) Error ¶ added in v0.2.0
func (e *PlayerCountError) Error() string
type StateError ¶ added in v0.2.0
func (*StateError) Error ¶ added in v0.2.0
func (e *StateError) Error() string
type VotingMethod ¶ added in v0.3.0
type VotingMethod int
const ( // InstaKill means that as soon as one player has 51% of the vote they are killed and the day ends. InstaKill VotingMethod = iota // InstaKillWithDelay is the same as InstaKill, but with a delay to allow for claiming and changing of votes. It is not currently supported. InstaKillWithDelay // Timed will end the day after a set number of minutes, killing whoever is in the lead (breaking ties with Longest Held Last Vote). It is not currently supported. Timed )
Click to show internal directories.
Click to hide internal directories.