Documentation ¶
Index ¶
- Constants
- func AddEffect(c *Card, e *Effect)
- func RemoveEffect(source uuid.UUID, c *Card)
- type Board
- func (b *Board) Attack(id, atk, def int) int
- func (b *Board) CanAttack(id, atk, def int) bool
- func (b *Board) CanMove(id, src, dest int) bool
- func (b *Board) CanPlay(id int, c *Card, dest int) bool
- func (b *Board) Empty(id int) bool
- func (b *Board) GetCard(id int, pos int) *Card
- func (b *Board) GetRow(id int) []*Card
- func (b *Board) Move(id, src, dest int) bool
- func (b *Board) Play(id int, c *Card, dest int, should bool) bool
- func (b *Board) Remove(c *Card)
- func (b *Board) ResetCards()
- func (b *Board) String() string
- type Card
- type CardType
- type CmdType
- type Command
- type CommandResult
- type Deck
- type Effect
- type GameStatus
- type GameView
- type Player
- type SessionCmd
- type SessionCommand
- type SessionCommandResult
- type SessionResp
Constants ¶
View Source
const ( ActCmd = "a" StateCmd = "s" DebugCmd = "d" InvalidCmd = "e" )
View Source
const ( SessionCmdQuery SessionCmd = "query" SessionCmdJoin = "join" SessionCmdLeave = "leave" SessionCmdPlay = "play" SessionCmdPoll = "poll" SessionCmdReady = "ready" )
View Source
const ( SessionRespFound SessionResp = "found" SessionRespJoined1 = "joined p1" SessionRespJoined2 = "joined p2" SessionRespReady = "game ready" SessionRespJoinError = "join error" SessionRespLeft = "left" SessionRespPlayed = "played" SessionRespError = "generic error" SessionRespBroadcastSenTurn = "Sentinal turn" SessionRespBroadcastScoTrun = "Scourge turn" SessionRespBroadcastSenWin = "Sentinal wins" SessionRespBroadcastScoWin = "Scourge wins" SessionRespBroadcastUpdate = "update" SessionRespBroadcastSenJoin = "Sentinal joined" SessionRespBroadcastScoJoin = "Scourge joined" SessionRespBroadcastSenReady = "Sentinal player is ready" SessionRespBroadcastScoReady = "Scourge player is ready" SessionRespBroadcastSenLeft = "Sentinal player has left" SessionRespBroadcastScoLeft = "Scourge player has left" SessionRespBroadcastNone = "" )
View Source
const ( StatusLobby = iota StatusReady StatusPlaying StatusStop StatusSentinalWin StatusScourgeWin StatusDraw )
View Source
const ( SentinalID = 1 ScourgeID = 2 )
Variables ¶
This section is empty.
Functions ¶
func RemoveEffect ¶
Types ¶
type Board ¶
func (*Board) ResetCards ¶
func (b *Board) ResetCards()
type Card ¶
type Card struct { Type CardType `json:"type"` BasePower int `json:"base_power"` Power int `json:"power"` Id uuid.UUID `json:"id"` Sick bool `json:"sick"` Counters int `json:"counters"` Owner int `json:"owner"` Position int `json:"position"` Spell bool `json:"spell"` Effects []*Effect `json:"effects"` }
type Command ¶
type CommandResult ¶
type CommandResult struct { PlayerID int `json:"player_id"` ResultType CmdType `json:"result_type"` StateResult *GameView `json:"state_result,omitempty"` ActionResult *Deck `json:"action_result,omitempty"` DebugResult interface{} `json:"debug_result,omitempty"` }
func (*CommandResult) String ¶
func (c *CommandResult) String() string
type GameStatus ¶
type GameStatus int
type GameView ¶
type GameView struct { Board *Board `json:"board"` Player *Player `json:"player"` DeckSize int `json:"deck_size"` EnemyLife int `json:"enemy_life"` EnemyDeckSize int `json:"enemy_deck_size"` EnemyHandSize int `json:"enemy_hand_size"` CurrentTurn int `json:"current_turn"` CanDraw bool `json:"can_draw"` HasDrawn bool `json:"has_drawn"` Status GameStatus `json:"game_status"` }
type SessionCmd ¶
type SessionCmd string
type SessionCommand ¶
type SessionCommand struct { ID uuid.UUID `json:"player_id"` MatchID uuid.UUID `json:"match_id"` Command SessionCmd `json:"command"` GameCommand *Command `json:"game_command,omitempty"` }
func (*SessionCommand) String ¶
func (s *SessionCommand) String() string
type SessionCommandResult ¶
type SessionCommandResult struct { ID uuid.UUID `json:"player_id"` MatchID uuid.UUID `json:"match_id"` Result SessionResp `json:"result"` GameResult *CommandResult `json:"game_result,omitempty"` }
func (*SessionCommandResult) String ¶
func (s *SessionCommandResult) String() string
type SessionResp ¶
type SessionResp string
Click to show internal directories.
Click to hide internal directories.