empty cards have owners, clogs and duds should work
This commit is contained in:
parent
3972de39d5
commit
a28b45e5cf
4
board.go
4
board.go
@ -4,7 +4,7 @@ import . "git.saintnet.tech/tomecraft/tome_lib"
|
||||
|
||||
func NewBoard() *Board {
|
||||
return &Board{
|
||||
Sentinal: [4]*Card{NewEmpty(0), NewEmpty(1), NewEmpty(2), NewEmpty(3)},
|
||||
Scourge: [4]*Card{NewEmpty(0), NewEmpty(1), NewEmpty(2), NewEmpty(3)},
|
||||
Sentinal: [4]*Card{NewEmpty(SentinalID, 0), NewEmpty(SentinalID, 1), NewEmpty(SentinalID, 2), NewEmpty(SentinalID, 3)},
|
||||
Scourge: [4]*Card{NewEmpty(ScourgeID, 0), NewEmpty(ScourgeID, 1), NewEmpty(ScourgeID, 2), NewEmpty(ScourgeID, 3)},
|
||||
}
|
||||
}
|
||||
|
6
card.go
6
card.go
@ -1,11 +1,17 @@
|
||||
package tome_game
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
. "git.saintnet.tech/tomecraft/tome_lib"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func NewCard(v, o, p int, id uuid.UUID) *Card {
|
||||
if o != ScourgeID && o != SentinalID {
|
||||
log.Println("Need valid owner for card")
|
||||
return nil
|
||||
}
|
||||
if id == uuid.Nil {
|
||||
id = uuid.New()
|
||||
}
|
||||
|
10
deck.go
10
deck.go
@ -1,11 +1,17 @@
|
||||
package tome_game
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
. "git.saintnet.tech/tomecraft/tome_lib"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func NewDeck(owner int) *Deck {
|
||||
if owner != SentinalID && owner != ScourgeID {
|
||||
log.Printf("need valid owner for new deck: %v", owner)
|
||||
return nil
|
||||
}
|
||||
cards := []*Card{}
|
||||
for i := 0; i < 3; i++ {
|
||||
for j := 1; j < 9; j++ {
|
||||
@ -19,6 +25,10 @@ func NewDeck(owner int) *Deck {
|
||||
}
|
||||
|
||||
func LoadDeck(owner int, cards []int) *Deck {
|
||||
if owner != SentinalID && owner != ScourgeID {
|
||||
log.Printf("need valid owner for loaded deck:%v", owner)
|
||||
return nil
|
||||
}
|
||||
if len(cards) == 0 {
|
||||
return NewDeck(owner)
|
||||
}
|
||||
|
10
oracle.go
10
oracle.go
@ -16,11 +16,13 @@ func OracleUpkeep(c *Card, g *Game) {
|
||||
g.Bury(c)
|
||||
}
|
||||
case Hologram:
|
||||
c.Sick = false
|
||||
if c.Counters >= 3 {
|
||||
g.GameBoard.Remove(c)
|
||||
g.Bury(c)
|
||||
}
|
||||
case Clog:
|
||||
c.Sick = false
|
||||
if c.Counters >= 1 {
|
||||
g.GameBoard.Remove(c)
|
||||
g.Bury(c)
|
||||
@ -115,7 +117,7 @@ func OracleEnters(c *Card, g *Game) {
|
||||
}
|
||||
|
||||
func OracleTick(c *Card, g *Game) {
|
||||
if c.Type == EmptyValue {
|
||||
if c.Empty() {
|
||||
return
|
||||
}
|
||||
row := g.GetBoard(c.Owner)
|
||||
@ -249,6 +251,7 @@ func OracleEffect(c *Card, g *Game) {
|
||||
case 3:
|
||||
c.BasePower = e.Modifier
|
||||
case 4:
|
||||
g.GameBoard.Remove(c)
|
||||
g.Bury(c)
|
||||
case 5: //+x/+0
|
||||
if g.CurrentTurn == c.Owner {
|
||||
@ -272,10 +275,11 @@ func OracleEffect(c *Card, g *Game) {
|
||||
}
|
||||
case 9: //create dud
|
||||
RemoveEffect(e.Owner, c)
|
||||
c = NewCard(int(Dud), c.Owner, c.Position, uuid.Nil)
|
||||
g.GameBoard.Replace(c, NewCard(int(Dud), c.Owner, c.Position, uuid.Nil))
|
||||
case 10: //create clog
|
||||
RemoveEffect(e.Owner, c)
|
||||
c = NewCard(int(Clog), c.Owner, c.Position, uuid.Nil)
|
||||
log.Println("applying clog")
|
||||
g.GameBoard.Replace(c, NewCard(int(Clog), c.Owner, c.Position, uuid.Nil))
|
||||
default:
|
||||
log.Println("wrong effect type")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user