rand: Added helper for d16 rolls
authorLukas Krickl <lukas@krickl.dev>
Sun, 1 Jun 2025 06:16:21 +0000 (08:16 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 1 Jun 2025 06:16:21 +0000 (08:16 +0200)
TODO.md
src/rand.s

diff --git a/TODO.md b/TODO.md
index 007e157e31f6387d3cca710163adf5990d3af208..eaf016d6ed57b4063a901b8b91bb6f0913c9a5a5 100644 (file)
--- a/TODO.md
+++ b/TODO.md
 
 [ ] Display active unit stats and hp
 [ ] Display active unit melee and ranged attack
-[ ] When holding select display unit queue until end of turn 
+[ ] When holding select display unit queue until end of turn
+
+## Randomness
+
+[ ] The entire game is based on d16 rolls
+[ ] Weapons do damage based on a roll
+[ ] Some weapons can roll twice and take the best
+[ ] Rome weapons can roll twice and take the worst
+[ ] When being hit a resistance roll based on armor and other stats is done
index fc6007b8202f5135abde16a32a377bff1520e540..6cbd3d95e2bfb79e59cc11fbe4fbac058c1d6476 100644 (file)
@@ -72,4 +72,14 @@ rand:
   ld a, [srand]
 
   ret
+  
+  ; rolls a d16
+  ; returns a number between
+  ; 0 and 15
+  ; returns:
+  ;   a: number of roll
+roll_d16:
+  call rand
+  and a, 0x0F
+  ret