; returns:
; bc: attribute table
act_load_attr_table:
- ld a, [hl] ; load type
- add a, a
- ld hl, act_attr_table
- add a, a
- ld b, 0
- ld c, a ; bc = offset into attr table
- add hl, bc ; hl = attr ptr
+ ld hl, act_attr
+ add hl, de ; hl = attr table ptr
ld a, [hl+]
ld c, [hl]
ld b, a
- ; bc = attribute
+ ; bc = attribute table
ret
- ; table of actor type -> attribute
-act_attr_table:
- dw attr_null
- dw player_attr
- dw attr_bat
-
attr_null:
attrdef 0, 0, 0, 0, 0, 0
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:
+act_attr_get_str:
call act_load_attr_table
; bc = attributes
ld hl, attr_str
@unarmed:
; unarmed is just strength / 2
- call attr_get_str
+ call act_attr_get_str
sla a ; divide by 2
cp a, 0 ; damage should at least be 1!
ret nz
; l1 actor table
l1_acts:
- actdef ACT_T_BAT, 0, 4, 6, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE
- actdef ACT_T_BAT, 0, 0, 2, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE
+ actdef ACT_T_BAT, 0, 4, 6, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
+ actdef ACT_T_BAT, 0, 0, 2, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
.db 0 ; terminate