indicate in game state whose turn it is

This commit is contained in:
Branden J Brown 2024-01-30 21:09:50 -06:00
parent b837facd4a
commit 3d9a0b9836
6 changed files with 11 additions and 3 deletions

View File

@ -237,6 +237,7 @@ func (g *Match) DTO(id player.ID) serve.Game {
g.players[1].DTO(), g.players[1].DTO(),
}, },
Round: g.round, Round: g.round,
Dealer: g.CurrentPlayer() == &g.players[0],
Damage: g.damage, Damage: g.damage,
Shell: g.Peek(id), Shell: g.Peek(id),
Previous: g.prev, Previous: g.prev,

View File

@ -445,6 +445,7 @@ func TestGameDTO(t *testing.T) {
g.players[1].DTO(), g.players[1].DTO(),
}, },
Round: g.round, Round: g.round,
Dealer: false,
Damage: g.damage, Damage: g.damage,
Shell: nil, Shell: nil,
Previous: nil, Previous: nil,
@ -469,6 +470,7 @@ func TestGameDTO(t *testing.T) {
g.players[1].DTO(), g.players[1].DTO(),
}, },
Round: g.round, Round: g.round,
Dealer: true,
Damage: g.damage, Damage: g.damage,
Shell: nil, Shell: nil,
Previous: &g.shellArray[0], Previous: &g.shellArray[0],

View File

@ -9,6 +9,8 @@ type Game struct {
Players [2]Player `json:"players"` Players [2]Player `json:"players"`
// Round is the current round. // Round is the current round.
Round int8 `json:"round"` Round int8 `json:"round"`
// Dealer indicates whether the current player is the dealer.
Dealer bool `json:"dealer"`
// Damage is the damage a live shell will deal this turn. // Damage is the damage a live shell will deal this turn.
Damage int8 `json:"damage"` Damage int8 `json:"damage"`
// Shell gives whether the current shell is live if it is revealed. // Shell gives whether the current shell is live if it is revealed.

View File

@ -8,9 +8,7 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
Game: typeof import('./src/components/Game.vue')['default'] Game: typeof import('./src/components/Game.vue')['default']
GameRound: typeof import('./src/components/GameRound.vue')['default']
GameStatus: typeof import('./src/components/GameStatus.vue')['default'] GameStatus: typeof import('./src/components/GameStatus.vue')['default']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
Player: typeof import('./src/components/Player.vue')['default'] Player: typeof import('./src/components/Player.vue')['default']
PlayerHP: typeof import('./src/components/PlayerHP.vue')['default'] PlayerHP: typeof import('./src/components/PlayerHP.vue')['default']
PlayerItems: typeof import('./src/components/PlayerItems.vue')['default'] PlayerItems: typeof import('./src/components/PlayerItems.vue')['default']

View File

@ -1,7 +1,7 @@
<template> <template>
<v-container> <v-container>
<v-row class="d-flex justify-center"> <v-row class="d-flex justify-center">
<v-sheet :elevation="2" width="800" height="600"> <v-sheet :elevation="2" width="800">
<v-row class="d-flex justify-center"> <v-row class="d-flex justify-center">
<v-col cols="auto"> <v-col cols="auto">
<GameStatus :game="testGame" /> <GameStatus :game="testGame" />
@ -32,6 +32,7 @@ const testGame: Game = {
{ hp: 3, items: ['🔍', '🔍', '', '', '', '', '', ''] }, { hp: 3, items: ['🔍', '🔍', '', '', '', '', '', ''] },
], ],
round: 1, round: 1,
dealer: true,
damage: 1, damage: 1,
previous: true, previous: true,
}; };

View File

@ -11,6 +11,10 @@ export interface Game {
* Round number. * Round number.
*/ */
round: number; round: number;
/**
* Whether it is the dealer's turn.
*/
dealer: boolean;
/** /**
* Damage that a live round will deal this turn. * Damage that a live round will deal this turn.
*/ */