card

package
v0.2.75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package card implements data structures used by Spy Cards Online.

Index

Constants

View Source
const (
	// PortraitCustomEmbedded is an embedded PNG custom portrait.
	PortraitCustomEmbedded uint8 = 254
	// PortraitCustomExternal is a FileID of an external portrait.
	PortraitCustomExternal uint8 = 255
)
View Source
const (
	// ExtensionOverrideCustom (SetStage, SetMusic): override even if a custom
	// override is already active.
	ExtensionOverrideCustom uint64 = 1 << 0
)

Extension flags.

Variables

View Source
var DefaultGameRules = GameRules{
	MaxHP:         5,
	HandMinSize:   3,
	HandMaxSize:   5,
	DrawPerTurn:   2,
	CardsPerDeck:  15,
	MinTP:         2,
	MaxTP:         10,
	TPPerTurn:     1,
	BossCards:     1,
	MiniBossCards: 2,
}

DefaultGameRules is the default game rules for Spy Cards Online.

Functions

This section is empty.

Types

type BannedCards

type BannedCards struct {
	Flags BannedCardsFlags
	Cards []ID
}

BannedCards is a custom game mode field representing cards that cannot be used in decks or summoned via random summons in this game mode.

If Cards is empty, all vanilla cards (that is, cards with an ID less than 128) are banned.

func (*BannedCards) Marshal

func (f *BannedCards) Marshal(w *format.Writer) error

Marshal implements Field.

func (*BannedCards) Type

func (f *BannedCards) Type() FieldType

Type implements Field.

func (*BannedCards) Unmarshal

func (f *BannedCards) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*BannedCards) UpdateID added in v0.2.68

func (f *BannedCards) UpdateID(oldID, newID ID)

UpdateID implements Field.

type BannedCardsFlags added in v0.2.72

type BannedCardsFlags uint64

BannedCardsFlags is a bitfield of flags for BannedCards.

const (
	BannedCardRandomSummonable BannedCardsFlags = 1 << 0
)

Constants for BannedCardsFlags.

type ContentIdentifier added in v0.2.72

type ContentIdentifier []byte

ContentIdentifier is an IPFS CID.

func (ContentIdentifier) String added in v0.2.72

func (cid ContentIdentifier) String() string

type CosmeticData

type CosmeticData struct {
	CharacterName string `json:"character"`
}

CosmeticData is non-essential data representing choices made by each player before the match began.

type Deck

type Deck []ID

Deck is a partially ordered list of Spy Cards cards, with boss first, then mini-boss, and then enemy (attacker and effect) cards.

func (Deck) MarshalBinary

func (d Deck) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (Deck) MarshalText

func (d Deck) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Deck) UnmarshalBinary

func (d *Deck) UnmarshalBinary(b []byte) (err error)

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*Deck) UnmarshalText

func (d *Deck) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Deck) Validate

func (d Deck) Validate(set *Set) error

Validate returns a non-nil error if the deck is not a valid deck for the given card set.

type DeckLimitFilter added in v0.2.68

type DeckLimitFilter struct {
	Count uint64

	Rank        Rank
	Tribe       Tribe
	CustomTribe string // used if Tribe == TribeCustom

	Card ID // used if Rank == RankNone && Tribe == TribeNone
}

DeckLimitFilter limits the number of cards that may appear in a deck based on a filter.

func (*DeckLimitFilter) IsMatch added in v0.2.75

func (f *DeckLimitFilter) IsMatch(card *Def) bool

IsMatch returns true if the specified card matches this filter.

func (*DeckLimitFilter) Marshal added in v0.2.68

func (f *DeckLimitFilter) Marshal(w *format.Writer) error

Marshal implements Field.

func (*DeckLimitFilter) Type added in v0.2.68

func (f *DeckLimitFilter) Type() FieldType

Type implements Field.

func (*DeckLimitFilter) Unmarshal added in v0.2.68

func (f *DeckLimitFilter) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*DeckLimitFilter) UpdateID added in v0.2.68

func (f *DeckLimitFilter) UpdateID(oldID, newID ID)

UpdateID implements Field.

type Def

