data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultChamber        []bool = []bool{}
	DefaultNumChamber     int    = 6
	DefaultNumBullet      int    = 1
	DefaultNumBulletsLeft int    = 1
	DefaultCurrentChamber int    = 0
)
View Source
var (
	DefaultOpponents             map[string]Player = map[string]Player{}
	DefaultGameAccepted          bool              = false
	DefaultSpinChamberRule       bool              = false
	DefaultSpinChamberOnShotRule bool              = false
	DefaultReplaceBulletRule     bool              = false
	DefaultChannel               string            = ""
)
View Source
var (
	DefaultLosers      []string = []string{}
	DefaultTurns       []string = []string{}
	DefaultCurrentTurn int      = 0
)

Functions

This section is empty.

Types

type GameSettings

type GameSettings struct {
	Opponents             map[string]Player
	TableState            TableState
	GunState              GunState
	GameAccepted          bool   `json:"game_accepted,omitempty"`
	SpinChamberRule       bool   `json:"spin_chamber,omitempty"`
	SpinChamberOnShotRule bool   `json:"spin_chamber_on_shot,omitempty"`
	ReplaceBulletRule     bool   `json:"replace_bullet,omitempty"`
	Channel               string `json:"channel,omitempty"`
}

func (*GameSettings) Shoot

func (s *GameSettings) Shoot(user *discordgo.User) (bool, error)

type GunState

type GunState struct {
	Chambers       []bool `json:"chambers"`
	NumChamber     int    `json:"num_chambers"`
	NumBullets     int    `json:"num_bullets"`
	NumBulletsLeft int    `json:"num_bullets_left"`
	CurrentChamber int    `json:"current_chamber"`
}

func (*GunState) CountBullets

func (g *GunState) CountBullets(shot bool)

func (*GunState) SetNextChamber

func (g *GunState) SetNextChamber()

func (*GunState) SpinChamber

func (g *GunState) SpinChamber()

type Handler

type Handler struct {
	CommandSpecs   *discordgo.ApplicationCommand
	CommandHandler func(s *discordgo.Session, i *discordgo.InteractionCreate)
}

func (*Handler) GetName

func (h *Handler) GetName() string

type Item

type Item struct {
	Name        string
	Description string
	Inventory   int
	Effect      func(*GameSettings)
}

func (*Item) Use

func (i *Item) Use(s *GameSettings) string

type Player

type Player struct {
	discordgo.User
	Accepted string `json:"accepted"`
}

type TableState

type TableState struct {
	Losers      []string `json:"losers"`
	Turns       []string `json:"turns"`
	CurrentTurn int      `json:"current_turn"`
}

func (*TableState) GetCurrentPlayer

func (t *TableState) GetCurrentPlayer() string

func (*TableState) Ongoing

func (t *TableState) Ongoing() bool

func (*TableState) RemovePlayer

func (t *TableState) RemovePlayer(user string) error

func (*TableState) SetNextPlayer

func (t *TableState) SetNextPlayer()

func (*TableState) SpinTable

func (t *TableState) SpinTable()

type User

type User struct {
	discordgo.User
	GamesWon    int
	GamesPlayed int
}

Jump to

Keyboard shortcuts

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