The current URL is datacrystal.tcrf.net.
Legacy of the Wizard
Enemy Drops
Drop index | Item |
$00 | Bread |
$01 | Potion |
$02 | Money |
$03 | Poison |
$04 | Key |
$05 | Ring |
$06 | Cross |
$07 | Scroll |
First, before any RNG is rolled whatsoever, three checks are done, in priority order (at $07EF85~$07EF9B):
- If health is less than 20 ($14 hex), guaranteed bread drop ($00 drop index).
- If magic is less than 30 ($1E hex), guaranteed magic potion drop ($01 drop index).
- If key count is less than 2, guaranteed key drop ($04 drop index).
If none of these conditions are met, we then roll a random number from 0 to 19 ($14 hex modulus / exclusive upper bound). Fully detailed results for each value:
RNG roll value | Result |
$00 | Poison |
$01 | Poison |
$02 | Poison |
$03 | Poison |
$04 | Key |
$05 | Key |
$06 | Ring |
$07 | Cross |
$08 | Scroll |
$09~$13 | Bread / Potion / Money based on checks (see below) |
There's a 45% chance that it simply fetches from the drop table at $07EFE7~$07EFEF, meaning 20% chance for poison, 10% key, 5% ring, 5% cross, 5% scroll. The other 55% will do the following checks, in priority order (at $07EFAC~$07EFC3):
- If life < magic, drop bread
- If magic < gold, drop potion
- Otherwise, drop money
RNG
Random number generation follows a simple PRNG formula that's based on nothing but its own previous values, and only ever changes when a new random number is rolled. This means it can be "seeded" and predictably determined based on # of times rolled. The code is:
07:CC64: STA $0038 07:CC66: BEQ $CC8E 07:CC68: LDX $003B 07:CC6A: LDY $003A 07:CC6C: STY $0039 07:CC6E: TYA 07:CC6F: ASL 07:CC70: TAY 07:CC71: TXA 07:CC72: ROL 07:CC73: TAX 07:CC74: INY 07:CC75: BNE $CC78 07:CC77: INX 07:CC78: CLC 07:CC79: TYA 07:CC7A: ADC $003A 07:CC7C: TAY 07:CC7D: TXA 07:CC7E: ADC $003B 07:CC80: CLC 07:CC81: ADC $0039 07:CC83: AND #$7F 07:CC85: TAX 07:CC86: STX $003B 07:CC88: STY $003A 07:CC8A: CMP $0038 07:CC8C: BCS $CC6C 07:CC8E: RTS