aboutsummaryrefslogtreecommitdiff
path: root/internal/world/mob.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-25 19:37:20 -0400
committerhistoria <[not public]>2026-06-25 19:37:20 -0400
commitc55d0e4150b23f2c5c9f96bbc3d4dc2fc6dbaa36 (patch)
treed1c02acea2b4c8d0f672c1539cfdb373b6272ed0 /internal/world/mob.go
parent068ce514ea3eebdc42b595c631b4b00ce4594577 (diff)
downloadthehouseoficarus-c55d0e4150b23f2c5c9f96bbc3d4dc2fc6dbaa36.tar.gz
feat: yaml conversation trees more robust
Diffstat (limited to 'internal/world/mob.go')
-rw-r--r--internal/world/mob.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/world/mob.go b/internal/world/mob.go
index 4c6becb..f11d6fe 100644
--- a/internal/world/mob.go
+++ b/internal/world/mob.go
@@ -78,6 +78,7 @@ type MobInstance struct {
InstanceID string
DefID string
Name string
+ Description string
HP int
MaxHP int
Attack int
@@ -133,12 +134,17 @@ func (m *MobInstance) IsTalkable() bool { return m.TalkConfig != nil }
func (m *MobInstance) IsTask() bool { return m.Kind == "task" }
func NewMobInstance(def *MobDef, instanceID string, roomID int, wanderRooms []int, wanderInterval float64) *MobInstance {
+ hp := def.HP
+ if def.Protected && hp <= 0 {
+ hp = 1
+ }
return &MobInstance{
InstanceID: instanceID,
DefID: def.ID,
Name: def.Name,
- HP: def.HP,
- MaxHP: def.HP,
+ Description: def.Description,
+ HP: hp,
+ MaxHP: hp,
Attack: def.Attack,
Strength: def.Strength,
Defense: def.Defense,