From: Lukas Krickl Date: Sat, 20 Dec 2025 22:19:32 +0000 (+0100) Subject: attr: Added getter for actor attr table X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=a2b32fcb35fb6834b0550464e66e4d84f87056f2;p=gbrg%2F.git attr: Added getter for actor attr table --- diff --git a/src/actor.s b/src/actor.s index 291fbe1..bed61a2 100644 --- a/src/actor.s +++ b/src/actor.s @@ -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 diff --git a/src/attributes.s b/src/attributes.s index f21a301..6504f85 100644 --- a/src/attributes.s +++ b/src/attributes.s @@ -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