type Def struct {
	ID     ID
	Name   string
	Tribes []TribeDef
	TP     int64

	Rank           Rank
	Portrait       uint8
	CustomPortrait []byte
	Effects        []*EffectDef
	Extensions     []*Extension
	// contains filtered or unexported fields
}

Def is a card definition.

func Vanilla

func Vanilla(id ID) *Def

Vanilla returns a card definition for a given ID.

func (*Def) Description

func (cd *Def) Description(set *Set) *RichDescription

Description returns a description of this card.

func (*Def) DisplayName

func (cd *Def) DisplayName() string

DisplayName returns the name of this card.

func (*Def) MarshalBinary

func (cd *Def) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Def) MarshalText

func (cd *Def) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Def) UnmarshalBinary

func (cd *Def) UnmarshalBinary(b []byte) (err error)

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*Def) UnmarshalText

func (cd *Def) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (*Def) UpdateID added in v0.2.73

func (cd *Def) UpdateID(oldID, newID ID)

UpdateID changes all references to oldID to newID.

type EffectDef

type EffectDef struct {
	Type     EffectType
	Priority uint8
	Flags    EffectFlag

	Text    string
	Amount  int64
	Amount2 int64
	Filter  Filter

	Result  *EffectDef
	Result2 *EffectDef
}

EffectDef is a Spy Cards Online card effect definition.

func (*EffectDef) Description

func (e *EffectDef) Description(card *Def, set *Set, parents ...*EffectDef) []*RichDescription

Description returns a description of this effect.

func (*EffectDef) Marshal

func (e *EffectDef) Marshal(w *format.Writer) (err error)

Marshal encodes the EffectDef in a binary format.

func (*EffectDef) Unmarshal

func (e *EffectDef) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal decodes the EffectDef from a binary format.

func (*EffectDef) UpdateID added in v0.2.73

func (e *EffectDef) UpdateID(oldID, newID ID)

UpdateID changes all references to oldID to newID.

type EffectFlag

type EffectFlag uint64

EffectFlag is a combination bitfield type for all effect flags.

const (
	FlagFlavorTextHideRemaining EffectFlag = 1 << 0

	FlagStatDEF      EffectFlag = 1 << 0
	FlagStatInfinity EffectFlag = 1 << 1
	FlagStatOpponent EffectFlag = 1 << 2

	FlagSummonOpponent  EffectFlag = 1 << 0
	FlagSummonReplace   EffectFlag = 1 << 1
	FlagSummonInvisible EffectFlag = 1 << 2

	FlagHealInfinity EffectFlag = 1 << 0
	FlagHealOpponent EffectFlag = 1 << 1
	FlagHealRaw      EffectFlag = 1 << 2

	FlagTPInfinity EffectFlag = 1 << 0

	FlagNumbInfinity  EffectFlag = 1 << 0
	FlagNumbSelf      EffectFlag = 1 << 1
	FlagNumbHighest   EffectFlag = 1 << 2
	FlagNumbIgnoreATK EffectFlag = 1 << 3
	FlagNumbIgnoreDEF EffectFlag = 1 << 4
	FlagNumbAvoidZero EffectFlag = 1 << 5

	FlagMultiplyHealingOpponent     EffectFlag = 1 << 0
	FlagMultiplyHealingFuture       EffectFlag = 1 << 1
	FlagMultiplyHealingTypeMask     EffectFlag = 3 << 2
	FlagMultiplyHealingTypeAll      EffectFlag = 0 << 2
	FlagMultiplyHealingTypeNegative EffectFlag = 1 << 2
	FlagMultiplyHealingTypePositive EffectFlag = 2 << 2

	FlagPreventNumbOpponent EffectFlag = 1 << 0

	FlagModifyCardsOpponent    EffectFlag = 1 << 0
	FlagModifyCardsTypeMask    EffectFlag = 3 << 1
	FlagModifyCardsTypeAdd     EffectFlag = 0 << 1
	FlagModifyCardsTypeRemove  EffectFlag = 1 << 1
	FlagModifyCardsTypeMove    EffectFlag = 2 << 1
	FlagModifyCardsTargetMask  EffectFlag = 3 << 3
	FlagModifyCardsTargetAny   EffectFlag = 0 << 3
	FlagModifyCardsTargetHand  EffectFlag = 1 << 3
	FlagModifyCardsTargetDeck  EffectFlag = 2 << 3
	FlagModifyCardsTargetField EffectFlag = 3 << 3

	FlagDrawCardOpponent  EffectFlag = 1 << 0
	FlagDrawCardIgnoreMax EffectFlag = 1 << 1

	FlagCondCardOpponent         EffectFlag = 1 << 0
	FlagCondCardTypeMask         EffectFlag = 3 << 1
	FlagCondCardTypeGreaterEqual EffectFlag = 0 << 1
	FlagCondCardTypeLessThan     EffectFlag = 1 << 1
	FlagCondCardTypeEach         EffectFlag = 2 << 1

	FlagCondLimitGreaterThan EffectFlag = 1 << 0

	FlagCondWinnerTypeMask   EffectFlag = 3 << 0
	FlagCondWinnerTypeWinner EffectFlag = 0 << 0
	FlagCondWinnerTypeLoser  EffectFlag = 1 << 0
	FlagCondWinnerTypeTie    EffectFlag = 2 << 0
	FlagCondWinnerTypeNotTie EffectFlag = 3 << 0

	FlagCondApplyNextRound    EffectFlag = 1 << 0
	FlagCondApplyOpponent     EffectFlag = 1 << 1
	FlagCondApplyOriginalText EffectFlag = 1 << 2

	FlagCondCoinTails    EffectFlag = 1 << 0
	FlagCondCoinNegative EffectFlag = 1 << 1
	FlagCondCoinStat     EffectFlag = 1 << 2

	FlagCondStatOpponent EffectFlag = 1 << 0
	FlagCondStatLessThan EffectFlag = 1 << 1
	FlagCondStatTypeMask EffectFlag = 3 << 2
	FlagCondStatTypeATK  EffectFlag = 0 << 2
	FlagCondStatTypeDEF  EffectFlag = 1 << 2
	FlagCondStatTypeHP   EffectFlag = 2 << 2
	FlagCondStatTypeTP   EffectFlag = 3 << 2
	FlagCondStatMultiple EffectFlag = 1 << 4

	FlagCondInHandHide   EffectFlag = 1 << 0
	FlagCondInHandOnPlay EffectFlag = 1 << 1
)

