Hold the battle result until the replay ends, then show it last.
This commit is contained in:
@@ -724,10 +724,14 @@ func (g *Game) resolveBattle() {
|
||||
|
||||
g.Battle = res
|
||||
g.Phase = PhaseBattle
|
||||
// Tagged "result" so the client can hold it back until the replay finishes
|
||||
// (the outcome is known now, but showing it early would spoil the battle).
|
||||
if winner < 0 {
|
||||
g.logf(-1, "⚔️", "Round %d battle ends in a draw.", g.Round)
|
||||
g.addLog(LogEntry{Seat: -1, Icon: "⚔️", Kind: "result",
|
||||
Text: fmt.Sprintf("Round %d battle ends in a draw.", g.Round)})
|
||||
} else {
|
||||
g.logf(winner, "⚔️", "%s wins the round %d battle (+%d🏆).", pname(winner), g.Round, res.Trophies)
|
||||
g.addLog(LogEntry{Seat: winner, Icon: "⚔️", Kind: "result",
|
||||
Text: fmt.Sprintf("%s wins the round %d battle (+%d🏆).", pname(winner), g.Round, res.Trophies)})
|
||||
}
|
||||
for _, p := range g.Players {
|
||||
p.Ready = false
|
||||
|
||||
@@ -14,6 +14,7 @@ type LogEntry struct {
|
||||
Phase Phase `json:"phase"`
|
||||
Seat int `json:"seat"` // acting seat, or -1 when none
|
||||
Icon string `json:"icon,omitempty"` // leading emoji
|
||||
Kind string `json:"kind,omitempty"` // e.g. "result" (battle outcome)
|
||||
Text string `json:"text"` // the sentence itself
|
||||
Source string `json:"source,omitempty"` // card id that caused a spawn
|
||||
Spawn string `json:"spawn,omitempty"` // "apple" | "bee" for spawn entries
|
||||
|
||||
Reference in New Issue
Block a user