feat: replace all hardcoded constants with config values
Replace hardcoded game constants with values from the config system: - GameSession now receives *config.Config from Lobby - TurnTimeout, MaxFloors, SkillUses, InventoryLimit use config values - combat.AttemptFlee accepts fleeChance param - combat.ResolveAttacks accepts coopBonus param - entity.NewMonster accepts scaling param - Solo HP/DEF reduction uses config SoloHPReduction - Lobby JoinRoom uses config MaxPlayers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,10 @@ func NewLobby(cfg *config.Config) *Lobby {
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Lobby) Cfg() *config.Config {
|
||||
return l.cfg
|
||||
}
|
||||
|
||||
func (l *Lobby) RegisterSession(fingerprint, roomCode string) {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
@@ -144,7 +148,7 @@ func (l *Lobby) JoinRoom(code, playerName, fingerprint string) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("room %s not found", code)
|
||||
}
|
||||
if len(room.Players) >= 4 {
|
||||
if len(room.Players) >= l.cfg.Game.MaxPlayers {
|
||||
return fmt.Errorf("room %s is full", code)
|
||||
}
|
||||
if room.Status != RoomWaiting {
|
||||
|
||||
Reference in New Issue
Block a user