From c560dc3fc9b97552d71eea55c71bc7adb397082d Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 21 Aug 2025 21:11:17 +0200 Subject: [PATCH] stats: added stubs for calculating some stats --- src/stats.s | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/stats.s b/src/stats.s index 6c794ea..acc6263 100644 --- a/src/stats.s +++ b/src/stats.s @@ -24,7 +24,66 @@ ; returns: ; a: str value stat_calc_str: + ld hl, act_str + add hl, de + ld a, [hl] ret + + ; calculates weapon damage + ; inputs: + ; de actor + ; returns: + ; a: raw weapon damage +stat_calc_weapon_damage: + ; TODO: 1 is fist stat... + ld a, 1 + ret + + ; calculates ac + ; inputs: + ; de: actor + ; returns: + ; a: ac +stat_calc_ac: + ld hl, act_ac + add hl, de + ld a, [hl] + ret + + ; calculates max hp based + ; inputs: + ; deL actor + ; returns: + ; a: max hp +stat_calc_hp_max: + ld hl, act_vit + add hl, de + ld a, [hl] + add a, 2 ; base health + ret + + ; calculates physical damage of + ; one actor agains another + ; inputs: + ; de: actor1 + ; bc: actor2 + ; returns: + ; sub damage from actor2 + ; a: damage +stat_calc_physical_damage_vs: + call stat_calc_weapon_damage + ; a = damage + push bc + pop de ; de = actor2 now + ld b, a ; b = weapon damage + + call stat_calc_ac + + + ret +@no_damage: + xor a, a + ret ; calculates the real speed state ; inputs: -- 2.30.2