From 4c37ad270d5adbc085d5ad304ccd4269f9391bc0 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 25 Jul 2021 13:35:49 -0400 Subject: [PATCH] implement ace, differ between spells (valk) --- internal/game/board.go | 2 +- internal/game/card.go | 2 ++ internal/game/oracle.go | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/game/board.go b/internal/game/board.go index 0c74404..8f9c47e 100644 --- a/internal/game/board.go +++ b/internal/game/board.go @@ -99,7 +99,7 @@ func (b *Board) Move(id, src, dest int) bool { func (b *Board) CanPlay(id int, c *Card, dest int) bool { brd := b.GetRow(id) - if !brd[dest].Empty() { + if !brd[dest].Empty() || !c.Spell { return false } return true diff --git a/internal/game/card.go b/internal/game/card.go index 1299132..af5c3ea 100644 --- a/internal/game/card.go +++ b/internal/game/card.go @@ -15,6 +15,7 @@ type Card struct { Counters int `json:"counters"` Owner int `json:"owner"` Position int `json:"position"` + Spell bool `json:"spell"` } type CardType int @@ -54,6 +55,7 @@ func NewCard(v, o, p int, id uuid.UUID) *Card { Counters: 0, Owner: o, Position: p, + Spell: OracleSpell(CardType(v), nil), } } diff --git a/internal/game/oracle.go b/internal/game/oracle.go index 48a97e8..4cb7652 100644 --- a/internal/game/oracle.go +++ b/internal/game/oracle.go @@ -15,6 +15,15 @@ func OracleUpkeep(c *Card, g *Game) { return } +func OracleSpell(c CardType, g *Game) bool { + switch c { + case Valk: + return true + default: + return false + } +} + func OracleCast(c *Card, g *Game) bool { switch c.Type { case Valk: @@ -28,6 +37,8 @@ func OracleCast(c *Card, g *Game) bool { func OracleEnters(c *Card, g *Game) { c.Sick = true switch c.Type { + case Ace: + c.Sick = false case Two: //+1 to all if c.Owner == SentinalID {