Constants for EffectFlag.

type EffectType

type EffectType uint8

EffectType is an enumeration of effect types.

const (
	FlavorText                 EffectType = 0
	EffectStat                 EffectType = 1
	EffectEmpower              EffectType = 2
	EffectSummon               EffectType = 3
	EffectHeal                 EffectType = 4
	EffectTP                   EffectType = 5
	EffectNumb                 EffectType = 6
	EffectRawStat              EffectType = 7
	EffectMultiplyHealing      EffectType = 8
	EffectPreventNumb          EffectType = 9
	EffectModifyAvailableCards EffectType = 10
	EffectModifyCardCost       EffectType = 11
	EffectDrawCard             EffectType = 12
	CondCard                   EffectType = 128
	CondLimit                  EffectType = 129
	CondWinner                 EffectType = 130
	CondApply                  EffectType = 131
	CondCoin                   EffectType = 132
	CondStat                   EffectType = 133
	CondInHand                 EffectType = 134
	CondLastEffect             EffectType = 135
	CondOnNumb                 EffectType = 136
)

Constants for EffectType.

func (EffectType) String

func (i EffectType) String() string

type Extension added in v0.2.72

type Extension struct {
	Type      ExtensionType
	Flags     uint64
	CID       ContentIdentifier
	LoopStart float32
	LoopEnd   float32
	// contains filtered or unexported fields
}

Extension is an extension field that allows cards to have meta-game effects.

func (*Extension) Marshal added in v0.2.72

func (e *Extension) Marshal(w *format.Writer) error

Marshal encodes the extension field.

func (*Extension) Unmarshal added in v0.2.72

func (e *Extension) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal decodes the extension field.

type ExtensionType added in v0.2.72

type ExtensionType uint64

ExtensionType is an extension field type.

const (
	ExtensionSetStage ExtensionType = 0
	ExtensionSetMusic ExtensionType = 1
)

Constants for ExtensionType.

func (ExtensionType) String added in v0.2.72

func (i ExtensionType) String() string

