diff options
| author | historia <[not public]> | 2026-06-10 04:44:31 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-10 04:44:31 -0400 |
| commit | 69d8757ad983697cdc9182fdcc1cdb612a77fb41 (patch) | |
| tree | 348c26d1f6defe3aef64f5aa9e7cefed0e764214 /internal/game/cmd_misc.go | |
| parent | a226d72e51eecb768b13600303f73483118d9104 (diff) | |
| download | thehouseoficarus-69d8757ad983697cdc9182fdcc1cdb612a77fb41.tar.gz | |
feat: yaml architecture for complex object interaction
Diffstat (limited to 'internal/game/cmd_misc.go')
| -rw-r--r-- | internal/game/cmd_misc.go | 18 |
1 files changed, 13 insertions, 5 deletions
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)) } |
