add Bureaucrats and clog

This commit is contained in:
stryan 2021-11-16 15:51:09 -05:00
parent 0023bc9813
commit a17f5bfa95
5 changed files with 33 additions and 13 deletions

View File

@ -110,12 +110,16 @@ func (b *Board) Play(id int, c *Card, dest int, should bool) bool {
func (b *Board) CanAttack(id, atk, def int) bool { func (b *Board) CanAttack(id, atk, def int) bool {
aBrd := b.GetRow(id) aBrd := b.GetRow(id)
dBrd := b.GetRow(flipID(id))
if atk < 0 || atk > 3 || def < 0 || def > 3 { if atk < 0 || atk > 3 || def < 0 || def > 3 {
return false return false
} }
if aBrd[atk].Empty() || aBrd[atk].Sick || atk != def { if aBrd[atk].Empty() || aBrd[atk].Sick || atk != def {
return false return false
} }
if aBrd[atk].Phased || dBrd[def].Phased {
return false
}
return true return true
} }

View File

@ -17,6 +17,7 @@ type Card struct {
Position int `json:"position"` Position int `json:"position"`
Spell bool `json:"spell"` Spell bool `json:"spell"`
Token bool `json:"token"` Token bool `json:"token"`
Phased bool `json:"phased"`
Effects []*Effect `json:"effects"` Effects []*Effect `json:"effects"`
} }
@ -32,6 +33,7 @@ func NewEmpty(p int) *Card {
Position: p, Position: p,
Spell: false, Spell: false,
Token: false, Token: false,
Phased: false,
Effects: []*Effect{}, Effects: []*Effect{},
} }
} }

View File

@ -26,7 +26,8 @@ const (
Enemy //puts -1 token on enemy unit Enemy //puts -1 token on enemy unit
//Rank 3 //Rank 3
Duelist //puts +0/+1 on allied unit Duelist //puts +0/+1 on allied unit
Bureaucrat //creates a Clog token on any open space
//Rank 4 //Rank 4
Vanguard //puts +1/+0 on allied unit Vanguard //puts +1/+0 on allied unit
@ -46,6 +47,7 @@ const (
//Tokens,etc //Tokens,etc
GoblinSpawn //1 power goblin token GoblinSpawn //1 power goblin token
Dud //0 power token Dud //0 power token
Clog //0 power token that disapears after one turn
) )
const ( const (

View File

@ -8,9 +8,9 @@ import (
"fmt" "fmt"
) )
const _CardTypeName = "EmptyValueValkSpeedsterCommanderPaladinScholarWarriorFighterSevenShieldWallHealthPotionTreeGoblinChupacabraAllyEnemyDuelistVanguardStudentLibrarianElephantMesmeristDivinerHologramGoblinSpawnDud" const _CardTypeName = "EmptyValueValkSpeedsterCommanderPaladinScholarWarriorFighterSevenShieldWallHealthPotionTreeGoblinChupacabraAllyEnemyDuelistBureaucratVanguardStudentLibrarianElephantMesmeristDivinerHologramGoblinSpawnDudClog"
var _CardTypeIndex = [...]uint8{0, 10, 14, 23, 32, 39, 46, 53, 60, 65, 75, 87, 91, 97, 107, 111, 116, 123, 131, 138, 147, 155, 164, 171, 179, 190, 193} var _CardTypeIndex = [...]uint8{0, 10, 14, 23, 32, 39, 46, 53, 60, 65, 75, 87, 91, 97, 107, 111, 116, 123, 133, 141, 148, 157, 165, 174, 181, 189, 200, 203, 207}
func (i CardType) String() string { func (i CardType) String() string {
i -= -1 i -= -1
@ -20,7 +20,7 @@ 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, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24} var _CardTypeValues = []CardType{-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
var _CardTypeNameToValueMap = map[string]CardType{ var _CardTypeNameToValueMap = map[string]CardType{
_CardTypeName[0:10]: -1, _CardTypeName[0:10]: -1,
@ -40,15 +40,17 @@ var _CardTypeNameToValueMap = map[string]CardType{
_CardTypeName[107:111]: 13, _CardTypeName[107:111]: 13,
_CardTypeName[111:116]: 14, _CardTypeName[111:116]: 14,
_CardTypeName[116:123]: 15, _CardTypeName[116:123]: 15,
_CardTypeName[123:131]: 16, _CardTypeName[123:133]: 16,
_CardTypeName[131:138]: 17, _CardTypeName[133:141]: 17,
_CardTypeName[138:147]: 18, _CardTypeName[141:148]: 18,
_CardTypeName[147:155]: 19, _CardTypeName[148:157]: 19,
_CardTypeName[155:164]: 20, _CardTypeName[157:165]: 20,
_CardTypeName[164:171]: 21, _CardTypeName[165:174]: 21,
_CardTypeName[171:179]: 22, _CardTypeName[174:181]: 22,
_CardTypeName[179:190]: 23, _CardTypeName[181:189]: 23,
_CardTypeName[190:193]: 24, _CardTypeName[189:200]: 24,
_CardTypeName[200:203]: 25,
_CardTypeName[203:207]: 26,
} }
// CardTypeString retrieves an enum value from the enum constants string name. // CardTypeString retrieves an enum value from the enum constants string name.

10
util.go
View File

@ -27,3 +27,13 @@ const (
SentinalID = 1 SentinalID = 1
ScourgeID = 2 ScourgeID = 2
) )
func flipID(i int) int {
if i == SentinalID {
return ScourgeID
} else if i == ScourgeID {
return SentinalID
} else {
return -1
}
}