feat: game session, turn system, lobby, and room events

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 23:55:08 +09:00
parent 8849bf5220
commit 13d468943a
6 changed files with 705 additions and 0 deletions

29
game/session_test.go Normal file
View File

@@ -0,0 +1,29 @@
package game
import (
"testing"
"time"
"github.com/tolelom/catacombs/entity"
)
func TestSessionTurnTimeout(t *testing.T) {
s := NewGameSession()
p := entity.NewPlayer("test", entity.ClassWarrior)
s.AddPlayer(p)
s.StartFloor()
// Don't submit any action, wait for timeout
done := make(chan struct{})
go func() {
s.RunTurn()
close(done)
}()
select {
case <-done:
// Turn completed via timeout
case <-time.After(7 * time.Second):
t.Error("Turn did not timeout within 7 seconds")
}
}