From c5e8f2d404c2dc3f191f1e48e54bf6833b116351 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 25 Jul 2021 17:23:12 -0400 Subject: [PATCH] don't apply effects to empty cards --- internal/game/effect.go | 6 ++++++ internal/game/oracle.go | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/game/effect.go b/internal/game/effect.go index 23d8178..28a5232 100644 --- a/internal/game/effect.go +++ b/internal/game/effect.go @@ -9,6 +9,9 @@ type Effect struct { } func RemoveEffect(source uuid.UUID, c *Card) { + if c.Type == EmptyValue { + return + } for i, e := range c.Effects { if e.Owner == source { c.Effects = append(c.Effects[:i], c.Effects[i+1:]...) @@ -17,6 +20,9 @@ func RemoveEffect(source uuid.UUID, c *Card) { } func AddEffect(c *Card, e Effect) { + if c.Type == EmptyValue { + return + } for _, v := range c.Effects { if v.Owner == e.Owner && v.ID == e.ID { return diff --git a/internal/game/oracle.go b/internal/game/oracle.go index 391f345..80f3de0 100644 --- a/internal/game/oracle.go +++ b/internal/game/oracle.go @@ -53,7 +53,6 @@ func OracleTick(c *Card, g *Game) { //+1 to all for _, v := range row { if v.Id != c.Id { - v.Effects = append(v.Effects, Effect{c.Id, v.Id, 1}) AddEffect(v, Effect{c.Id, v.Id, 1}) } }