From abd612c15799f604e671e83dc7c410ed2b44185f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 25 Jun 2026 15:40:48 -0400 Subject: slop refactor --- internal/game/tick.go | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'internal/game/tick.go') 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 { -- cgit v1.2.3