This does not work well yet. Only one unit should be able to attack.
The attack direction is broken.
ld hl, STR_MISS
ld de, UI_STATUS_LINE
call puts
+ call ui_redraw_hp
call ui_request_redraw
ldnull bc
ret
; and jump to move made if attack was performed
call unit_cpu_attack_player
cp a, 0
- jp nz, @move_made
+ jp nz, @attack_started
; clear move made buffer
xor a, a
@move_made:
ld bc, st_unit_delay_to_active
ret
+@attack_started:
+ ld bc, st_action_attack_direction_picked
+ ret
#undefine MOVE_MADE
ld hl, player_unit+act_pos_y
ld a, [hl] ; a = player y
+
+ ; hl = rt action dat 1
+ ld hl, act_rt_action_dat1
+ add hl, de
; check y distance
call distance
ret
@attack_up:
+ ; write direction values
+ ld a, DIRUP
+ ld [hl], a
ld a, 1 ; attack
ret
@attack_down:
+ ld a, DIRDOWN
+ ld [hl], a
ld a, 1 ; attack
ret
@attack_left:
+ ld a, DIRLEFT
+ ld [hl], a
ld a, 1 ; attack
ret
@attack_right:
+ ld a, DIRRIGHT
+ ld [hl], a
ld a, 1 ; attack
ret