aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_state.go
blob: 9ee4d27944d80a77d2de657a962f3af867dae7fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package game

import (
	"thehouseoficarus/internal/behavior"
	"thehouseoficarus/internal/player"
)

func (g *Game) playerActionDisplay(p *player.Player) string {
	if cs := g.Combat.Get(p.Name); cs != nil {
		mob := g.MobStore.GetInstance(cs.MobID)
		if mob != nil {
			if mob.IsTask() {
				return "working on a " + mob.Name
			}
			return "fighting a " + mob.Name
		}
	}

	if p.MoveTicks > 0 {
		return "heading " + p.MoveDirection
	}
	if p.EscapeDir != "" {
		return "preparing to flee"
	}
	if len(p.WalkSequence) > 0 {
		return "walking somewhere with a purpose!"
	}

	if ss, ok := g.safespot.Get(p.Name); ok && ss.Active {
		obj, err := g.ObjectStore.Load(ss.ObjectDefID)
		if err == nil {
			return "positioning behind a " + obj.Name
		}
		return "hiding"
	}

	if a := p.Action; a != nil {
		switch a.Type {
		case behavior.TypeGather:
			if d, ok := a.Data.(*behavior.GatherData); ok {
				desc := d.Verb + " a " + a.TargetName
				if d.ToolName != "" {
					desc += " with a " + d.ToolName
				}
				return desc
			}
		case behavior.TypeSteal:
			return "stealing from " + a.TargetName
		case behavior.TypeTalk:
			return "talking to " + a.TargetName
		case behavior.TypeBurn:
			return "trying to start a fire"
		case behavior.TypeStoke:
			return "tending to a fire"
		case behavior.TypeIdentify:
			return "identifying scrap at " + a.TargetName
		case behavior.TypePlant:
			return "planting " + a.TargetName
		case behavior.TypeHarvest:
			return "harvesting " + a.TargetName
		case behavior.TypeRake:
			return "raking a " + a.TargetName
		case behavior.TypeWater:
			return "watering a " + a.TargetName
		case behavior.TypeCure:
			return "curing a " + a.TargetName
		case behavior.TypeObstacle:
			return "traversing across " + a.TargetName
		case behavior.TypeCook:
			return "cooking some " + a.TargetName
		case behavior.TypeSmelt:
			return "smelting some " + a.TargetName
		case behavior.TypeSmith:
			return "smithing some " + a.TargetName
		case behavior.TypeCraft:
			return "crafting some " + a.TargetName
		case behavior.TypeCombine:
			return "combining some " + a.TargetName
		case behavior.TypeMix:
			return "mixing some " + a.TargetName
		case behavior.TypeConstruct:
			return "constructing some " + a.TargetName
		case behavior.TypeTriggerModule:
			return "triggering " + a.TargetName
		}
	}

	if a := p.BackgroundAction; a != nil {
		switch a.Type {
		case behavior.TypeFletch:
			return "fletching " + a.TargetName
		case behavior.TypeClean:
			return "cleaning herbs"
		}
	}

	return ""
}