This commit is contained in:
stryan 2021-10-07 14:03:16 -04:00
parent 739f10c51e
commit 2ecf1dbc70

22
game.go
View File

@ -15,6 +15,8 @@ type Game struct {
ScourgePlayer *Player
SentinalDeck *Deck
ScourgeDeck *Deck
SentinalGrave *Deck
ScourgeGrave *Deck
CurrentTurn int
CardBuffer *Deck
CanDraw bool
@ -33,6 +35,8 @@ func NewGame() *Game {
ScourgePlayer: NewPlayer("Scourge", ScourgeID),
SentinalDeck: deckA,
ScourgeDeck: deckB,
SentinalGrave: DeckFromCards([]*Card{}),
ScourgeGrave: DeckFromCards([]*Card{}),
CurrentTurn: 0, //start with no turn
CardBuffer: DeckFromCards([]*Card{}),
CanDraw: false,
@ -308,14 +312,18 @@ func (g *Game) PlayerAct(id int, cmd string) *Deck {
case 2:
OracleLeaves(defender, g)
g.GameBoard.Remove(defender)
g.Bury(defender)
case 3:
OracleLeaves(attacker, g)
g.GameBoard.Remove(attacker)
g.Bury(attacker)
case 4:
OracleLeaves(attacker, g)
OracleLeaves(defender, g)
g.GameBoard.Remove(attacker)
g.GameBoard.Remove(defender)
g.Bury(attacker)
g.Bury(defender)
}
return DeckFromCards(g.GameBoard.GetRow(g.CurrentTurn))
@ -410,3 +418,17 @@ func (g *Game) GetOpponentDeck(id int) *Deck {
func (g *Game) GetBoard(id int) []*Card {
return g.GameBoard.GetRow(id)
}
func (g *Game) GetGrave(id int) *Deck {
if id == SentinalID {
return g.SentinalGrave
} else if id == ScourgeID {
return g.ScourgeGrave
} else {
return nil
}
}
func (g *Game) Bury(c *Card) {
grave := g.GetGrave(c.Owner)
grave.Cards = append(grave.Cards, c)
}