game

package
Version: v0.0.0-...-d92090f Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IsWerewolf       = "IS a Werewolf!"
	IsNotWerewolf    = "is not a Werewolf"
	IsSeer           = "IS a Seer"
	IsNotSeer        = "is not a Seer"
	IsAuxEvil        = "IS a aux evil"
	IsNotAuxEvil     = "is not aux evil"
	WolfListSingle   = "The Werewolf is"
	WolfListMultiple = "The Werewolves are"
)
View Source
const (
	NotRunning = iota
	Setup      = iota
	Running    = iota
	Finished   = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionResult

type ActionResult struct {
	PlayerMessage string
	Killed        player.Player
}

type FingerPoint

type FingerPoint struct {
	From player.Player
	To   player.Player
}

type Game

type Game struct {
	Players          map[string]player.Player `json:"-"`
	PlayerList       []player.Player          `json:"players"`
	Roleset          *roleset.Roleset         `json:"roleset"`
	Tally            []*tally.TallyItem       `json:"tally"`
	State            int                      `json:"game_state"`
	Phase            int                      `json:"phase"`
	NightActionQueue []*FingerPoint           `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(joinChan chan player.Player) *Game

func (*Game) AddPlayer

func (g *Game) AddPlayer(p player.Player) error

func (*Game) AliveMaxEvils

func (g *Game) AliveMaxEvils() []string

func (*Game) Broadcast

func (g *Game) Broadcast(title string, payload interface{})

func (*Game) Day

func (g *Game) Day() bool

func (*Game) End

func (g *Game) End(victor int)

func (*Game) EndDay

func (g *Game) EndDay(ousted player.Player)

func (*Game) HandleJoins

func (g *Game) HandleJoins(joinChan chan player.Player)

func (*Game) HandlePlayerMessage

func (g *Game) HandlePlayerMessage()

func (*Game) NextPhase

func (g *Game) NextPhase()

func (*Game) NightAction

func (g *Game) NightAction(fp *FingerPoint) *ActionResult

func (*Game) Parity

func (g *Game) Parity() int

func (*Game) ProcessNightActionQueue

func (g *Game) ProcessNightActionQueue()

func (*Game) ProcessStartActionQueue

func (g *Game) ProcessStartActionQueue()

func (*Game) QueueNightAction

func (g *Game) QueueNightAction(fp *FingerPoint)

func (*Game) RebuildTally

func (g *Game) RebuildTally()

RebuildTally calculates the current tally based on individual votes. If there are no votes, it essentially clears it.

func (*Game) RemovePlayer

func (g *Game) RemovePlayer(id string)

func (*Game) Reset

func (g *Game) Reset()

func (*Game) SetRoleset

func (g *Game) SetRoleset(r *roleset.Roleset) error

func (*Game) ShouldStart

func (g *Game) ShouldStart() bool

func (*Game) Start

func (g *Game) Start() error

func (*Game) StartAction

func (g *Game) StartAction(p player.Player) *ActionResult

func (*Game) UpdatePlayerList

func (g *Game) UpdatePlayerList()

func (*Game) Vote

func (g *Game) Vote(from player.Player, to string) error

func (*Game) VotedOut

func (g *Game) VotedOut() player.Player

Jump to

Keyboard shortcuts

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