UpdateRandNum steps a 16-bit state as , and battle code reads its high byte, RandNumUB. | III.A, Common algorithms | Code |
GetJoypadStatus steps the generator each time it reads the controller. | IV, Frequently Asked Questions | Code |
| Computed from the generator's update, its 65,536 states form two cycles of 32,768, and over each cycle the high byte takes every value exactly 128 times. | III.A, Common algorithms | Code |
PlyrCalcHitDmg takes , the hero's attack power less half the monster's defense byte; if , damage is for a random byte , so from to . | II.B, Hero attack formulas | Code |
| Before the normal formula, a 1-in-32 roll gives the hero an "excellent move", except against either form of the Dragonlord; it deals for a random byte , from to (more than half to all of the attack power), and ignores defense. | II.B, Hero attack formulas | Code |
| After the damage is set, an awake monster dodges when a roll of 0–63 falls below , the low nibble of its resistance byte, a chance of ; a sleeping monster never dodges, and spells skip the check. | III.C, Combat | Code |
EnCalcHitDmg takes , the monster's attack less half the hero's defense power; if , it uses the hero's normal formula, and otherwise the monster deals , from 0 to about . | III.C, Combat | Code |
TryRun lets the hero escape when Agility × a random byte is at least the monster's defense byte × a roll whose range grows with the monster: 0–63 from Slime to Druinlord, 0–94 from Drollmagi to Werewolf, 0–127 from Green Dragon to Blue Dragon, and 0–255 from Stoneman on. Running from a sleeping monster always works. | II.B, Running | Code |
| On the overworld's zone 0, the slime-only region around Tantegel Castle, a second byte lets only half of those fights through, and a quarter on hills. | II.A, Encounters | Code |
| The dodge nibble of the 40 monsters (each dodges of the hero's attacks, dodge) is 1 or 2 for 27 of them; the Demon Knight's is 15, the Werewolf's 7, the Poltergeist's and Drakeema's 6, six monsters' 4, and the Golem's and both Dragonlord forms' 0. | II.B, Combat, monster list (#28 Demon Knight) | Code |
| The high nibble of the same byte blocks Hurt and Hurtmore of the time (hero-spells); it is 0 for 26 of the 40 monsters and 15 for seven, the Metal Slime, Golem, Demon Knight, Wizard, Red Dragon, and both Dragonlord forms. | II.B, Combat, monster list | Code |
| Each fight picks one of its zone's five monster slots with equal chance; zone 0, around Tantegel Castle, holds three Slime slots and two Red Slime slots, and zone 1 adds a Drakee, all with dodge 1. | II.A, Encounters | Code |