stats: stamina is now a stat
authorLukas Krickl <lukas@krickl.dev>
Sat, 17 Jan 2026 07:46:32 +0000 (08:46 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 17 Jan 2026 07:46:32 +0000 (08:46 +0100)
Added item proficency as a stat requirement
Removed proficency mask

src/defs.s
src/item.s
src/macros.inc
src/player.s

index 6e3926ab5deb5606a715b77ffa672803e6f293fb..c203e6bf362a1b70e533f0cfcb4e620c9ce35599 100644 (file)
        ; resistances are 2 bit values
        ; see resistance masks
 .de attr_res, 1
-       ; proficiency are 1 bit values
-       ; see proficency masks
-.de attr_prof, 1
 .de attr_size, 0
 
        ; resistance masks
 .def int ATTR_RES_FROST = 0b00001100
 .def int ATTR_RES_LIGHTNING = 0b00000011
 
-       ; proficiency masks
-.def int ATTR_PROF_HEAVY_ARMOR = 0b10000000
-.def int ATTR_PROF_LIGHT_ARMOR = 0b01000000
-.def int ATTR_PROF_SHORT_BLADE = 0b00100000
-.def int ATTR_PROF_LONG_BLADE = 0b00010000
-.def int ATTR_PROF_BOW = 0b00001000
-.def int ATTR_PROF_AXE = 0b00000100
-.def int ATTR_PROF_MACE = 0b00000010
-.def int ATTR_PROF_MAGIC = 0b00000001
-
 .def int ITEM_NONE = 0
 
        ; armor types
 .de ITEM_DT_FROST, 8
 .de ITEM_DT_LIGHTNING, 16
 
+       ; item proficency stat type
+.se 0
+.de ITEM_ATTR_STR, 1
+.de ITEM_ATTR_AGI, 1
+.de ITEM_ATTR_WIS, 1
+.de ITEM_ATTR_STAM, 1
+
        ; item struct
 .se 0
 .de item_type, 1
 .de item_flags, 1
        ; used for weapon damage
 .de item_damage, 1
-       ; proficiency mask needed to use the item
-.de item_prof, 1
+       ; proficiency in attribute mask needed to use the item
+       ; byte 1: stat type
+       ;       byte 2: minimum required
+.de item_prof_stat, 1
+.de item_prof_value, 1
        ; damage type of the item
 .de item_damage_type, 1
        ; bonus attributes provided by the item
index 334894650ec5c758507da1554f706a49eb53ceea..b2fcc7fa102d067d754a6ee110265d58e2be6793 100644 (file)
@@ -8,4 +8,4 @@ items_ring:
        dw null_item
 
 null_item:
-       itemdef 0, 0, 0, 0, 0, 0
+       itemdef 0, 0, 0, ITEM_ATTR_STR, 0, 0
index ef24e399b2645de5140eddddb5b138d34d7c7415..91c22d637a3a47bb64f5dcb8b00590784fa90bdf 100644 (file)
@@ -217,8 +217,8 @@ $1:
        ;               $1: strength
        ;         $2: agility
        ;               $3: wisdom
-       ;               $4: resistances 
-       ;               $5: proficiency
+       ;               $4: stamina
+       ;               $5: resistances 
 #macro attrdef
        .db $1, $2, $3, $4, $5
 #endmacro
@@ -228,9 +228,10 @@ $1:
        ;               $1: type
        ;               $2: flags
        ;               $3: damage
-       ;               $4: prof mask
-       ;               $5: damage type
-       ;               $6: attribute ptr (may be NULL)
+       ;               $5: proficency attribute
+       ;               $6: proficency attribute value
+       ;               $7: damage type
+       ;               $8: attribute ptr (may be NULL)
 #macro itemdef
        .db $1, $2, $3, $4, $5
        dw $6
index ac71ae1662ef5e2cf13caf78dbc2f288da1b1f7d..97eafe450a8c267b3604f7ece9020736f6895036 100644 (file)
@@ -116,8 +116,8 @@ player_handle_move:
                call act_move_to
 
                cp a, 0
-               jp z, player_moved
-               jp player_collided
+               call z, player_moved
+               call player_collided
 @not_left:
 
        ld b, DIRRIGHT
@@ -134,8 +134,8 @@ player_handle_move:
                call act_move_to
                
                cp a, 0
-               jp z, player_moved
-               jp player_collided
+               call z, player_moved
+               call player_collided
 @not_right:
 
        ld b, DIRUP
@@ -152,8 +152,8 @@ player_handle_move:
                call act_move_to
 
                cp a, 0
-               jp z, player_moved
-               jp player_collided
+               call z, player_moved
+               call player_collided
 @not_up:
 
        ld b, DIRDOWN
@@ -170,8 +170,8 @@ player_handle_move:
                call act_move_to
 
                cp a, 0
-               jp z, player_moved
-               jp player_collided
+               call z, player_moved
+               call player_collided
 @not_down:
        ret