diff options
| author | historia <[not public]> | 2026-06-25 15:40:48 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-25 15:40:48 -0400 |
| commit | abd612c15799f604e671e83dc7c410ed2b44185f (patch) | |
| tree | 0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/game/action_default_target.go | |
| parent | 2725e2927a1595c7b100d942d1f14146252adeb7 (diff) | |
| download | thehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz | |
slop refactor
Diffstat (limited to 'internal/game/action_default_target.go')
| -rw-r--r-- | internal/game/action_default_target.go | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/internal/game/action_default_target.go b/internal/game/action_default_target.go deleted file mode 100644 index a184f32..0000000 --- a/internal/game/action_default_target.go +++ /dev/null @@ -1,61 +0,0 @@ -package game - -import ( - "strings" -) - -func verbToSkill(verb string) string { - return verbSkill[verb] -} - -func (g *Game) defaultTarget(roomID int, verb string) string { - skill := verbToSkill(verb) - if skill == "" { - return "" - } - - objStates := g.World.AllObjInstances(roomID) - - type candidate struct { - defID string - name string - } - var candidates []candidate - seen := make(map[string]bool) - - for _, st := range objStates { - if seen[st.DefID] { - continue - } - seen[st.DefID] = true - - objDef, err := g.ObjectStore.Load(st.DefID) - if err != nil || !objDef.IsGatherable() { - continue - } - - if strings.EqualFold(objDef.Gather.Skill, skill) { - candidates = append(candidates, candidate{defID: st.DefID, name: objDef.Name}) - } - } - - if len(candidates) == 1 { - return candidates[0].name - } - return "" -} - -func (g *Game) resolveDefaultMob(roomID int) string { - mobs := g.MobStore.MobsInRoom(roomID) - if len(mobs) == 0 { - return "" - } - - firstDef := mobs[0].DefID - for _, m := range mobs[1:] { - if m.DefID != firstDef { - return "" - } - } - return mobs[0].Name -} |
