package game import ( "fmt" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" "thehouseoficarus/internal/world" ) // taskWorkVerb returns the flavor verb for working on a task worksite. Designers // set `verb:` on the mob (e.g. "survey", "prospect", "build"); the default is // "work on". The player-facing command is always `work` (or `attack`). func taskWorkVerb(mob *world.MobInstance) string { if mob != nil && mob.Verb != "" { return mob.Verb } return "work on" } // progressBar renders a bar that fills as progress rises toward max — the // inverse of hpBar. It is used for task worksites whose internal HP drains to 0 // to complete the work (progress = MaxHP - HP). func (g *Game) progressBar(sess *net.Session, progress, max int) string { return g.renderBarGeneric(sess, progress, max, "task_bar") } // writeTaskProgress prints the per-tick progress line for a task worksite, // mirroring the combat hit line but framed as labor instead of damage. func (g *Game) writeTaskProgress(sess *net.Session, p *player.Player, mob *world.MobInstance, dmg int, gains []xpGain) { progress := mob.MaxHP - mob.HP if progress < 0 { progress = 0 } pct := 0 if mob.MaxHP > 0 { pct = progress * 100 / mob.MaxHP } noun := mob.ProgressNoun if noun == "" { noun = "work" } prefix := fmt.Sprintf("You advance the %s on %s.", noun, g.colorize(sess, "mob", mobDisplayName(mob, true))) line := fmt.Sprintf("%s %s %3d%%", prefix, g.progressBar(sess, progress, mob.MaxHP), pct) line += g.formatXpDrop(sess, p, gains) sess.WriteLine(line) }