+ ; generall attributes are either returned
+ ; in a (8 bit stats) or bc (16 bit stats)
+
attr_null:
attrdef 0, 0, 0, 0, 0
attr_bat:
attrdef 1, 0, 0, 0, 0
+ ; gets the max hp for an actor
+ ; hp formula:
+ ; 4*stam
+ ; inputs:
+ ; de: actor
+ ; returns:
+ ; bc: max hp
+act_attr_get_max_hp:
+ ld a, [de]
+ cp a, ACT_T_PLAYER
+ jp nz, @npc ; not a player
+
+
+
+@npc:
+ call act_attr_get_stam
+ ld hl, 0
+ ld de, 4
+@mul:
+ add hl, de
+ dec a
+ jr nz, @mul REL
+
+ push hl
+ pop bc ; bc = hp max
+
+ ret
+
+ ; get actor stamina
+ ; inputs:
+ ; de: actor
+ ; returns:
+ ; a: stamina
+act_attr_get_stam:
+ ld a, [de]
+ cp a, ACT_T_PLAYER
+ jp nz, @npc ; not a player
+
+@npc:
+ call act_load_attr_table
+ ld hl, attr_stam
+ add hl, bc
+ ld a, [hl] ; a = stamina
+ ret
+
; gets strength attribute
; of a given actor
; inputs:
; set default view
ld a, 3
ld [player_viewradius], a
+
+ ; set current hp
+ ld de, player
+ call act_attr_get_max_hp
+ ld a, b
+ ld [player+act_hp], a
+ ld a, c
+ ld [player+act_hp+1], a
+
ret