Legacy of the Wizard: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(INES infobox)
Line 1: Line 1:
{{INES
|title = Legacy of the Wizard / Dragon Slayer 4
|image =
|mapperno = 4 / 206
|mappername = [[TFROM]] / [[NAMCOT-3416]]
|prgrom = 16 {{x}} 8kB
|chrrom = 64 {{x}} 1kB
|mirroring = Vertical
|4screen = No
|sram = No
|game = Legacy of the Wizard
}}
== Enemy Drops ==
== Enemy Drops ==



Revision as of 22:01, 4 April 2020

Legacy of the Wizard / Dragon Slayer 4
Mapper No. 4 / 206
Mapper Name [[TFROM / NAMCOT-3416]][[Category:NES games using the TFROM / NAMCOT-3416 mapper]]
PRG-ROM Pages 16 Template:X 8kB[[Category:NES games with 16 Template:X 8kB PRG-ROM pages]]
CHR-ROM Pages 64 Template:X 1kB[[Category:NES games with 64 Template:X 1kB CHR-ROM pages]]
Mirroring Vertical
4-Screen Mirroring No
SRAM Enabled No


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 pertinent RAM addresses are $0039, $003A, and $003B. $0038 also stores a modulus / exclusive upper bound that can be passed in via accumulator, which governs how many times to reroll for one single RNG call. 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