type ExternalMode added in v0.2.75

type ExternalMode struct {
	Name      string
	Cards     string
	Revision  int
	QuickJoin bool
}

func FetchMode added in v0.2.75

func FetchMode(ctx context.Context, name, revision string) (*ExternalMode, error)

type Field

type Field interface {
	Type() FieldType
	Marshal(w *format.Writer) error
	Unmarshal(r *format.Reader, formatVersion uint64) error
	UpdateID(oldID, newID ID)
}

Field is an interface implemented by all custom game mode fields.

func NewField

func NewField(t FieldType) (Field, error)

NewField constructs a Field with a given FieldType.

type FieldType

type FieldType uint64

FieldType is an enumeration of Spy Cards Online game mode field types.

const (
	FieldMetadata        FieldType = 0
	FieldBannedCards     FieldType = 1
	FieldGameRules       FieldType = 2
	FieldSummonCard      FieldType = 3
	FieldVariant         FieldType = 4
	FieldUnfilterCard    FieldType = 5
	FieldDeckLimitFilter FieldType = 6
	FieldTimer           FieldType = 7
)

Constants for FieldType.

func (FieldType) String

func (i FieldType) String() string

type Filter added in v0.2.72

type Filter []FilterComponent

Filter is a card filter, introduced in card format 5.

func (Filter) IsSingleCard added in v0.2.72

func (f Filter) IsSingleCard() bool

IsSingleCard returns true if this filter is a single card filter.

func (*Filter) Marshal added in v0.2.72

func (f *Filter) Marshal(w *format.Writer) error

Marshal encodes the card filter.

func (*Filter) Unmarshal added in v0.2.72

func (f *Filter) Unmarshal(r *format.Reader) (err error)

Unmarshal decodes a card filter.

type FilterComponent added in v0.2.72

type FilterComponent struct {
	Type        FilterType
	Rank        Rank
	Tribe       Tribe
	CustomTribe string
	CardID      ID
}

FilterComponent is a single component of a card filter.

type FilterType added in v0.2.72

type FilterType uint8

FilterType is a type of card filter.

const (
	FilterSingleCard FilterType = 1
	FilterTribe      FilterType = 16
	FilterNotTribe   FilterType = 32
	FilterRank       FilterType = 48
)

Constants for FilterType.

func (FilterType) String added in v0.2.72

func (i FilterType) String() string

type GameMode

type GameMode struct {
	Fields []Field
}

GameMode is a custom Spy Cards Online game mode.

func (*GameMode) Get

func (gm *GameMode) Get(t FieldType) Field

Get returns the first field of a given FieldType, or nil.

func (*GameMode) GetAll

func (gm *GameMode) GetAll(t FieldType) []Field

GetAll returns a slice of fields with a given FieldType.

func (*GameMode) MarshalBinary

func (gm *GameMode) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*GameMode) MarshalText

func (gm *GameMode) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*GameMode) UnmarshalBinary

func (gm *GameMode) UnmarshalBinary(b []byte) (err error)

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*GameMode) UnmarshalText

func (gm *GameMode) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (*GameMode) Variant

func (gm *GameMode) Variant(i int) (*GameMode, *Variant)

Variant returns the game mode modified by the Variant with the given index.

type GameRules

type GameRules struct {
	MaxHP         uint64
	HandMinSize   uint64
	HandMaxSize   uint64
	DrawPerTurn   uint64
	CardsPerDeck  uint64
	MinTP         uint64
	MaxTP         uint64
	TPPerTurn     uint64
	BossCards     uint64
	MiniBossCards uint64
}

GameRules is a custom game mode field holding modified Spy Cards rules.

func (*GameRules) Marshal

func (f *GameRules) Marshal(w *format.Writer) error

Marshal implements Field.

func (*GameRules) Type

func (f *GameRules) Type() FieldType

Type implements Field.

func (*GameRules) Unmarshal

func (f *GameRules) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*GameRules) UpdateID added in v0.2.68

func (f *GameRules) UpdateID(oldID, newID ID)

UpdateID implements Field.

type ID

type ID uint64

ID is a numeric identifier for a Spy Cards card.

IDs below 128 correspond to the card's internal enemy ID in Bug Fables.

