Documentation ¶
Overview ¶
Package npc implements computer-controlled Spy Cards Online players.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CardMaster ¶
type CardMaster struct { GenericNPC Character *room.Character Deck card.Deck }
CardMaster is a generic NPC with a predefined deck and character.
func (*CardMaster) CreateDeck ¶
func (cm *CardMaster) CreateDeck(set *card.Set) card.Deck
CreateDeck returns a predefined deck.
func (*CardMaster) PickPlayer ¶
func (cm *CardMaster) PickPlayer() *room.Character
PickPlayer returns a predefined player character.
func (*CardMaster) String ¶ added in v0.3.3
func (cm *CardMaster) String() string
type GenericNPC ¶
type GenericNPC struct {
// contains filtered or unexported fields
}
GenericNPC implements the Bug Fables Spy Cards AI.
func (*GenericNPC) AfterRound ¶
func (g *GenericNPC) AfterRound(m *match.Match)
AfterRound does nothing.
func (*GenericNPC) CreateDeck ¶
func (g *GenericNPC) CreateDeck(set *card.Set) card.Deck
CreateDeck creates a completely random deck, avoiding ELK.
func (*GenericNPC) PickPlayer ¶
func (g *GenericNPC) PickPlayer() *room.Character
PickPlayer picks a random player character.
func (*GenericNPC) PlayRound ¶
func (g *GenericNPC) PlayRound(m *match.Match) uint64
PlayRound plays cards, if possible, from left to right.
func (*GenericNPC) String ¶ added in v0.3.3
func (g *GenericNPC) String() string
type Janet ¶
type Janet struct {
TourneyPlayer
}
Janet is... Janet.
func (*Janet) CreateDeck ¶
CreateDeck has a 50% chance of picking ELK as a boss card.
type MenderSpam ¶ added in v0.2.76
type MenderSpam struct { GenericNPC Mothiva bool }
MenderSpam implements the "mender spam" playstyle.
func (*MenderSpam) CreateDeck ¶ added in v0.2.76
func (m *MenderSpam) CreateDeck(set *card.Set) card.Deck
CreateDeck creates a "mender spam" deck.
func (*MenderSpam) PickPlayer ¶ added in v0.2.76
func (m *MenderSpam) PickPlayer() *room.Character
PickPlayer selects a player based on the miniboss cards in the deck.
func (*MenderSpam) PlayRound ¶ added in v0.2.76
func (m *MenderSpam) PlayRound(ctx *match.Match) uint64
PlayRound implements the logic for the "mender spam" playstyle.
func (*MenderSpam) String ¶ added in v0.3.3
func (m *MenderSpam) String() string
type NPC ¶
type NPC interface { // PickPlayer returns a player character to represent this NPC. PickPlayer() *room.Character // CreateDeck returns a slice of cards to use as a deck. CreateDeck(set *card.Set) card.Deck // PlayRound returns a bitmask of cards from the player's hand to play. PlayRound(m *match.Match) uint64 // AfterRound is called after a round's winner has been determined. AfterRound(m *match.Match) fmt.Stringer }
NPC is a computer-controlled Spy Cards Online player.
type SavedDecks ¶ added in v0.2.76
type SavedDecks struct {
GenericNPC
}
SavedDecks is an NPC that selects a prebuilt deck from the player's saved decks, if possible.
func (*SavedDecks) CreateDeck ¶ added in v0.2.76
func (s *SavedDecks) CreateDeck(set *card.Set) card.Deck
CreateDeck returns a random valid saved deck, falling back to the default deck construction algorithm if no saved decks are valid.
func (*SavedDecks) String ¶ added in v0.3.3
func (s *SavedDecks) String() string
type TourneyPlayer ¶
type TourneyPlayer struct { GenericNPC Character *room.Character }
TourneyPlayer is a generic NPC with a predefined character.
func (*TourneyPlayer) CreateDeck ¶ added in v0.3.1
func (tp *TourneyPlayer) CreateDeck(set *card.Set) card.Deck
CreateDeck returns a predefined deck with a 14 in 17 chance.
func (*TourneyPlayer) PickPlayer ¶
func (tp *TourneyPlayer) PickPlayer() *room.Character
PickPlayer returns a predefined player character.
func (*TourneyPlayer) String ¶ added in v0.3.3
func (tp *TourneyPlayer) String() string
type TourneyPlayer2 ¶ added in v0.2.76
type TourneyPlayer2 struct { TourneyPlayer AdjustWeight func(*card.Def, float32, card.Deck, *card.Set) float32 WeightDesc string }
TourneyPlayer2 is a more advanced card-playing algorithm.
Currently, it implements a more complex method of deck building, but uses the default round-to-round logic.
func (*TourneyPlayer2) CreateDeck ¶ added in v0.2.76
func (t *TourneyPlayer2) CreateDeck(set *card.Set) card.Deck
CreateDeck creates a deck based on weights and card synergies.
func (*TourneyPlayer2) SelectCard ¶ added in v0.3.11
func (*TourneyPlayer2) String ¶ added in v0.3.3
func (t *TourneyPlayer2) String() string