diff options
| author | historia <[not public]> | 2026-06-19 03:05:46 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-19 03:05:46 -0400 |
| commit | fbd1c30d7b9777c9df6653f0c393afa7a7dfa519 (patch) | |
| tree | 7d4dd5b1fb1a5f868a330caf009ac8dc4e583025 /internal/game/cmd_autocast.go | |
| parent | dea4a06764c507699cf9adcd1fd0a572d227aff0 (diff) | |
| download | thehouseoficarus-fbd1c30d7b9777c9df6653f0c393afa7a7dfa519.tar.gz | |
feat: science skill roughly implemented
Diffstat (limited to 'internal/game/cmd_autocast.go')
| -rw-r--r-- | internal/game/cmd_autocast.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/internal/game/cmd_autocast.go b/internal/game/cmd_autocast.go new file mode 100644 index 0000000..205fd8d --- /dev/null +++ b/internal/game/cmd_autocast.go @@ -0,0 +1,54 @@ +package game + +import ( + "fmt" + "strings" + + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) doAutocast(sess *net.Session, input string) { + p := sess.Player.(*player.Player) + input = strings.TrimSpace(input) + + if input == "" { + if p.AutocastMod == "" { + sess.WriteLine("No autocast mod set. Use 'autocast <mod>' to set one.") + } else { + mod := GetMod(p.AutocastMod) + if mod == nil { + sess.WriteLine("Autocast: none (invalid mod)") + p.AutocastMod = "" + } else { + sess.WriteLine(fmt.Sprintf("Autocast: %s (Lv%d)", mod.Name, mod.Level)) + } + } + return + } + + if strings.ToLower(input) == "off" { + p.AutocastMod = "" + sess.WriteLine("Autocast disabled.") + return + } + + mod := FindMod(strings.ToLower(input)) + if mod == nil { + sess.WriteLine("Unknown mod.") + return + } + + if mod.Category != ModCombat { + sess.WriteLine("You can only autocast combat mods.") + return + } + + if p.Level(player.Science) < mod.Level { + sess.WriteLine(fmt.Sprintf("You need level %d science to autocast %s.", mod.Level, mod.Name)) + return + } + + p.AutocastMod = mod.ID + sess.WriteLine(fmt.Sprintf("Autocast set to: %s", mod.Name)) +} |