IDs 128 and above are custom Attacker, Effect, Mini-Boss, and Boss cards, in repeating groups of 32 IDs.

const (
	Zombiant           ID = 0
	Jellyshroom        ID = 1
	Spider             ID = 2
	Zasp               ID = 3
	Cactiling          ID = 4
	Psicorp            ID = 5
	Thief              ID = 6
	Bandit             ID = 7
	Inichas            ID = 8
	Seedling           ID = 9
	Numbnail           ID = 14
	Mothiva            ID = 15
	Acornling          ID = 16
	Weevil             ID = 17
	VenusBud           ID = 19
	Chomper            ID = 20
	AcolyteAria        ID = 21
	Kabbu              ID = 23
	VenusGuardian      ID = 24
	WaspTrooper        ID = 25
	WaspBomber         ID = 26
	WaspDriller        ID = 27
	WaspScout          ID = 28
	Midge              ID = 29
	Underling          ID = 30
	MonsieurScarlet    ID = 31
	GoldenSeedling     ID = 32
	ArrowWorm          ID = 33
	Carmina            ID = 34
	SeedlingKing       ID = 35
	Broodmother        ID = 36
	Plumpling          ID = 37
	Flowerling         ID = 38
	Burglar            ID = 39
	Astotheles         ID = 40
	MotherChomper      ID = 41
	Ahoneynation       ID = 42
	BeeBoop            ID = 43
	SecurityTurret     ID = 44
	Denmuki            ID = 45
	HeavyDroneB33      ID = 46
	Mender             ID = 47
	Abomihoney         ID = 48
	DuneScorpion       ID = 49
	TidalWyrm          ID = 50
	Kali               ID = 51
	Zombee             ID = 52
	Zombeetle          ID = 53
	TheWatcher         ID = 54
	PeacockSpider      ID = 55
	Bloatshroom        ID = 56
	Krawler            ID = 57
	HauntedCloth       ID = 58
	Warden             ID = 61
	JumpingSpider      ID = 63
	MimicSpider        ID = 64
	LeafbugNinja       ID = 65
	LeafbugArcher      ID = 66
	LeafbugClubber     ID = 67
	Madesphy           ID = 68
	TheBeast           ID = 69
	ChomperBrute       ID = 70
	Mantidfly          ID = 71
	GeneralUltimax     ID = 72
	WildChomper        ID = 73
	Cross              ID = 74
	Poi                ID = 75
	PrimalWeevil       ID = 76
	FalseMonarch       ID = 77
	Mothfly            ID = 78
	MothflyCluster     ID = 79
	Ironnail           ID = 80
	Belostoss          ID = 81
	Ruffian            ID = 82
	WaterStrider       ID = 83
	DivingSpider       ID = 84
	Cenn               ID = 85
	Pisci              ID = 86
	DeadLanderα        ID = 87
	DeadLanderβ        ID = 88
	DeadLanderγ        ID = 89
	WaspKing           ID = 90
	TheEverlastingKing ID = 91
	Maki               ID = 92
	Kina               ID = 93
	Yin                ID = 94
	UltimaxTank        ID = 95
	Zommoth            ID = 96
	Riz                ID = 97
	Devourer           ID = 98
)

Constants for ID.

func (ID) BasicIndex

func (i ID) BasicIndex() int

BasicIndex returns the index of the card in the list of vanilla cards with its back (boss, mini-boss, or enemy).

func (ID) Rank

func (i ID) Rank() Rank

Rank returns the rank of a card.

func (ID) String

func (i ID) String() string

String returns the default name for this card ID.

type Metadata

type Metadata struct {
	Title         string
	Author        string
	Description   string
	LatestChanges string
}

Metadata is a custom game mode field holding human-readable descriptions of the game mode.

func (*Metadata) Marshal

func (f *Metadata) Marshal(w *format.Writer) error

Marshal implements Field.

func (*Metadata) Type

func (f *Metadata) Type() FieldType

Type implements Field.

func (*Metadata) Unmarshal

func (f *Metadata) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*Metadata) UpdateID added in v0.2.68

func (f *Metadata) UpdateID(oldID, newID ID)

UpdateID implements Field.

type Rank

type Rank uint8

Rank is an enumeration of card types.

