don't apply effects to empty cards
This commit is contained in:
parent
37d0702d5c
commit
c5e8f2d404
@ -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
|
||||||
|
@ -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})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user