rest: Added healded for display
authorLukas Krickl <lukas@krickl.dev>
Fri, 5 Sep 2025 04:23:38 +0000 (06:23 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 5 Sep 2025 04:23:38 +0000 (06:23 +0200)
src/action.s
src/action_menu.s
src/stats.s
src/strings.s

index 02fbf45765a3d3b29d5b9ed75783de6fe609f4e9..43ee5afb14c91b67c650d2df112dd0087bc46ee6 100644 (file)
@@ -272,8 +272,13 @@ unit_action_attack_damage_calc:
 unit_action_rest:
        ld a, 1
        call stat_heal_by
+       push af
        call ui_redraw_player
        call ui_request_redraw
+
+       ld hl, STR_HEALDED_FOR
+       pop af
+       call ui_draw_status_stat
        ldnull bc
        ret
 
index 494ca111f1aff3243f59790814b31ab95635ab13..f4dc62ab4bc7f56ae22d8694bb30db4d749ad640 100644 (file)
@@ -8,17 +8,23 @@ str_am_eat:
 
 str_am_rest:
 .str "rest"
+.db 0
+
+str_am_pick_up:
+.str "pick up"
 .db 0
 
        ; label
 action_menu_str_table:
        dw str_am_attack
+       dw str_am_pick_up
        dw str_am_eat
        dw str_am_rest
 action_menu_str_table_end:
        
        ; map to actions
 action_menu_action_table:
+       dw st_action_attack_init
        dw st_action_attack_init
        dw st_action_attack_init
        dw st_action_rest
index 7119d3cd293486cc0184cbaf0f3772f2cd9b43b7..fbf89d20c018f8c1db001cd572f20b39e5da3bf0 100644 (file)
@@ -159,7 +159,10 @@ stat_calc_physical_damage_vs:
        ; inputs:
        ;               de: actor
        ;                a: amount
+       ; returns:
+       ;               a: actual heal amount
 stat_heal_by:
+       push af ; push original a value
        ld b, a ; b = amount to heal by
        ld hl, act_hp
        add hl, de
@@ -177,11 +180,14 @@ stat_heal_by:
        ; a > b? (max > new value)
        jr nc, @overheal REL
        ld [hl], a ; write new value
+       pop af ; return input value
        ret
 @overheal:
        ; set to max
        ld a, b
        ld [hl], a ; write max into hp
+       pop af
+       xor a, a ; no healing was done
        ret
 
   ; calculates the real speed state
index 0b4bc2c6d3415ac6dfbf405521ac5727bb12898b..453ecae814ce5c8e14dfb410fbb453eabee36c20 100644 (file)
@@ -75,6 +75,10 @@ STR_MISS:
 .str "miss"
 .db 0
 
+STR_HEALDED_FOR:
+.str "healed for "
+.db 0
+
 STR_SLASH:
 .str "/"
 .db 0