Documentation ¶
Index ¶
- Constants
- Variables
- type Card
- type CardList
- type CardType
- type GameState
- func (g *GameState) AddPlayer(name string)
- func (g *GameState) Advance()
- func (g *GameState) CensoredCopy(playerNum int) GameState
- func (g *GameState) ClearTable()
- func (g *GameState) DealCards()
- func (g *GameState) FinishBattle()
- func (g *GameState) HandleHologram(playerNum int)
- func (g *GameState) HandleSingularity()
- func (g *GameState) HandleTesseract()
- func (g *GameState) IsPlayersTurn(playerNum int) bool
- func (g *GameState) MakeDeck()
- func (g *GameState) Pass(playerNum int)
- func (g *GameState) PlayerMustPass(playerNum int) bool
- func (g *GameState) Setup()
- func (g *GameState) SetupPlayers(players int)
- func (g *GameState) SetupWithPlayers(players int)
- func (g *GameState) StartBattle()
- func (g *GameState) StrongestWarshipPlayed() Card
- func (g *GameState) TakeTurn(playerNum int, playsCardAt int)
- func (g *GameState) Winners() []int
- type Phase
- type Player
Constants ¶
const MaxHandSize = 10
MaxHandSize is the maximum hand size in the game
const MaxPlayers = 6
MaxPlayers is the most players the game supports
const (
RulesText = `` /* 1253-byte string literal not displayed */
)
Variables ¶
var CardHelpText = [...]string{ Fighter: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Fighter]), Escort: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Escort]), Frigate: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Frigate]), Destroyer: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Destroyer]), Cruiser: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Cruiser]), Battleship: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Battleship]), Dreadnaught: fmt.Sprintf("A Warship with %d base strength", CardStrengths[Dreadnaught]), Tactician: "Doubles the strength of all Warships (black cards).", Probe: "Has N strength where N is the number of Probes you've played this battle.", Singularity: "Destroys all copies of the warship with the highest base strength.", Tesseract: "Immediately ends the battle. The current leading player wins.", Asteroids: "All warships have effective strength 1; Cancels the effects of Solar Wind when played.", SolarWind: "The warships in play with the highest base strength gain a +3 strength bonus; Cancels the effects of Asteroids when played.", Hologram: "When played, return the warship you most recently played to your hand.", }
var CardNames = [...]string{ Fighter: "Fighter", Escort: "Escort", Frigate: "Frigate", Destroyer: "Destroyer", Cruiser: "Cruiser", Battleship: "Battleship", Dreadnaught: "Dreadnaught", Tactician: "Tactician", Probe: "Probe", Singularity: "Singularity", Tesseract: "Tesseract", Asteroids: "Asteroids", SolarWind: "Solar Wind", Hologram: "Hologram", }
var CardStrengths = [...]int{ Fighter: 1, Escort: 2, Frigate: 3, Destroyer: 4, Cruiser: 5, Battleship: 6, Dreadnaught: 10, Tactician: 0, Probe: 1, Singularity: 0, Tesseract: 0, Asteroids: 0, SolarWind: 0, Hologram: 0, }
var CardText = [...]string{ Fighter: "1", Escort: "2", Frigate: "3", Destroyer: "4", Cruiser: "5", Battleship: "6", Dreadnaught: "10", Tactician: "x2", Probe: "N", Singularity: ".", Tesseract: "#", Asteroids: "=", SolarWind: "~", Hologram: "@", }
var CardTypes = [...]CardType{ Fighter: Warship, Escort: Warship, Frigate: Warship, Destroyer: Warship, Cruiser: Warship, Battleship: Warship, Dreadnaught: Warship, Tactician: Special, Probe: Special, Singularity: Special, Tesseract: Special, Asteroids: Battlefield, SolarWind: Battlefield, Hologram: Special, }
Functions ¶
This section is empty.
Types ¶
type CardList ¶
type CardList []Card
CardList is a collection of ordered cards
func (*CardList) PlayCardInto ¶
PlayCardInto removes the card at `cardIndex` from `h` and inserts it into destination (at the end)
func (*CardList) RemoveCardAt ¶
func (CardList) Same ¶
Same returns true if the cardlist contains the same cards in the same order as the other cardlist
type GameState ¶
type GameState struct { Deck CardList Players []Player Phase Turn int // if Phase is WaitingOnPlayer, this is the index of the player // if a global modifier card has been played, it will be this Battlefield Card }
GameState holds the state of the entire game
func (*GameState) Advance ¶
func (g *GameState) Advance()
Advance makes all of the AI players take a turn
func (*GameState) CensoredCopy ¶
CensoredCopy copies the state of the game, but includes only information that should be available to the provided player.
NOTE: uncensored elements of the copy may share storage with the original
func (*GameState) ClearTable ¶
func (g *GameState) ClearTable()
ClearTable resets the game state between battles
func (*GameState) DealCards ¶
func (g *GameState) DealCards()
DealCards distributes cards from the deck to all players
func (*GameState) FinishBattle ¶
func (g *GameState) FinishBattle()
FinishBattle scores a battle, awards a victory to the winning player, and resets the game state
func (*GameState) HandleHologram ¶
func (*GameState) HandleSingularity ¶
func (g *GameState) HandleSingularity()
func (*GameState) HandleTesseract ¶
func (g *GameState) HandleTesseract()
func (*GameState) IsPlayersTurn ¶
func (*GameState) MakeDeck ¶
func (g *GameState) MakeDeck()
MakeDeck initializes a new deck of cards for the game
func (*GameState) PlayerMustPass ¶
func (*GameState) SetupPlayers ¶
SetupPlayers creates the given number of players
func (*GameState) SetupWithPlayers ¶
SetupWithPlayers initializes all players' hands
func (*GameState) StartBattle ¶
func (g *GameState) StartBattle()
func (*GameState) StrongestWarshipPlayed ¶
type Phase ¶
type Phase uint
Phase is a discrete state of the game, such as "waiting for players" or "waiting for player 2"
type Player ¶
type Player struct { Name string // cards still in this player's hand Hand CardList // cards that this player has played Played CardList // whether this player has passed this battle or not IsPassing bool // how many battles this player has won Victories int }
Player is the state of a single player within the game
func (*Player) PlayCardAt ¶
PlayCardAt moves the card at the specified index in this player's hand into the Played slice