aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_attack.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-19 03:05:46 -0400
committerhistoria <[not public]>2026-06-19 03:05:46 -0400
commitfbd1c30d7b9777c9df6653f0c393afa7a7dfa519 (patch)
tree7d4dd5b1fb1a5f868a330caf009ac8dc4e583025 /internal/game/cmd_attack.go
parentdea4a06764c507699cf9adcd1fd0a572d227aff0 (diff)
downloadthehouseoficarus-fbd1c30d7b9777c9df6653f0c393afa7a7dfa519.tar.gz
feat: science skill roughly implemented
Diffstat (limited to 'internal/game/cmd_attack.go')
-rw-r--r--internal/game/cmd_attack.go61
1 files changed, 45 insertions, 16 deletions
diff --git a/internal/game/cmd_attack.go b/internal/game/cmd_attack.go
index 401837f..29bff30 100644
--- a/internal/game/cmd_attack.go
+++ b/internal/game/cmd_attack.go
@@ -124,24 +124,39 @@ func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobIn
combat.EnterCombat(p.Name, mob.InstanceID)
+ autocastActive := p.AutocastMod != ""
playerSpeed := g.playerWeaponSpeed(p)
-
- attBonus, strBonus, defBonus := combat.AttackStyleBonus(string(p.AttackStyle))
- var styleParts []string
- if attBonus > 0 {
- styleParts = append(styleParts, fmt.Sprintf("+%d atk", attBonus))
- }
- if strBonus > 0 {
- styleParts = append(styleParts, fmt.Sprintf("+%d str", strBonus))
+ if autocastActive {
+ playerSpeed = 5.0
}
- if defBonus > 0 {
- styleParts = append(styleParts, fmt.Sprintf("+%d def", defBonus))
- }
- styleStr := ""
- if len(styleParts) > 0 {
- styleStr = " Style: " + string(p.AttackStyle) + " (" + strings.Join(styleParts, ", ") + ")"
+
+ if !autocastActive {
+ attBonus, strBonus, defBonus := combat.AttackStyleBonus(string(p.AttackStyle))
+ var styleParts []string
+ if attBonus > 0 {
+ styleParts = append(styleParts, fmt.Sprintf("+%d atk", attBonus))
+ }
+ if strBonus > 0 {
+ styleParts = append(styleParts, fmt.Sprintf("+%d str", strBonus))
+ }
+ if defBonus > 0 {
+ styleParts = append(styleParts, fmt.Sprintf("+%d def", defBonus))
+ }
+ styleStr := ""
+ if len(styleParts) > 0 {
+ styleStr = " Style: " + string(p.AttackStyle) + " (" + strings.Join(styleParts, ", ") + ")"
+ }
+ sess.WriteLine(fmt.Sprintf("\nYou attack %s!%s", g.colorize(sess, "mob_name", mobDisplayName(mob, true)), styleStr))
+ } else {
+ mod := GetMod(p.AutocastMod)
+ modName := p.AutocastMod
+ if mod != nil {
+ modName = mod.Name
+ }
+ sess.WriteLine(fmt.Sprintf("\nYou attack %s with %s!",
+ g.colorize(sess, "mob_name", mobDisplayName(mob, true)),
+ g.colorize(sess, "science_mod", modName)))
}
- sess.WriteLine(fmt.Sprintf("\nYou attack %s!%s", g.colorize(sess, "mob_name", mobDisplayName(mob, true)), styleStr))
p.ActionState = &ActionState{Type: ActionCombating, TargetName: mob.Name}
g.Ticks.Subscribe(engine.ToTicks(playerSpeed), func() bool {
@@ -154,7 +169,21 @@ func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobIn
g.endCombat(sess, p, currentMob)
return false
}
- g.playerAttack(sess, p, currentMob)
+ if p.AutocastMod != "" {
+ mod := GetMod(p.AutocastMod)
+ if mod != nil {
+ if !g.scienceAttack(sess, p, currentMob, mod) {
+ p.AutocastMod = ""
+ sess.WriteLine("You've run out of junk. Switching to melee.")
+ g.playerAttack(sess, p, currentMob)
+ }
+ } else {
+ p.AutocastMod = ""
+ g.playerAttack(sess, p, currentMob)
+ }
+ } else {
+ g.playerAttack(sess, p, currentMob)
+ }
if currentMob.HP <= 0 {
g.endCombat(sess, p, currentMob)
return false