fix effect stacking
This commit is contained in:
parent
2e512b655b
commit
dff9f6ce60
@ -101,6 +101,7 @@ func (b *Board) Play(id int, c *Card, dest int, should bool) bool {
|
|||||||
brd := b.GetRow(id)
|
brd := b.GetRow(id)
|
||||||
if should {
|
if should {
|
||||||
c.Position = dest
|
c.Position = dest
|
||||||
|
c.Owner = id
|
||||||
brd[dest] = c
|
brd[dest] = c
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@ -154,10 +155,8 @@ func (b *Board) Attack(id, atk, def int) int {
|
|||||||
func (b *Board) ResetCards() {
|
func (b *Board) ResetCards() {
|
||||||
for _, v := range b.Sentinal {
|
for _, v := range b.Sentinal {
|
||||||
v.Power = v.BasePower
|
v.Power = v.BasePower
|
||||||
v.Effects = []*Effect{}
|
|
||||||
}
|
}
|
||||||
for _, v := range b.Scourge {
|
for _, v := range b.Scourge {
|
||||||
v.Power = v.BasePower
|
v.Power = v.BasePower
|
||||||
v.Effects = []*Effect{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func AddEffect(c *Card, e *Effect) {
|
|||||||
return
|
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 && v.Target == e.Target {
|
||||||
log.Println("can't stack effects")
|
log.Println("can't stack effects")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,6 @@ func OracleTick(c *Card, g *Game) {
|
|||||||
//+1 around it
|
//+1 around it
|
||||||
if c.Position-1 >= 0 {
|
if c.Position-1 >= 0 {
|
||||||
AddEffect(row[c.Position-1], &Effect{c.Id, row[c.Position-1].Id, 1})
|
AddEffect(row[c.Position-1], &Effect{c.Id, row[c.Position-1].Id, 1})
|
||||||
|
|
||||||
}
|
}
|
||||||
if c.Position+1 <= 3 {
|
if c.Position+1 <= 3 {
|
||||||
AddEffect(row[c.Position+1], &Effect{c.Id, row[c.Position+1].Id, 1})
|
AddEffect(row[c.Position+1], &Effect{c.Id, row[c.Position+1].Id, 1})
|
||||||
@ -140,8 +139,10 @@ func OracleEffect(c *Card, g *Game) {
|
|||||||
case 2:
|
case 2:
|
||||||
if c.Owner == SentinalID {
|
if c.Owner == SentinalID {
|
||||||
g.CardBuffer = DeckFromCards(g.SentinalDeck.Scry(1))
|
g.CardBuffer = DeckFromCards(g.SentinalDeck.Scry(1))
|
||||||
} else {
|
} else if c.Owner == ScourgeID {
|
||||||
g.CardBuffer = DeckFromCards(g.SentinalDeck.Scry(1))
|
g.CardBuffer = DeckFromCards(g.SentinalDeck.Scry(1))
|
||||||
|
} else {
|
||||||
|
log.Println("card draw effect was played but with no owner?")
|
||||||
}
|
}
|
||||||
g.CanDraw = true
|
g.CanDraw = true
|
||||||
g.HasDrawn = false
|
g.HasDrawn = false
|
||||||
|
Loading…
Reference in New Issue
Block a user