const (
	Attacker Rank = 0
	Effect   Rank = 1
	MiniBoss Rank = 2 // Mini-Boss
	Boss     Rank = 3
	Token    Rank = 4
	Enemy    Rank = 5

	RankNone Rank = 7 // None
)

Constants for Rank.

func (Rank) Back

func (r Rank) Back() Rank

Back returns Enemy for Attacker and Effect as these ranks share a card back. Otherwise, Back returns r unchanged.

func (Rank) String

func (i Rank) String() string

type Recording

type Recording struct {
	FormatVersion  uint64
	Version        [3]uint64
	ModeName       string
	Perspective    uint8 // 0 = none, n = Player n
	Cosmetic       [2]CosmeticData
	RematchCount   uint64
	Start          time.Time
	SpoilerGuard   [2]*[32]byte
	SharedSeed     [32]byte
	PrivateSeed    [2][4]byte
	CustomCards    Set
	CustomCardsRaw string
	InitialDeck    [2]Deck
	Rounds         []RecordingRound
}

Recording is a recording of a Spy Cards Online match.

func FetchRecording added in v0.2.75

func FetchRecording(ctx context.Context, code string) (*Recording, error)

func (*Recording) MarshalBinary

func (sc *Recording) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*Recording) MarshalText

func (sc *Recording) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Recording) UnmarshalBinary

func (sc *Recording) UnmarshalBinary(b []byte) (err error)

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*Recording) UnmarshalText

func (sc *Recording) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type RecordingRound

type RecordingRound struct {
	TurnSeed  [8]byte
	TurnSeed2 [8]byte
	Ready     [2]uint64
}

RecordingRound is data for one round of Spy Cards Online.

type RichDescription

type RichDescription struct {
	Effect *EffectDef

	Text    string
	Content []*RichDescription

	// Color overrides the parent's color if it is non-zero.
	Color color.RGBA
}

RichDescription is a segment of a Spy Cards card description.

func (*RichDescription) String

func (d *RichDescription) String() string

String implements fmt.Stringer.

func (*RichDescription) Typeset added in v0.2.73

func (d *RichDescription) Typeset(font sprites.FontID, x, y, z, sx, sy, spaceX, spaceY float32, effect *EffectDef, center bool, render func(x, y, z, sx, sy float32, text string, tint color.RGBA, isEffect bool))

Typeset arranges the text in an area for rendering.

type Set

type Set struct {
	External string
	Mode     *GameMode
	Spoiler  []*BannedCards
	Variant  int
	Cards    []*Def

	AppliedPR         bool
	RandomByBackOrder bool
}

Set is a set of custom cards.

func (*Set) ByBack added in v0.2.75

func (cs *Set) ByBack(back Rank) []*Def

ByBack returns the cards in this Set with the specified back design that are available for deck building.

func (*Set) Card

func (cs *Set) Card(id ID) *Def

Card returns the card with the given ID.

func (*Set) MarshalText

func (cs *Set) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Set) UnmarshalText

func (cs *Set) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Sets

type Sets []Set

Sets is a combination of sets of cards.

func (Sets) Apply

func (cs Sets) Apply() (*Set, error)

Apply creates a Set that is the combination of cards in these sets, replacing IDs to ensure they don't overlap.

func (Sets) MarshalText

func (cs Sets) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Sets) UnmarshalText

func (cs *Sets) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type SummonCard

type SummonCard struct {
	Flags SummonCardFlags
	ID    ID
}

SummonCard is a custom game mode field that summons a card at the start of the match.

func (*SummonCard) Marshal

func (f *SummonCard) Marshal(w *format.Writer) error

Marshal implements Field.

func (*SummonCard) Type

func (f *SummonCard) Type() FieldType

Type implements Field.

func (*SummonCard) Unmarshal

func (f *SummonCard) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*SummonCard) UpdateID added in v0.2.68

func (f *SummonCard) UpdateID(oldID, newID ID)

UpdateID implements Field.

type SummonCardFlags

type SummonCardFlags uint64

SummonCardFlags is a bitfield of flags for SummonCards.

const (
	SummonCardBothPlayers SummonCardFlags = 1 << 0
)

Constants for SummonCardFlags.

