attr_bat:
attrdef 1, 0, 0, 1, 0, 0
+
+ ; gets strength attribute
+ ; of a given actor
+ ; inputs:
+ ; de: actor
+ ; returns:
+ ; a: attribute value + item bounus + buffs - debuffs
+attr_get_str:
+ ret
+
+ ; calculates the attack damage
+ ; of a given actor
+ ; inputs:
+ ; de: actor
+ ; returns:
+ ; a: damage value
+attr_attack_damage:
+ ld hl, act_weapon
+ add hl, de
+ ld a, [hl] ; load weapon type
+ cp a, 0 ; if 0 -> unarmed
+ jp z, @unarmed
+ ret
+
+@unarmed:
+ ; unarmed is just strength / 2
+ call attr_get_str
+ sla a ; divide by 2
+ cp a, 0 ; damage should at least be 1!
+ ret nz
+ ld a, 1 ; ensure it is at least 1!
+ ret