attr: Added getter for actor attr table
authorLukas Krickl <lukas@krickl.dev>
Sat, 20 Dec 2025 22:19:32 +0000 (23:19 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 20 Dec 2025 22:19:32 +0000 (23:19 +0100)
src/actor.s
src/attributes.s

index 291fbe19d9753ecd1c163be5ee5d0cd409978300..bed61a2472f681d534acc755a7aa92c782be82ca 100644 (file)
@@ -687,5 +687,27 @@ act_move_back:
        ; and the actor's stats
        ; inputs:
        ;               de: actor attacking
-actor_attack:
+act_attack:
+       ret
+       
+       ; loads attribute table of an actor 
+       ; inputs:
+       ;               de: actor
+       ;       returns:
+       ;               bc: attribute table
+act_load_attr_table:
+       ld a, [hl] ; load type
+       add a, a
+       ld hl, act_attr_table
+       add a, a
+       ld b, 0
+       ld c, a ; bc = offset into attr table
+       add hl, bc ; hl = attr ptr
+
+       ld a, [hl+]
+       ld c, [hl]
+       ld b, a
+
+       ; bc = attribute
+
        ret
index f21a301bbcc41fbfac2fba441e0ff5ff142a307c..6504f8537b2434ce5151d2ec18cd0764608ce918 100644 (file)
@@ -18,6 +18,11 @@ attrdef 1, 0, 0, 1, 0, 0
        ;       returns:
        ;               a: attribute value + item bounus + buffs - debuffs
 attr_get_str:
+       call act_load_attr_table
+       ; bc = attributes
+       ld hl, attr_str
+       add hl, bc
+       ld a, [hl] ; a = str
        ret
        
        ; calculates the attack damage