actor: Added default hp setter in tact init
authorLukas Krickl <lukas@krickl.dev>
Fri, 30 Jan 2026 06:57:11 +0000 (07:57 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 30 Jan 2026 06:57:11 +0000 (07:57 +0100)
src/action.s
src/actor.s

index eb113b5371503540b913de134d7dccd2841157fa..9474f7cef794c1efe295ab356478e8fe67dc387a 100644 (file)
@@ -36,12 +36,15 @@ action_attack:
        ld h, c
        or a, h
        ret z ; no actor here...
-       
+
+       push hl
        ; hl = actor
+       call act_attr_get_attack_damage
+       ; a = attack damage (source)
+       ld b, a ; b = damage
 
        ; TODO: for now just kill the actor
        ; later we need actual damage calculations
-       push hl
        pop de
        call act_die
 
index 447966830cb4276fa860f574b48b04ee52e5866f..f347edffebeb2d98ec194d77807d884014381a4c 100644 (file)
@@ -261,6 +261,19 @@ act_draw:
        ; inputs:
        ;               de: actor ptr
 act_init_set_tact:
+       push de
+       call act_attr_get_max_hp
+       ; bc = max hp
+       pop de
+       ld hl, act_hp
+       add hl, de
+       ; set default hp
+       ld a, b
+       ld [hl+], a
+       ld a, c
+       ld [hl], a
+       
+
        call act_set_tact
        ret