package game import ( "fmt" "strings" "thehouseoficarus/internal/net" ) func (g *Game) executeAttack(sess *net.Session, args []string, rawInput string) { if len(args) == 0 { p := sess.Player target := g.resolveDefaultMob(p.RoomID) if target == "" { sess.WriteLine("Attack what?") return } g.doAttack(sess, target) } else { g.doAttack(sess, strings.Join(args, " ")) } } // executeWork is the non-violent alias of attack. It routes to the same engine; // doAttack auto-detects whether the target is a task worksite or a combat mob. func (g *Game) executeWork(sess *net.Session, args []string, rawInput string) { if len(args) == 0 { p := sess.Player target := g.resolveDefaultMob(p.RoomID) if target == "" { sess.WriteLine("Work on what?") return } g.doAttack(sess, target) } else { g.doAttack(sess, strings.Join(args, " ")) } } func (g *Game) respawnMob(instanceID string) { inst := g.MobStore.GetInstance(instanceID) if inst == nil { return } homeRoom := inst.HomeRoomID inst.RoomID = homeRoom inst.HP = inst.MaxHP g.MobStore.RollIdleDescription(inst) if g.Hub != nil { for _, sess := range g.Hub.PlayersInRoom(homeRoom) { if p := sess.Player; p != nil && p.OptionBool("mob_spawn") { mobLvl := mobCombatLevel(inst) levelStr := g.levelColorize(sess, p.CombatLevel(), mobLvl, fmt.Sprintf("(level %d)", mobLvl)) sess.WriteLine(fmt.Sprintf("\n%s %s spawns in the area.", g.colorize(sess, "mob", mobDisplayName(inst, false)), levelStr)) } } } }