add adrenaline to dto
This commit is contained in:
parent
93716a7f0f
commit
d0b3cbd47a
@ -277,6 +277,7 @@ func (g *Match) DTO(id player.ID, deadline time.Time) serve.Game {
|
||||
Round: g.round,
|
||||
Dealer: g.CurrentPlayer() == &g.players[0],
|
||||
Damage: g.damage,
|
||||
Adrenaline: g.adrenaline,
|
||||
Shell: g.Peek(id),
|
||||
Previous: g.prev,
|
||||
Deadline: deadline.UnixMilli(),
|
||||
|
@ -32,6 +32,7 @@ func TestNewGame(t *testing.T) {
|
||||
{g.hp < 2 || g.hp > 4, "hp is %d, want 2-4", []any{g.hp}},
|
||||
{g.damage != 1, "damage is %d, want 1", []any{g.damage}},
|
||||
{g.reveal, "revealed at start", nil},
|
||||
{g.adrenaline, "adrenaline at start", nil},
|
||||
{g.prev != nil, "already discharged", nil},
|
||||
}
|
||||
for _, c := range checks {
|
||||
@ -60,6 +61,7 @@ func TestGameStartRound(t *testing.T) {
|
||||
{g.hp < 2 || g.hp > 4, "hp is %d, want 2-4", []any{g.hp}},
|
||||
{g.damage != 1, "damage is %d, want 1", []any{g.damage}},
|
||||
{g.reveal, "revealed at start", nil},
|
||||
{g.adrenaline, "adrenaline at start", nil},
|
||||
{g.prev != nil, "already discharged", nil},
|
||||
}
|
||||
for _, c := range checks {
|
||||
@ -95,6 +97,7 @@ func TestGameStartGroup(t *testing.T) {
|
||||
{g.turn != 1, "turn is %d, want 1", []any{g.turn}},
|
||||
{g.damage != 1, "damage is %d, want 1", []any{g.damage}},
|
||||
{g.reveal, "revealed at start", nil},
|
||||
{g.adrenaline, "adrenaline at start", nil},
|
||||
{g.prev != nil, "already discharged", nil},
|
||||
}
|
||||
for _, c := range checks {
|
||||
@ -128,6 +131,7 @@ func TestGameNextTurn(t *testing.T) {
|
||||
{g.turn != i, "turn is %d, want %d", []any{g.turn, i}},
|
||||
{g.damage != 1, "damage is %d, want 1", []any{g.damage}},
|
||||
{g.reveal, "revealed at start", nil},
|
||||
{g.adrenaline, "adrenaline at start", nil},
|
||||
{g.CurrentPlayer().cuffs != uncuffed, "cuffs is %d, want %d", []any{g.CurrentPlayer().cuffs, uncuffed}},
|
||||
}
|
||||
for _, c := range checks {
|
||||
@ -451,6 +455,7 @@ func TestGameDTO(t *testing.T) {
|
||||
Round: g.round,
|
||||
Dealer: false,
|
||||
Damage: g.damage,
|
||||
Adrenaline: false,
|
||||
Shell: nil,
|
||||
Previous: nil,
|
||||
Live: len(g.shells) / 2,
|
||||
@ -477,6 +482,7 @@ func TestGameDTO(t *testing.T) {
|
||||
Round: g.round,
|
||||
Dealer: true,
|
||||
Damage: g.damage,
|
||||
Adrenaline: false,
|
||||
Shell: nil,
|
||||
Previous: &g.shellArray[0],
|
||||
Live: 0,
|
||||
|
@ -17,6 +17,8 @@ type Game struct {
|
||||
Dealer bool `json:"dealer"`
|
||||
// Damage is the damage a live shell will deal this turn.
|
||||
Damage int8 `json:"damage"`
|
||||
// Adrenaline indicates whether the current player has adrenaline.
|
||||
Adrenaline bool `json:"adrenaline"`
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user