From 69d8757ad983697cdc9182fdcc1cdb612a77fb41 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 10 Jun 2026 04:44:31 -0400 Subject: feat: yaml architecture for complex object interaction --- internal/game/cmd_misc.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'internal/game/cmd_misc.go') diff --git a/internal/game/cmd_misc.go b/internal/game/cmd_misc.go index f56a0ff..c02bd35 100644 --- a/internal/game/cmd_misc.go +++ b/internal/game/cmd_misc.go @@ -105,13 +105,21 @@ func (g *Game) doStyle(sess *net.Session, input string) { } input = strings.ToLower(input) + var matches []string for _, s := range styles { - if s == input { - p.AttackStyle = player.AttackStyle(s) - g.AccountStore.SaveCharacter(p) - sess.WriteLine(fmt.Sprintf("\nCombat style set to %s.", s)) - return + if strings.HasPrefix(s, input) { + matches = append(matches, s) } } + if len(matches) == 1 { + p.AttackStyle = player.AttackStyle(matches[0]) + g.AccountStore.SaveCharacter(p) + sess.WriteLine(fmt.Sprintf("\nCombat style set to %s.", matches[0])) + return + } + if len(matches) > 1 { + sess.WriteLine(fmt.Sprintf("\nAmbiguous style: %s. Choices: %s", input, strings.Join(matches, ", "))) + return + } sess.WriteLine(fmt.Sprintf("\nUnknown style: %s. Choices: accurate, aggressive, defensive, balanced", input)) } -- cgit v1.2.3