From 61fe6b5936e52c67cb3fb5430fb4321024fae13e Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 30 Sep 2021 22:08:27 -0400 Subject: [PATCH] skip draw step on 0 life --- internal/game/game.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/game/game.go b/internal/game/game.go index 1475bcd..43654af 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -186,8 +186,17 @@ func (g *Game) PlayerStateAct(id int, cmd string) *GameView { if g.Status == StatusReady { //first turn g.Status = StatusPlaying } - g.CanDraw = true - g.HasDrawn = false + //skip draw step when 0 life + if id == SentinalID && g.SentinalPlayer.Life <= 0 { + g.CanDraw = false + g.HasDrawn = true + } else if id == ScourgeID && g.ScourgePlayer.Life <= 0 { + g.CanDraw = false + g.HasDrawn = true + } else { + g.CanDraw = true + g.HasDrawn = false + } if id != g.CurrentTurn { return nil }