add JSON DTOs for game state
This commit is contained in:
32
serve/dto.go
Normal file
32
serve/dto.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package serve
|
||||
|
||||
// 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 uint `json:"round"`
|
||||
// Group is the current shell group.
|
||||
Group uint `json:"group"`
|
||||
// Turn is the current turn.
|
||||
Turn uint `json:"turn"`
|
||||
// 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 []string `json:"items,omitempty"`
|
||||
// Cuffs is whether the player is currently wearing cuffs.
|
||||
Cuffs bool `json:"cuffs,omitempty"`
|
||||
}
|
Reference in New Issue
Block a user