Skip to content

Commit

Permalink
Add logic to clarify if quiero is forced.
Browse files Browse the repository at this point in the history
  • Loading branch information
marianogappa committed Aug 7, 2024
1 parent 60807fc commit 0fe4326
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion truco/action_any_quiero.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ type ActionSayEnvidoNoQuiero struct {
}
type ActionSayEnvidoQuiero struct {
act
Cost int `json:"cost"`
Cost int `json:"cost"`
Forced bool `json:"forced"`
}
type ActionSayTrucoQuiero struct {
act
Cost int `json:"cost"`
// RequiresReminder is true if a player ran say_truco and the other player
// initiated an envido sequence. This action might seem out of context.
RequiresReminder bool `json:"requires_reminder"`
Forced bool `json:"forced"`
}
type ActionSayTrucoNoQuiero struct {
act
Expand Down Expand Up @@ -156,6 +158,7 @@ func (a *ActionSayTrucoQuiero) Enrich(g GameState) {
quieroSeq, _ := g.TrucoSequence.WithStep(SAY_TRUCO_QUIERO)
quieroCost := quieroSeq.Cost()
a.Cost = quieroCost
a.Forced = g.Players[g.OpponentOf(a.PlayerID)].Score == g.RuleMaxPoints-1
}

func (a *ActionSayTrucoNoQuiero) Enrich(g GameState) {
Expand All @@ -182,6 +185,7 @@ func (a *ActionSayEnvidoQuiero) Enrich(g GameState) {
panic(err2)
}
a.Cost = quieroCost
a.Forced = g.Players[g.OpponentOf(a.PlayerID)].Score == g.RuleMaxPoints-1
}

func (a *ActionSayEnvidoNoQuiero) Enrich(g GameState) {
Expand Down

0 comments on commit 0fe4326

Please sign in to comment.