Documentation ¶
Overview ¶
Package match implements gameplay and rendering logic for Spy Cards Online.
Index ¶
- Constants
- func LoadDecks() []card.Deck
- func PrivateShuffle(scg *matchnet.SecureCardGame, cards []*Card, remote bool)
- func PublicShuffle(scg *matchnet.SecureCardGame, cards []*Card)
- func SaveDeck(d card.Deck)
- func SortQueue(q []CardEffect)
- type ActiveCard
- type Card
- type CardEffect
- type CardMode
- type GameLog
- type Init
- type Match
- func (m *Match) BeginTurn(turnData *card.TurnData)
- func (m *Match) FilterCards(f card.Filter, allowBanned, allowUnfiltered bool) []card.ID
- func (m *Match) IndexSet()
- func (m *Match) InitState()
- func (m *Match) ProcessQueuedEffect(r *rng.RNG) []CardEffect
- func (m *Match) ShuffleAndDraw(scg *matchnet.SecureCardGame, haveRemoteSeed bool)
- func (m *Match) Winner() uint8
- type Number
- type Recording
- type Side
- type State
Constants ¶
View Source
const ModeCustom = "custom"
Variables ¶
This section is empty.
Functions ¶
func PrivateShuffle ¶ added in v0.2.75
func PrivateShuffle(scg *matchnet.SecureCardGame, cards []*Card, remote bool)
PrivateShuffle shuffles a set of cards.
func PublicShuffle ¶ added in v0.2.75
func PublicShuffle(scg *matchnet.SecureCardGame, cards []*Card)
PublicShuffle shuffles a set of cards where only the backs are known.
func SortQueue ¶ added in v0.2.75
func SortQueue(q []CardEffect)
Types ¶
type ActiveCard ¶ added in v0.2.75
type ActiveCard struct { Card *Card Mode CardMode Desc *card.RichDescription Effects []*card.EffectDef UnNumb int64 ATK Number DEF Number ActiveEffect *card.EffectDef }
ActiveCard is a a card that's on the field.
type CardEffect ¶ added in v0.2.75
type CardEffect struct { Card *ActiveCard Effect *card.EffectDef Player uint8 }
CardEffect is a queued effect.
type Init ¶ added in v0.2.75
type Init struct { // Mode is the name of the game mode, one of the following: // - an empty string (vanilla) // - "custom" (ad-hoc custom) // - name.v, where name is a lowercase ascii string and // v is a positive integer (hosted community game mode) Mode string // Version is the Spy Cards Online version number at the time this match // was played. Version [3]uint64 // Custom is the encoded custom cards. For vanilla, this should be empty. // For hosted game modes, this should match the mode's data as returned by // the server. For ad-hoc custom game modes, this may be any non-empty // string of card data. Custom string // Variant is the game mode variant. Variant may be 0 if there are no // variants defined by the game mode. Otherwise, Variant must be less than // the number of variants defined by the game mode. Variant uint64 External *card.ExternalMode CachedVariant *card.Variant Latest bool }
Init is the initial data, known before a match is established.
type Match ¶ added in v0.2.75
type Match struct { // Init holds data known before the match is established. Init *Init // Start is the timestamp of the start of the first round. That is, when // both players finished selecting their decks. Start time.Time // Rematches is the number of matches that happened within this // matchmaking session so far. It starts at 0 and increases by 1 each // time the players agree to a rematch. Rematches uint64 // Perspective is the player number (either 1 or 2, for hosting player or // joining player, respectively). Perspective uint8 // Cosmetic holds non-critical cosmetic data for the players of the match. Cosmetic [2]card.CosmeticData // Set is the modified card set, with changes applied by spoiler guard, etc. Set *card.Set // Rules is a copy of the rules from Set for convenience. Rules card.GameRules // Timer is a copy of the timer from Set for convenience. Timer card.Timer // Banned is a cache of banned cards from Set. Banned map[card.ID]bool // Unpickable is a cache of unpickable cards from Set. Unpickable map[card.ID]bool // Unfiltered is a cache of unfiltered cards from Set. Unfiltered map[card.ID]bool HasReplaceSummon map[card.ID]bool OrderForSummon map[card.ID]int // State is the mutable state of the match. State State // Log is the game log. Log GameLog }
Match is the data for a specific match.
func (*Match) FilterCards ¶ added in v0.2.75
func (*Match) ProcessQueuedEffect ¶ added in v0.2.75
func (m *Match) ProcessQueuedEffect(r *rng.RNG) []CardEffect
func (*Match) ShuffleAndDraw ¶ added in v0.2.75
func (m *Match) ShuffleAndDraw(scg *matchnet.SecureCardGame, haveRemoteSeed bool)
type Recording ¶ added in v0.2.75
func NewRecording ¶ added in v0.2.75
type Side ¶ added in v0.2.75
type Side struct { HP Number TP Number ATK Number DEF Number RawATK Number RawDEF Number HealMulP int64 HealMulN int64 HealP Number HealN Number Hand []*Card Deck []*Card Discard []*Card Field []*ActiveCard Setup []*ActiveCard Limit map[*card.EffectDef]int64 }
Side is mutable state for a single player.
type State ¶ added in v0.2.75
type State struct { // Round is the current round number. Round uint64 // Sides holds state that is separate for each player. Sides [2]Side // Queue is the card effect queue. Queue []CardEffect // OnNumb is the effects that activate on numb. OnNumb []CardEffect // MaxPriority is the latest effect priority processed this turn. MaxPriority uint8 RoundWinner uint8 }
State is the mutable state of the match.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.