indicate in game state whose turn it is
This commit is contained in:
parent
b837facd4a
commit
3d9a0b9836
@ -237,6 +237,7 @@ func (g *Match) DTO(id player.ID) serve.Game {
|
||||
g.players[1].DTO(),
|
||||
},
|
||||
Round: g.round,
|
||||
Dealer: g.CurrentPlayer() == &g.players[0],
|
||||
Damage: g.damage,
|
||||
Shell: g.Peek(id),
|
||||
Previous: g.prev,
|
||||
|
@ -445,6 +445,7 @@ func TestGameDTO(t *testing.T) {
|
||||
g.players[1].DTO(),
|
||||
},
|
||||
Round: g.round,
|
||||
Dealer: false,
|
||||
Damage: g.damage,
|
||||
Shell: nil,
|
||||
Previous: nil,
|
||||
@ -469,6 +470,7 @@ func TestGameDTO(t *testing.T) {
|
||||
g.players[1].DTO(),
|
||||
},
|
||||
Round: g.round,
|
||||
Dealer: true,
|
||||
Damage: g.damage,
|
||||
Shell: nil,
|
||||
Previous: &g.shellArray[0],
|
||||
|
@ -9,6 +9,8 @@ type Game struct {
|
||||
Players [2]Player `json:"players"`
|
||||
// Round is the current 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 int8 `json:"damage"`
|
||||
// Shell gives whether the current shell is live if it is revealed.
|
||||
|
2
site/components.d.ts
vendored
2
site/components.d.ts
vendored
@ -8,9 +8,7 @@ export {}
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
Game: typeof import('./src/components/Game.vue')['default']
|
||||
GameRound: typeof import('./src/components/GameRound.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']
|
||||
PlayerHP: typeof import('./src/components/PlayerHP.vue')['default']
|
||||
PlayerItems: typeof import('./src/components/PlayerItems.vue')['default']
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<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-col cols="auto">
|
||||
<GameStatus :game="testGame" />
|
||||
@ -32,6 +32,7 @@ const testGame: Game = {
|
||||
{ hp: 3, items: ['🔍', '🔍', '', '', '', '', '', ''] },
|
||||
],
|
||||
round: 1,
|
||||
dealer: true,
|
||||
damage: 1,
|
||||
previous: true,
|
||||
};
|
||||
|
@ -11,6 +11,10 @@ export interface Game {
|
||||
* Round number.
|
||||
*/
|
||||
round: number;
|
||||
/**
|
||||
* Whether it is the dealer's turn.
|
||||
*/
|
||||
dealer: boolean;
|
||||
/**
|
||||
* Damage that a live round will deal this turn.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user