implement ace, differ between spells (valk)

This commit is contained in:
stryan 2021-07-25 13:35:49 -04:00
parent d1845760fe
commit 4c37ad270d
3 changed files with 14 additions and 1 deletions

View File

@ -99,7 +99,7 @@ func (b *Board) Move(id, src, dest int) bool {
func (b *Board) CanPlay(id int, c *Card, dest int) bool { func (b *Board) CanPlay(id int, c *Card, dest int) bool {
brd := b.GetRow(id) brd := b.GetRow(id)
if !brd[dest].Empty() { if !brd[dest].Empty() || !c.Spell {
return false return false
} }
return true return true

View File

@ -15,6 +15,7 @@ type Card struct {
Counters int `json:"counters"` Counters int `json:"counters"`
Owner int `json:"owner"` Owner int `json:"owner"`
Position int `json:"position"` Position int `json:"position"`
Spell bool `json:"spell"`
} }
type CardType int type CardType int
@ -54,6 +55,7 @@ func NewCard(v, o, p int, id uuid.UUID) *Card {
Counters: 0, Counters: 0,
Owner: o, Owner: o,
Position: p, Position: p,
Spell: OracleSpell(CardType(v), nil),
} }
} }

View File

@ -15,6 +15,15 @@ func OracleUpkeep(c *Card, g *Game) {
return return
} }
func OracleSpell(c CardType, g *Game) bool {
switch c {
case Valk:
return true
default:
return false
}
}
func OracleCast(c *Card, g *Game) bool { func OracleCast(c *Card, g *Game) bool {
switch c.Type { switch c.Type {
case Valk: case Valk:
@ -28,6 +37,8 @@ func OracleCast(c *Card, g *Game) bool {
func OracleEnters(c *Card, g *Game) { func OracleEnters(c *Card, g *Game) {
c.Sick = true c.Sick = true
switch c.Type { switch c.Type {
case Ace:
c.Sick = false
case Two: case Two:
//+1 to all //+1 to all
if c.Owner == SentinalID { if c.Owner == SentinalID {