diff --git a/cardsim/infopanel.go b/cardsim/infopanel.go new file mode 100644 index 0000000..fdbed04 --- /dev/null +++ b/cardsim/infopanel.go @@ -0,0 +1,13 @@ +package cardsim + +// An InfoPanel displays some set of stats to the player. It does +// not consume an action. It must not advance the state of the game +// in any way. +type InfoPanel[C StatsCollection] interface { + // Title returns the title of this InfoPanel, which is also used as the + // label presented to the player to access this panel. + Title(p *Player[C]) (Message, error) + + // Info returns the contents of this InfoPanel. + Info(p *Player[C]) ([]Message, error) +} diff --git a/cardsim/player.go b/cardsim/player.go index 169c328..0f2316f 100644 --- a/cardsim/player.go +++ b/cardsim/player.go @@ -4,16 +4,19 @@ import "math/rand" // Player stores all gameplay state for one player. type Player[C StatsCollection] struct { - Stats C - Name string - Deck *Deck[C] - Hand []Card[C] - HandLimit int - ActionsPerTurn int - ActionsRemaining int - PermanentActions []Card[C] - Rules *RuleCollection[C] - Rand rand.Rand - Turn int - PendingMessages []Message + Stats C + Name string + Deck *Deck[C] + Hand []Card[C] + HandLimit int + ActionsPerTurn int + ActionsRemaining int + PermanentActions []Card[C] + InfoPanels []InfoPanel[C] + Prompt InfoPanel[C] + Rules *RuleCollection[C] + Rand rand.Rand + Turn int + TemporaryMessages []Message + TemporaryPanels []InfoPanel[C] }