48 lines
898 B
Go
48 lines
898 B
Go
|
package tome_lib
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/google/uuid"
|
||
|
)
|
||
|
|
||
|
type Card struct {
|
||
|
Type CardType `json:"type"`
|
||
|
BasePower int `json:"base_power"`
|
||
|
Power int `json:"power"`
|
||
|
Id uuid.UUID `json:"id"`
|
||
|
Sick bool `json:"sick"`
|
||
|
Counters int `json:"counters"`
|
||
|
Owner int `json:"owner"`
|
||
|
Position int `json:"position"`
|
||
|
Spell bool `json:"spell"`
|
||
|
Effects []*Effect `json:"effects"`
|
||
|
}
|
||
|
|
||
|
func NewEmpty(p int) *Card {
|
||
|
return &Card{
|
||
|
Type: EmptyValue,
|
||
|
BasePower: -1,
|
||
|
Power: -1,
|
||
|
Id: uuid.New(),
|
||
|
Sick: false,
|
||
|
Counters: 0,
|
||
|
Owner: -1,
|
||
|
Position: p,
|
||
|
Spell: false,
|
||
|
Effects: []*Effect{},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (c *Card) Empty() bool {
|
||
|
return c.Type == EmptyValue
|
||
|
}
|
||
|
|
||
|
func (c *Card) String() string {
|
||
|
ready := " "
|
||
|
if c.Sick {
|
||
|
ready = "*"
|
||
|
}
|
||
|
return fmt.Sprintf("%v%v%v", c.Type, c.Power, ready)
|
||
|
}
|