stats: added stubs for calculating some stats
authorLukas Krickl <lukas@krickl.dev>
Thu, 21 Aug 2025 19:11:17 +0000 (21:11 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 21 Aug 2025 19:11:17 +0000 (21:11 +0200)
src/stats.s

index 6c794ea5dcb9bcdccb8cb41052283b09b8b0ce1a..acc6263b7b640c6bdc7fbcf487936d9cb5b696c0 100644 (file)
   ; 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: