From 1a3978e18d947fa128fd50db4cf700027311c12d Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 26 Aug 2025 05:48:35 +0200 Subject: [PATCH] unit_cpu: Added stub for attack state --- src/unit_cpu.s | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/unit_cpu.s b/src/unit_cpu.s index e6c2af4..8128f85 100644 --- a/src/unit_cpu.s +++ b/src/unit_cpu.s @@ -35,8 +35,10 @@ unit_handle_cpu_inputs: ; check if dead ; if so set type to 0 call unit_cpu_check_dead + ldnull bc ret z + ; check if player has taken turn ; if not exit ldnull bc @@ -44,6 +46,12 @@ unit_handle_cpu_inputs: and a, GPF_PLAYER_TURN_TAKEN ret z + ; attempt an attack + ; and jump to move made if attack was performed + call unit_cpu_attack_player + cp a, 0 + jp nz, @move_made + ; clear move made buffer xor a, a ld [MOVE_MADE], a @@ -127,6 +135,18 @@ unit_handle_cpu_inputs: #undefine MOVE_MADE + ; performs an attack + ; in the direction of the player + ; checks if player is on tile next to current unit + ; inputs: + ; de: actors + ; returns: + ; a: 1 attack performed + ; a: 0 no attack +unit_cpu_attack_player: + ld a, 0 ; no attack + ret + ; moves actor into a random direction ; inputs: ; de: actor -- 2.30.2