diff options
| author | historia <[not public]> | 2026-06-25 19:37:20 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-25 19:37:20 -0400 |
| commit | c55d0e4150b23f2c5c9f96bbc3d4dc2fc6dbaa36 (patch) | |
| tree | d1c02acea2b4c8d0f672c1539cfdb373b6272ed0 /internal/world/mob.go | |
| parent | 068ce514ea3eebdc42b595c631b4b00ce4594577 (diff) | |
| download | thehouseoficarus-c55d0e4150b23f2c5c9f96bbc3d4dc2fc6dbaa36.tar.gz | |
feat: yaml conversation trees more robust
Diffstat (limited to 'internal/world/mob.go')
| -rw-r--r-- | internal/world/mob.go | 10 |
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, |
