# View Page Source

Revision (current)
Last Updated by Darkman425 on 1/30/2022 4:29 AM
```!!The RNG
As with other RPGs, Final Fantasy Legend also has an RNG. It is difficult to manipulate, as it will only increment through actions, or get shuffled by a soft reset. The soft reset RNG manipulation is mostly frame-based, but something like entering a menu can slightly affect it.

Unfortunately, soft resets seem to revert to a default for the ''battle'' RNG, meaning if it's impossible to win after a reset, there's no way to manipulate that short of getting into another battle before the impossible one, and don't reset along the way.

Final Fantasy Legend uses a different address for almost every different effect possible.  There are 128 such addresses, stored in the RAM from {{C300}} through {{C37F}}.  Manipulating one will not affect whether a different action is successful, as almost every action that needs an RNG has its own address it can use.  With no known exception, each RNG address rolls once per use, incrementing by one after each use.  For example, the Mutant growth RNG address, {{C30B}} is rolled once per mutant at the end of every battle; if it is 123 in a party of three mutants, it will increase to 126 after the next battle.

After resetting, each RNG reverts to a value offset from {{C300}}'s by some amount that varies slightly.  The formula for the offset of each value is believed to be%%%
''y''=floor(9/64*''x''+''b'')%%%
where%%%
''y'' is the offset amount%%%
''x'' is the difference between the RAM address in question and {{C300}} (e.g., for RAM address {{C30B}}, x is 11)%%%
''b'' is the value of {{C300}} plus some unknown fractional amount%%%

The "unknown fractional amount" in b makes many of the RAM addresses inconsistent, but it also frees up an additional degree of freedom to manipulate luck.  For example, {{C358}}'s offset is +12 3/8.  Roughly speaking, this means that when the game is (soft) reset, three out of eight times {{C358}}'s value will be 13 higher than {{C300}}'s; the five other times, it will be 12 higher.  To check the feasibility of manipulating two addresses simultaneously, simply subtract their offsets.  In the case of {{C30B}} and {{C34B}}, the net offset is +9, meaning {{C34B}}'s value will ''always'' be 9 greater than {{C30B}}'s value and those two addresses are "locked" to each other.  It is therefore impossible to manipulate mutant bonus type and mutant abilities independently.

The following is an incomplete list of RNG addresses used by the game.

|{{C309}}|+1 17/64 = +1.27|Mutant: HP growth|10 + INT(RNG*5/255) (conjectured)|
|{{C30B}}|+1 35/64 = +1.55|Mutant: Bonus type%%%(Ability, HP, Mana, Agl., Str., Def., shuffle uses, or none)|0-34: New ability; 35-68: HP up; 69-98: Mana up; 99-116: Agl. up; 117-134: Str. up;%%%135-142: Def. up; 143-146: shuffle abilities; 147-255: nothing|
|{{C30D}}|+1 53/64 = +1.83|NPC: Which direction next?|0-42: south; 43-127: north; 128-212: west; 213-255: east|
|{{C30E}}|+1 31/32 = +1.97|Mutant: Ability Uses shuffler|0-42: divide by 2 (then round down) or add 1 if no uses left; 43-127: add original number of uses;%%%128-212: subtract original number of uses; 213-255: reset to original number of uses|
|{{C31B}}|+3 51/64 = +3.80|HP potion RNG|Unknown|
|{{C323}}|+4 59/64 = +4.92|Battle: Run away|0-126: can't run; 127-255: can run|
|{{C325}}|+5 13/64 = +5.20|Flashy enemy fade-in animation| |
|{{C326}}|+5 11/32 = +5.34|Broken; +1 each time Uses Shuffler picks a full decrease| |
|{{C334}}|+7 5/16 = +7.31|Broken; +1 each time the Uses Shuffler picks a full increase| |
|{{C33B}}|+8 19/64 = +8.30|Random battle trigger|Terrain dependent.  Encounter rates include... Glider: 3; Plains: 5; Forest: 6; Swamp: 13; SU-ZAKU (by foot): 64|
|{{C343}}|+9 27/64 = +9.42|Encounter: Which monster groups do you fight?|Seven possible encounters.  Bins are 0-3 (very rare), 4-7, 8-15, 16-31, 32-63, 63-127, 128-255 (common).|
|{{C347}}|+9 63/64 = +9.98|Bonus from STRENGTH or AGILITY items|Unknown|
|{{C34B}}|+10 35/64 = +10.55|Mutant: Which ability does one get?%%%Mutant: Str., Def., Agl., or Mana growth|Ability: Rolled and incremented until the RNG is greater than or equal to 239.%%%Mana, Agl., and Str. growth: 1 + INT(RNG*4/255) (conjectured)%%%Def. growth: 1+INT(RNG*2/255) (conjectured)|
|{{C34F}}|+11 7/64 = +11.11|Probably used for NPCs. Might be used to increment {{C369}} with nearby NPC| |
|{{C352}}|+11 17/32 = +11.53|Rolled when using STENCH in battle| |
|{{C353}}|+11 43/64 = +11.67|Encounter: How many monsters in each group?|Unknown|
|{{C358}}|+12 3/8 = +12.38|Item: POTION's recovery|For POTION: INT(RNG*20/255).  For X-POTION: INT(RNG*60/255).|
|{{C35A}}|+12 21/32 = +12.66|Enemy targeting|Unknown|
|{{C35C}}|+12 15/16 = +12.94|Will a meat drop from an enemy?|Unknown|
|{{C369}}|+14 49/64 = +14.77|NPC: Determines when an NPC will take a step, apparently.|Unknown|
|{{C36F}}|+15 39/64 = +15.61|Mutant: What one of four slots to put an ability?|	0-42: Slot 1; 43-127: Slot 2; 128-212: Slot 3; 213-255: Slot 4%%%Increments only if the effect of address {{C30B}} will actually affect that slot with a valid ability shuffle or change it to a new ability.|

! RNG Table
All random numbers with the exception of those used in battles (which are poorly understood) are pulled from the same RNG table.  This table has a period of 256 and runs through all values from 0 to 255.

In the following table, the row indicates the first byte while the column indicates the second byte.  For example, if RAM address {{C30B}} is 162 (A2 in hex), the RNG will roll a (decimal) value of 88.

{{
| ||0||1||2||3||4||5||6||7||8||9||A||B||C||D||E||F|
||0|60|153|152|141|20|225|79|149|108|169|183|29|187|14|159|218|
||1|156|185| 7 |82|116|254|239|74|204|201|168|194|91|17|192|69|
||2|252|217|167|205|212|222|112|213|211|233| 8 |93| 4 |49|32|154|
||3|163|249|184|18|203|190|47|10|115|246|151|130|100|81|127|133|
||4|67|230|24|242|107|158|207|234|19|214|200|157|196|113|224|90|
||5|28|198|135|45|11|126|144|53|76|182|40|66|219|145|64|197|
||6|124|166|216|178|84|94|15|170|172|150|119|221|123|177|95|26|
||7|220|134|56|109|180|62|175|117|243|118|232| 2 |27|209|255|250|
||8|195|102|103|114|235|30|176|106|147|86|72|226|68|241|96|37|
||9|99|70|248|173|139| 1 |16|181|51|54|87|61|164|238|63|186|
||A| 3 |38|88|50|43|33|143|42|44|22|247|162|251|206|223|101|
||B|92| 6 |71|237|52|65|208|245|140| 9 |104|125|155|174|128|122|
||C|188|25|231|13|148|97|48|21|236|41|55|98|59|142|31|165|
||D|227|57|120|210|244|129|111|202|179|73|215|189|36|110|191|58|
||E|131|89|39|77|171|161|240|85|83|105|136|34|132|78|160|229|
||F|35|121|199|146|75|193|80|138|12|137|23|253|228|46| 0 | 5
}}

Here is the same table in hex format:
{{
| ||0||1||2||3||4||5||6||7||8||9||A||B||C||D||E||F|
||0|0x3C|0x99|0x98|0x8D|0x14|0xE1|0x4F|0x95|0x6C|0xA9|0xB7|0x1D|0xBB|0x0E|0x9F|0xDA|
||1|0x9C|0xB9|0x07|0x52|0x74|0xFE|0xEF|0x4A|0xCC|0xC9|0xA8|0xC2|0x5B|0x11|0xC0|0x45|
||2|0xFC|0xD9|0xA7|0xCD|0xD4|0xDE|0x70|0xD5|0xD3|0xE9|0x08|0x5D|0x04|0x31|0x20|0x9A|
||3|0xA3|0xF9|0xB8|0x12|0xCB|0xBE|0x2F|0x0A|0x73|0xF6|0x97|0x82|0x64|0x51|0x7F|0x85|
||4|0x43|0xE6|0x18|0xF2|0x6B|0x9E|0xCF|0xEA|0x13|0xD6|0xC8|0x9D|0xC4|0x71|0xE0|0x5A|
||5|0x1C|0xC6|0x87|0x2D|0x0B|0x7E|0x90|0x35|0x4C|0xB6|0x28|0x42|0xDB|0x91|0x40|0xC5|
||6|0x7C|0xA6|0xD8|0xB2|0x54|0x5E|0x0F|0xAA|0xAC|0x96|0x77|0xDD|0x7B|0xB1|0x5F|0x1A|
||7|0xDC|0x86|0x38|0x6D|0xB4|0x3E|0xAF|0x75|0xF3|0x76|0xE8|0x02|0x1B|0xD1|0xFF|0xFA|
||8|0xC3|0x66|0x67|0x72|0xEB|0x1E|0xB0|0x6A|0x93|0x56|0x48|0xE2|0x44|0xF1|0x60|0x25|
||A|0x03|0x26|0x58|0x32|0x2B|0x21|0x8F|0x2A|0x2C|0x16|0xF7|0xA2|0xFB|0xCE|0xDF|0x65|
||B|0x5C|0x06|0x47|0xED|0x34|0x41|0xD0|0xF5|0x8C|0x09|0x68|0x7D|0x9B|0xAE|0x80|0x7A|
||C|0xBC|0x19|0xE7|0x0D|0x94|0x61|0x30|0x15|0xEC|0x29|0x37|0x62|0x3B|0x8E|0x1F|0xA5|
||D|0xE3|0x39|0x78|0xD2|0xF4|0x81|0x6F|0xCA|0xB3|0x49|0xD7|0xBD|0x24|0x6E|0xBF|0x3A|
||E|0x83|0x59|0x27|0x4D|0xAB|0xA1|0xF0|0x55|0x53|0x69|0x88|0x22|0x84|0x4E|0xA0|0xE5|
||F|0x23|0x79|0xC7|0x92|0x4B|0xC1|0x50|0x8A|0x0C|0x89|0x17|0xFD|0xE4|0x2E|0x00|0x05
}}

!!Tricks
Some tricks and quirks that would be good to keep in mind.

! The game only accepts input at a minimum of pairs
If you hold down a button for a single frame, the game won't even process it. You must hold each button you want to press for two frames rather than one.

The game uses AND logic, so ''releasing'' a button for a single frame gets a reaction.

In effect, turbo button pressing would be {{AA.AA.AA.AA.}} and so on.

! Resets are faster than running
An optimal run away takes around 20 frames longer than an optimal reset. In addition, it is possible to manipulate {{C33B}} into giving you a high step count before another battle using a reset.

! GEN-BU Skip
Have a Mutant learn TELEPOR before you fight GEN-BU. After you put the three KING items on the statue, use TELEPOR to get to the tower. Because you didn't walk on a certain trigger tile, poor GEN-BU never gets a chance to fight you.

! STONE Book -- The Instant Art Kit
Bosses are immune to the PARA element, which includes many status effects and instant death. However, most have no immunity to the STONE element, in which petrification acts like instant death anyway.

The earliest you can get a STONE Book is in World 3, in a shop in the hidden town.

! SAW Glitch
The SAW is an instant death item and a monster ability. Both the ability on a BEETLE or WARRIOR and the actual item has a chance to hit based on strength. It also has an additional requirement, in that your strength must be ''less'' than the enemy's defense for it to even work.

There are four battles where you can't STONE the boss, but have access to the SAW item. It's these battles where the SAW can prove useful.

! Vital Hit Rate
The battle RNG insists on resetting back to a default state after a reset. As such, the first action will always hit or miss depending on how accurate it is.

For status spells, your Mana needs to be at least Enemy Mana-4 to guarantee a hit from the first shot. Most endgame bosses have a Mana of 100, so in order to petrify them in the first action, you need 96 Mana by the endgame.

For the SAW item, you need Str. of 75 or higher to hit first thing. Keep in mind that if your Str. is above the enemy's Def., it will ''never'' hit!

! Forced battles notes
||Enemy||HP||Death?||Stone?||Misc.||
|{{1-1 P-FROG}}|82|Yes|Yes| |
|{{1-1 KINGSWRD}}|103|Yes|Yes| |
|{{1-2 SKELETON%%%0-2 ASIGARU}}|20%%%20| %%%Yes|Yes%%%Yes| |
|{{1-1 STEWARD}}|20| Yes | Yes| |
|{{1-1 GEN-BU}}|250| |Yes|Can be skipped by TELEPOR|
|{{1-1 SEI-RYU}}|600| |Yes|No stoning item possible at this point|
|{{1-3 MOSQUITO}}|150|Yes|Yes| |
|{{1-1 GARLIC%%%1-1 SABERCAT%%%1-1 P-WORM}}|231%%%202%%%231|Yes%%%Yes%%%Yes|Yes%%%Yes%%%Yes|Gah, 3 durable groups|
|{{1-3 SABERCAT}}|202|Yes|Yes| |
|{{1-1 BYAK-KO}}|1000| |Yes|STONE book available by this time|
|{{1-3 ATOM ANT}}|295|Yes|Yes| |
|{{1-1 EVIL EYE}}|606|Yes|Yes| |
|{{1-1 MACHINE}}|1000| | |First forced enemy immune to STONE|
|{{1-1 SU-ZAKU}}|1500| |Yes| |
|{{1-1 ASHURA}}|2000| | | |
|{{1-1 GEN-BU2}}|1500| | | |
|{{1-1 SEI-RYU2}}|1750| |Yes| |
|{{1-1 BYAK-KO2}}|2000| |Yes| |
|{{1-1 SU-ZAKU2}}|2500| |Yes| |
|{{1-1 CREATOR}}|5000| | | |

```