; player
dw act_r_nop
; bat
- dw act_die_bat
+ dw act_die_clear_tact
; actor die table
; inputs:
ld l, a
jp hl
- ; bat dealloc
+ ; actor dealloc
+ ; sets type to 0
+ ; and clears tact
; inputs:
; de: bat
-act_die_bat:
+act_die_clear_tact:
xor a, a
ld [de], a ; set type == 0
; depends on the weapon equipped,
; the current facing direction
; and the actor's stats
+ ; if dst_act is NULl this returns without effect
+ ; does not play animations or update text
; inputs:
- ; de: actor attacking
-act_attack:
+ ; combat_src_act: ptr to source actor
+ ; combat_dst_act: the target actor
+act_combat:
ret
; loads attribute table of an actor
; attr struct pointer
.de item_attr, 2
.de item_size, 0
+
+ ; combat struct
+.se 0
+ ; ptr sto source and dst actor
+ ; if dst is NULL the attack fails
+.de combat_src_act, 2
+.de combat_dst_act, 2
+ ; combat results
+
+ ; the damage done
+.de combat_res_damage, 1
+ ; the attack type (e.g. critical, dodge, miss)
+ ; if all flags are 0 == normal hit
+.de combat_res_flags, 1
+.de combat_size, 0
player_attack:
ld de, player
ld a, player HI
- ld [combat_src_act], a
+ ld [combat+combat_src_act], a
ld a, player LO
- ld [combat_src_act+1], a
+ ld [combat+combat_src_act+1], a
; TODO: implement correctly
; for now just remove an actor if
add hl, de
ld a, [hl+]
- ld [combat_dst_act], a
+ ld [combat+combat_dst_act], a
ld a, [hl]
- ld [combat_dst_act+1], a
+ ld [combat+combat_dst_act+1], a
; for now just die if actor != NULL
- ld a, [combat_dst_act]
+ ld a, [combat+combat_dst_act]
ld d, a
- ld a, [combat_dst_act+1]
+ ld a, [combat+combat_dst_act+1]
ld e, a
or a, d
ret z
tile_far: .adv 2
tile_furthest: .adv 2
- ; ptrs to source and dst actor
- ; if dst is NULL the attack fails
-combat_src_act: .adv 2
-combat_dst_act: .adv 2
+ ; combat data
+combat: .adv combat_size