2024-01-21 01:56:45 -05:00
|
|
|
package serve
|
|
|
|
|
2024-01-21 13:28:46 -05:00
|
|
|
import "github.com/google/uuid"
|
|
|
|
|
2024-01-21 01:56:45 -05:00
|
|
|
// 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.
|
2024-01-29 14:16:34 -05:00
|
|
|
Round int8 `json:"round"`
|
2024-01-30 22:09:50 -05:00
|
|
|
// Dealer indicates whether the current player is the dealer.
|
|
|
|
Dealer bool `json:"dealer"`
|
2024-01-21 01:56:45 -05:00
|
|
|
// 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"`
|
2024-01-29 22:20:17 -05:00
|
|
|
// Live is the number of live shells this round, if it is the first turn
|
|
|
|
// of the round.
|
|
|
|
Live int `json:"live,omitempty"`
|
|
|
|
// Blank is the number of blank shells this round, if it is the first turn
|
|
|
|
// of the round.
|
|
|
|
Blank int `json:"blank,omitempty"`
|
2024-01-21 01:56:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
2024-01-21 13:56:12 -05:00
|
|
|
Items [8]string `json:"items"`
|
2024-01-21 01:56:45 -05:00
|
|
|
// Cuffs is whether the player is currently wearing cuffs.
|
|
|
|
Cuffs bool `json:"cuffs,omitempty"`
|
|
|
|
}
|
2024-01-21 02:16:30 -05:00
|
|
|
|
2024-01-21 13:28:46 -05:00
|
|
|
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"`
|
|
|
|
}
|