start adding new cards

This commit is contained in:
stryan 2021-11-08 15:33:55 -05:00
parent c24e1aac32
commit fa38a05c9d
5 changed files with 46 additions and 34 deletions

View File

@ -6,8 +6,10 @@ import (
) )
type Board struct { type Board struct {
Sentinal [4]*Card `json:"sentinal"` Sentinal [4]*Card `json:"sentinal"`
Scourge [4]*Card `json:"scourge"` SentinalSpells [2]int
Scourge [4]*Card `json:"scourge"`
ScourgeSpells [2]int
} }
func (b *Board) String() string { func (b *Board) String() string {

18
card.go
View File

@ -19,24 +19,6 @@ type Card struct {
Effects []*Effect `json:"effects"` Effects []*Effect `json:"effects"`
} }
//go:generate enumer -type=CardType -json
type CardType int
const (
Valk CardType = iota
Ace
Two
Three
Four
Five
Six
Seven
Eight
)
const (
EmptyValue CardType = -1
)
func NewEmpty(p int) *Card { func NewEmpty(p int) *Card {
return &Card{ return &Card{
Type: EmptyValue, Type: EmptyValue,

24
cardtype.go Normal file
View File

@ -0,0 +1,24 @@
package tome_lib
//go:generate enumer -type=CardType -json
type CardType int
const (
Valk CardType = iota
Speedster //ace, has haste
Commander //2, buffs row
Paladin //3, buffs neighbours
Scholar //4, draws card
Warrior //5, nothing
Fighter //6, nothing
Seven //7, seven
ShieldWall //8, only blocks
//new cards
HealthPotion //both players get +1 health
Tree //grows to 8 after five turns
Goblin //adds two other 1 strength units
)
const (
EmptyValue CardType = -1
)

View File

@ -8,9 +8,9 @@ import (
"fmt" "fmt"
) )
const _CardTypeName = "EmptyValueValkAceTwoThreeFourFiveSixSevenEight" const _CardTypeName = "EmptyValueValkSpeedsterCommanderPaladinScholarWarriorFighterSevenShieldWallHealthPotionTreeGoblin"
var _CardTypeIndex = [...]uint8{0, 10, 14, 17, 20, 25, 29, 33, 36, 41, 46} var _CardTypeIndex = [...]uint8{0, 10, 14, 23, 32, 39, 46, 53, 60, 65, 75, 87, 91, 97}
func (i CardType) String() string { func (i CardType) String() string {
i -= -1 i -= -1
@ -20,19 +20,22 @@ func (i CardType) String() string {
return _CardTypeName[_CardTypeIndex[i]:_CardTypeIndex[i+1]] return _CardTypeName[_CardTypeIndex[i]:_CardTypeIndex[i+1]]
} }
var _CardTypeValues = []CardType{-1, 0, 1, 2, 3, 4, 5, 6, 7, 8} var _CardTypeValues = []CardType{-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
var _CardTypeNameToValueMap = map[string]CardType{ var _CardTypeNameToValueMap = map[string]CardType{
_CardTypeName[0:10]: -1, _CardTypeName[0:10]: -1,
_CardTypeName[10:14]: 0, _CardTypeName[10:14]: 0,
_CardTypeName[14:17]: 1, _CardTypeName[14:23]: 1,
_CardTypeName[17:20]: 2, _CardTypeName[23:32]: 2,
_CardTypeName[20:25]: 3, _CardTypeName[32:39]: 3,
_CardTypeName[25:29]: 4, _CardTypeName[39:46]: 4,
_CardTypeName[29:33]: 5, _CardTypeName[46:53]: 5,
_CardTypeName[33:36]: 6, _CardTypeName[53:60]: 6,
_CardTypeName[36:41]: 7, _CardTypeName[60:65]: 7,
_CardTypeName[41:46]: 8, _CardTypeName[65:75]: 8,
_CardTypeName[75:87]: 9,
_CardTypeName[87:91]: 10,
_CardTypeName[91:97]: 11,
} }
// CardTypeString retrieves an enum value from the enum constants string name. // CardTypeString retrieves an enum value from the enum constants string name.

View File

@ -7,9 +7,10 @@ import (
) )
type Effect struct { type Effect struct {
Owner uuid.UUID Owner uuid.UUID
Target uuid.UUID Target uuid.UUID
ID int ID int
Modifier int
} }
func RemoveEffect(source uuid.UUID, c *Card) { func RemoveEffect(source uuid.UUID, c *Card) {