don't apply effects to empty cards

This commit is contained in:
stryan 2021-07-25 17:23:12 -04:00
parent 37d0702d5c
commit c5e8f2d404
2 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,9 @@ type Effect struct {
} }
func RemoveEffect(source uuid.UUID, c *Card) { func RemoveEffect(source uuid.UUID, c *Card) {
if c.Type == EmptyValue {
return
}
for i, e := range c.Effects { for i, e := range c.Effects {
if e.Owner == source { if e.Owner == source {
c.Effects = append(c.Effects[:i], c.Effects[i+1:]...) 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) { func AddEffect(c *Card, e Effect) {
if c.Type == EmptyValue {
return
}
for _, v := range c.Effects { for _, v := range c.Effects {
if v.Owner == e.Owner && v.ID == e.ID { if v.Owner == e.Owner && v.ID == e.ID {
return return

View File

@ -53,7 +53,6 @@ func OracleTick(c *Card, g *Game) {
//+1 to all //+1 to all
for _, v := range row { for _, v := range row {
if v.Id != c.Id { if v.Id != c.Id {
v.Effects = append(v.Effects, Effect{c.Id, v.Id, 1})
AddEffect(v, Effect{c.Id, v.Id, 1}) AddEffect(v, Effect{c.Id, v.Id, 1})
} }
} }