-
Notifications
You must be signed in to change notification settings - Fork 1
Battle startup
$BE
: offset in the RNG table 0xC0fd00 - 0xC0fdff
Three random number generator functions:
- Random number [0..1]:
C2/4B53
- Random number [0..255]:
C2/4B5A
- Random number [0..A-1]:
C2/4B65
Each function increments $BE
by 1 and looks at the RNG table with offset $BE
.
Taken from a http://www14.brinkster.com/assassin17/guides/00BE-results.txt by Assassin.
-
C2/23ED
initializes$00BE
to Variable$021E
(the frame counter, ranged 1-60) * 4. Hence it's always a multiple of 4 between 4 and 240. -
C2/30E8
calls random number function (C2/4B5A
) to further pick the formation, and$00BE
is incremented by the random # function. (NOTE: this step only applies to the Floating Continent, where you can randomly get 4 formations for each entry in a 4-pack.) -
C2/23ED
calls random number function (C2/4B5A
) 10 times (once for each possible entity); each call increments$00BE
by 1. This randomization serves to stagger when entities get periodic damage/healing from Seizure, Regen, Phantasm, Poison, or from being a Tentacle who's Seize draining. -
In function
C2/2C30
, the Vigor for every monster (active or not) is randomly calculated usingC2/4B5A
; each call increments$00BE
by 1. -
C2/083F
callsC2/09B4
for each target onscreen, though it apparently skips the call for dormant enemies.C2/09B4
determines an entity's starting Condemned counter (which will promptly be cleared after this if the entity wasn't actually getting the status), and it calls random number functionC2/4B65
, which increments$00BE
. -
Now it's time to randomly pick an encounter type (front/back/side/pincer).
C2/5247
is responsible for that, and it callsC2/4B65
, which increments$00BE
before giving us our random number. -
determine if preemptive (
C2/2E93
-C2/2E99
: fonction pointers). This step is skipped if the formation has "Hide start messages" set, or if any active monsters therein have "Attack First" set.
- if front attack, preemptive if [0..255] < 0x20 (0x40 for Gale Hairpin)
- if side attack, preemptive if [0..255] < 0x38 (0x70 for Gale Hairpin)
- load ATBs (
C2/2575
). For each entity, assign a specific incrementor (unique element in 0, 8, .., 72; seeC2/522A
).
- If front attack, set top byte of ATB = [0 .. Speed(
$3B19,Y
)-1] + Speed + specific_incrementor + (10 - number of valid entities) * 16. Top byte of ATB is set to 255 if overflowed. - If back or pincer, set top byte ATB of characters to specific_incrementor + 1
- If preemptive or side attack, set top byte ATB of monsters to 2
Randomly picks a bit set in A
C2/522A: 5A PHY
C2/522B: 08 PHP
C2/522C: C2 20 REP #$20 (Set 16-bit Accumulator)
C2/522E: 85 EE STA $EE
C2/5230: 20 0E 52 JSR $520E (X = number of bits set in A)
C2/5233: 8A TXA
C2/5234: F0 0E BEQ $5244 (Exit if no bits set)
C2/5236: 20 65 4B JSR $4B65 (random: 0 to A - 1)
C2/5239: AA TAX
C2/523A: 38 SEC
C2/523B: 7B TDC
C2/523C: 2A ROL
C2/523D: 24 EE BIT $EE
C2/523F: F0 FB BEQ $523C
C2/5241: CA DEX
C2/5242: 10 F8 BPL $523C
C2/5244: 28 PLP
C2/5245: 7A PLY
C2/5246: 60 RTS