From 3b4e0d044d963727e38b825b2ef94c2e32c06b03 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 1 Jun 2025 08:16:21 +0200 Subject: [PATCH] rand: Added helper for d16 rolls --- TODO.md | 10 +++++++++- src/rand.s | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 007e157..eaf016d 100644 --- a/TODO.md +++ b/TODO.md @@ -71,4 +71,12 @@ [ ] 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 diff --git a/src/rand.s b/src/rand.s index fc6007b..6cbd3d9 100644 --- a/src/rand.s +++ b/src/rand.s @@ -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 -- 2.30.2