From cef0718cba10404ebe25416761da5455d754f5b3 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 1 Apr 2023 12:02:14 -0700 Subject: [PATCH] Cards can be urgent --- cardsim/card.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cardsim/card.go b/cardsim/card.go index df5cc07..0888aa6 100644 --- a/cardsim/card.go +++ b/cardsim/card.go @@ -9,6 +9,10 @@ type Card[C StatsCollection] interface { // a warning, the game crashes. Title(p *Player[C]) (Message, error) + // Urgent reports whether the card is considered urgent. If + // the player hasa any + Urgent(p *Player[C]) bool + // EventText returns the text to display on the card. If it returns an // error that is not a warning, the game crashes. EventText(p *Player[C]) (Message, error) @@ -43,6 +47,7 @@ type CardOption[C StatsCollection] interface { // A BasicCard is a Card with fixed title, text, options, and optional post-option callback. type BasicCard[C StatsCollection] struct { CardTitle Message + IsUrgent bool CardText Message CardOptions []CardOption[C] AfterOption func(p *Player[C], option CardOption[C]) error @@ -52,6 +57,10 @@ func (b *BasicCard[C]) Title(p *Player[C]) (Message, error) { return b.CardTitle, nil } +func (b *BasicCard[C]) Urgent(_ *Player[C]) bool { + return b.IsUrgent +} + func (b *BasicCard[C]) EventText(p *Player[C]) (Message, error) { return b.CardText, nil }