shotgun/serve/dto.go

46 lines
1.3 KiB
Go

package serve
import "github.com/google/uuid"
// Game is the JSON DTO for a game.
type Game struct {
// Players is the players in the game.
// The dealer is always the first player.
Players [2]Player `json:"players"`
// Round is the current round.
Round int8 `json:"round"`
// Damage is the damage a live shell will deal this turn.
Damage int8 `json:"damage"`
// Shell gives whether the current shell is live if it is revealed.
// Undefined if this game state is not for the current player or if the
// current player hasn't revealed it.
Shell *bool `json:"shell,omitempty"`
// Previous gives whether the previously discharged shell was live.
Previous *bool `json:"previous"`
}
// Player is the JSON DTO for a player.
type Player struct {
// HP is the player's current health.
HP int8 `json:"hp"`
// Items is the player's items.
Items [8]string `json:"items"`
// Cuffs is whether the player is currently wearing cuffs.
Cuffs bool `json:"cuffs,omitempty"`
}
type GameID = uuid.UUID
// GameStart is the JSON DTO given to each player when their game starts.
// Observers do not receive it.
type GameStart struct {
ID GameID `json:"id"`
Dealer bool `json:"dealer"`
}
// ShellCounts is the JSON DTO for shell counts emitted at the start of a shell group.
type ShellCounts struct {
Live int `json:"live"`
Blank int `json:"blank"`
}