Introduce InfoPanel.
InfoPanels are information displays that do not cost actions. One of them (the Prompt) is shown at the main menu; others can be made available as options in the menu, ether on an ongoing basis or for the current/next turn only.
This commit is contained in:
parent
fb5735d5b9
commit
7f8dcd63d6
13
cardsim/infopanel.go
Normal file
13
cardsim/infopanel.go
Normal file
@ -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)
|
||||
}
|
@ -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]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user