aboutsummaryrefslogtreecommitdiff
path: root/internal/game/tick.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-25 15:40:48 -0400
committerhistoria <[not public]>2026-06-25 15:40:48 -0400
commitabd612c15799f604e671e83dc7c410ed2b44185f (patch)
tree0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/game/tick.go
parent2725e2927a1595c7b100d942d1f14146252adeb7 (diff)
downloadthehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz
slop refactor
Diffstat (limited to 'internal/game/tick.go')
-rw-r--r--internal/game/tick.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/internal/game/tick.go b/internal/game/tick.go
index 6d79964..ee9ecf2 100644
--- a/internal/game/tick.go
+++ b/internal/game/tick.go
@@ -4,8 +4,7 @@ import (
"fmt"
"math/rand"
- "thehouseoficarus/internal/action"
- "thehouseoficarus/internal/combat"
+ "thehouseoficarus/internal/behavior"
"thehouseoficarus/internal/player"
"thehouseoficarus/internal/world"
)
@@ -23,7 +22,7 @@ func (g *Game) DisconnectTick() {
g.Hub.Remove(sess)
continue
}
- if combat.GetCombat(p.Name) != nil {
+ if g.Combat.Get(p.Name) != nil {
continue
}
sess.DisconnectTicks--
@@ -91,7 +90,7 @@ func (g *Game) WanderTick() {
if inst.HP <= 0 || inst.WanderInterval <= 0 {
continue
}
- if combat.IsMobInCombat(inst.InstanceID) {
+ if g.Combat.IsMobInCombat(inst.InstanceID) {
continue
}
inst.WanderTickCounter++
@@ -140,23 +139,23 @@ func (g *Game) WanderTick() {
if p == nil {
continue
}
- if p.RoomID == m.fromRoom && p.OptionBool("mob_leave") {
- if m.level > 0 {
- levelStr := g.levelColorize(sess, p.CombatLevel(), m.level, fmt.Sprintf("(level %d)", m.level))
- sess.WriteLine(fmt.Sprintf("\n%s %s leaves.", g.colorize(sess, "mob", m.name), levelStr))
- } else {
- sess.WriteLine(fmt.Sprintf("\n%s moves away.", g.colorize(sess, "mob", m.name)))
+ if p.RoomID == m.fromRoom && p.OptionBool("mob_leave") {
+ if m.level > 0 {
+ levelStr := g.levelColorize(sess, p.CombatLevel(), m.level, fmt.Sprintf("(level %d)", m.level))
+ sess.WriteLine(fmt.Sprintf("\n%s %s leaves.", g.colorize(sess, "mob", m.name), levelStr))
+ } else {
+ sess.WriteLine(fmt.Sprintf("\n%s moves away.", g.colorize(sess, "mob", m.name)))
+ }
}
- }
- if p.RoomID == m.toRoom && p.OptionBool("mob_enter") {
- if m.level > 0 {
- levelStr := g.levelColorize(sess, p.CombatLevel(), m.level, fmt.Sprintf("(level %d)", m.level))
- sess.WriteLine(fmt.Sprintf("\n%s %s enters.", g.colorize(sess, "mob", m.name), levelStr))
- } else {
- sess.WriteLine(fmt.Sprintf("\n%s drifts in.", g.colorize(sess, "mob", m.name)))
+ if p.RoomID == m.toRoom && p.OptionBool("mob_enter") {
+ if m.level > 0 {
+ levelStr := g.levelColorize(sess, p.CombatLevel(), m.level, fmt.Sprintf("(level %d)", m.level))
+ sess.WriteLine(fmt.Sprintf("\n%s %s enters.", g.colorize(sess, "mob", m.name), levelStr))
+ } else {
+ sess.WriteLine(fmt.Sprintf("\n%s drifts in.", g.colorize(sess, "mob", m.name)))
+ }
}
}
- }
}
}
@@ -167,7 +166,7 @@ func (g *Game) SharedDepletionTick() {
if p == nil || p.Action == nil || p.Action.Type != "gather" {
continue
}
- if gd, ok := p.Action.Data.(*action.GatherData); ok {
+ if gd, ok := p.Action.Data.(*behavior.GatherData); ok {
activeKeys[gd.InstanceKey] = true
}
}
@@ -331,7 +330,7 @@ func (g *Game) MoveTick() {
}
p.MoveTicks--
if p.MoveTicks > 0 {
- if combat.GetCombat(p.Name) != nil && p.OptionBool("run_countdown") {
+ if g.Combat.Get(p.Name) != nil && p.OptionBool("run_countdown") {
if p.MoveTicks > 1 {
sess.WriteLine(fmt.Sprintf("Running in %d ticks...", p.MoveTicks))
} else {