type Timer added in v0.2.72

type Timer struct {
	StartTime  uint64
	MaxTime    uint64
	PerTurn    uint64
	MaxPerTurn uint64
}

Timer limits the amount of time players may spend per turn.

func (*Timer) Marshal added in v0.2.72

func (f *Timer) Marshal(w *format.Writer) error

Marshal implements Field.

func (*Timer) Type added in v0.2.72

func (f *Timer) Type() FieldType

Type implements Field.

func (*Timer) Unmarshal added in v0.2.72

func (f *Timer) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*Timer) UpdateID added in v0.2.72

func (f *Timer) UpdateID(oldID, newID ID)

UpdateID implements Field.

type Tribe

type Tribe uint8

Tribe is a 4-bit identifier for a Bug Fables Spy Cards tribe.

const (
	TribeSeedling   Tribe = 0  // Seedling
	TribeWasp       Tribe = 1  // Wasp
	TribeFungi      Tribe = 2  // Fungi
	TribeZombie     Tribe = 3  // Zombie
	TribePlant      Tribe = 4  // Plant
	TribeBug        Tribe = 5  // Bug
	TribeBot        Tribe = 6  // Bot
	TribeThug       Tribe = 7  // Thug
	TribeUnknown    Tribe = 8  // ???
	TribeChomper    Tribe = 9  // Chomper
	TribeLeafbug    Tribe = 10 // Leafbug
	TribeDeadLander Tribe = 11 // Dead Lander
	TribeMothfly    Tribe = 12 // Mothfly
	TribeSpider     Tribe = 13 // Spider
	TribeCustom     Tribe = 14 // (custom)
	TribeNone       Tribe = 15 // (none)
)

Constants for Tribe.

func (Tribe) String

func (i Tribe) String() string

type TribeDef

type TribeDef struct {
	Tribe Tribe

	Red   uint8
	Green uint8
	Blue  uint8

	CustomName string
}

TribeDef represents a built-in or custom tribe.

func (TribeDef) Color

func (t TribeDef) Color() color.RGBA

Color returns the color associated with this TribeDef.

func (TribeDef) Name

func (t TribeDef) Name() string

Name returns the display name of this TribeDef.

type TurnData added in v0.2.75

type TurnData struct {
	Ready  [2]uint64
	Played [2][]ID
}

TurnData is the data stored for one round of Spy Cards Online to allow verification.

type UnfilterCard

type UnfilterCard struct {
	Flags UnfilterCardFlags
	ID    ID
}

UnfilterCard is a custom game mode field that summons a card at the start of the match.

func (*UnfilterCard) Marshal

func (f *UnfilterCard) Marshal(w *format.Writer) error

Marshal implements Field.

func (*UnfilterCard) Type

func (f *UnfilterCard) Type() FieldType

Type implements Field.

func (*UnfilterCard) Unmarshal

func (f *UnfilterCard) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*UnfilterCard) UpdateID added in v0.2.68

func (f *UnfilterCard) UpdateID(oldID, newID ID)

UpdateID implements Field.

type UnfilterCardFlags

type UnfilterCardFlags uint64

UnfilterCardFlags is a bitfield of flags for UnfilterCards.

type UnknownDeck

type UnknownDeck []Rank

UnknownDeck is a Deck that only knows the backs of the cards within it.

func (UnknownDeck) MarshalBinary

func (ud UnknownDeck) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*UnknownDeck) UnmarshalBinary

func (ud *UnknownDeck) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Variant

type Variant struct {
	Title string
	NPC   string
	Rules []Field
}

Variant is a custom game mode field representing a sub-mode.

Variants can be selected when starting a match, and append their rules to the game mode's set of fields.

If at least one Variant is present, one variant is always applied.

func (*Variant) Marshal

func (f *Variant) Marshal(w *format.Writer) error

Marshal implements Field.

func (*Variant) Type

func (f *Variant) Type() FieldType

Type implements Field.

func (*Variant) Unmarshal

func (f *Variant) Unmarshal(r *format.Reader, formatVersion uint64) (err error)

Unmarshal implements Field.

func (*Variant) UpdateID added in v0.2.68

func (f *Variant) UpdateID(oldID, newID ID)

UpdateID implements Field.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL