From: Lukas Krickl Date: Sun, 1 Jun 2025 06:16:21 +0000 (+0200) Subject: rand: Added helper for d16 rolls X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=3b4e0d044d963727e38b825b2ef94c2e32c06b03;p=gbrg%2F.git rand: Added helper for d16 rolls --- 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