Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Final Fantasy NES Party Targeting
- by ZeroNoin
- Enemy targeting of party characters in Final Fantasy NES is based on a few things.
- It starts with the Battle RNG Counter at CPU address $688A which is in the cartridge RAM.
- A variety of events in battle increment the Battle RNG Counter.
- This value is then indexed to a table/array starting at $3FCF1 in the cartridge ROM.
- The indexed value is then compared in series to the values 0x20, 0x40, and 0x80.
- If it is less than 0x20, it targets the 4th character slot.
- Else if it is less than 0x40, it targets the 3rd character slot.
- Else if it is less than 0x80, it targets the 2nd character slot.
- Else if none of these are true it targets the 1st character slot.
- So the RNG values for each slot are:
- Slot 1: 0x80-0xFF
- Slot 2: 0x40-0x7F
- Slot 3: 0x20-0x3F
- Slot 4: 0x00-0x1F
- If the selected target is Dead or Stone, it adds 1 to the Battle RNG Counter and loops back to the compares.
- All of the 256 possible values are included in the Battle RNG Table/Array except 0x95.
- Instead of having 0x95, there are two 0x00 values in the table/array.
- Probabilities get more complicated as characters become Dead or Stone.
- The layout of the table/array begins to factor as the target routine loops and the Battle RNG counter increments.
- When a targeted character is Dead or Stone, the next value(s) on the table/array determines who takes that attack.
- Battle RNG Table/Array at $3FCF1-$3FDF0 in the ROM
- AE D0 38 8A ED 60 DB 72 5C 59 27 D8 0A 4A F4
- 34 08 A9 C3 96 56 3B F1 55 F8 6B 31 EF 6D 28 AC
- 41 68 1E 2A C1 E5 8F 50 F5 3E 7B B7 4C 14 39 12
- CD B2 62 8B 82 3C BA 63 85 3A 17 B8 2E B5 BE 20
- CB 46 51 2C CF 03 78 53 97 06 69 EB 77 86 E6 EA
- 74 0C 21 E2 40 D4 5A 3D C7 2B 94 D5 8C 44 FD EE
- D2 43 00 BB FA C6 1D 98 A0 D3 54 5F 5E DC A8 00
- AF 93 A1 E1 6C 04 DE B6 D7 36 16 C5 C8 C4 E4 0F
- 02 AB E8 33 99 73 11 6A 09 67 F3 FF A2 DF 32 0E
- 1F 0D 90 25 64 75 B3 65 2F C9 B0 DA 5D 9F EC 29
- CE E3 F0 91 7A 58 45 24 1C 47 A4 89 18 2D CC BD
- 6F 80 F6 81 22 E9 07 70 FB DD AD 35 A6 61 B4 A3
- FE B1 30 4B 15 48 6E 4F 5B 13 9C 83 92 01 C2 19
- 7F 1A 1B 71 B9 3F 4E 9B BF 9E 87 0B 10 57 F2 26
- 79 9A 05 C0 E0 F7 4D 7D CA 52 9D F9 BC AA FC 8D
- 7E D1 A5 42 E7 D6 76 A7 84 8E 66 7C 23 88 37 49
- D9
- Battle RNG Table/Array Converted to Character Slot
- 1 1 3 1 1 2 1 2 2 2 3 1 4 2 1
- 3 4 1 1 1 2 3 1 2 1 2 3 1 2 3 1
- 2 2 4 3 1 1 1 2 1 3 2 1 2 4 3 4
- 1 1 2 1 1 3 1 2 1 3 4 1 3 1 1 3
- 1 2 2 3 1 4 2 2 1 4 2 1 2 1 1 1
- 2 4 3 1 2 1 2 3 1 3 1 1 1 2 1 1
- 1 2 4 1 1 1 4 1 1 1 2 2 2 1 1 4
- 1 1 1 1 2 4 1 1 1 3 4 1 1 1 1 4
- 4 1 1 3 1 2 4 2 4 2 1 1 1 1 3 4
- 4 4 1 3 2 2 1 2 3 1 1 1 2 1 1 3
- 1 1 1 1 2 2 2 3 4 2 1 1 4 3 1 1
- 2 1 1 1 3 1 4 2 1 1 1 3 1 2 1 1
- 1 1 3 2 4 2 2 2 2 4 1 1 1 4 1 4
- 2 4 4 2 1 3 2 1 1 1 1 4 4 2 1 3
- 2 1 4 1 1 1 2 2 1 2 1 1 1 1 1 1
- 2 1 1 2 1 1 2 1 1 1 2 2 3 1 3 2
- 1
- Here, 1 2 3 4 represent active character slots, while X represents slots that are Dead or Stone.
- The values shifted by other Dead or Stone slots are added to the base values of that slot.
- The corresponding probabilities of each character slot being targeted are then listed.
- 1 : 127 + 0 + 0 + 0 = 127/256 = 49.6%
- 2 : 0 + 64 + 0 + 0 = 64/256 = 25.0%
- 3 : 0 + 0 + 32 + 0 = 32/256 = 12.5%
- 4 : 0 + 0 + 0 + 33 = 33/256 = 12.9%
- 1 : 127 + 0 + 0 + 16 = 143/256 = 55.9%
- 2 : 0 + 64 + 0 + 13 = 77/256 = 30.1%
- 3 : 0 + 0 + 32 + 4 = 36/256 = 14.1%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 1 : 127 + 0 + 20 + 0 = 147/256 = 57.4%
- 2 : 0 + 64 + 6 + 0 = 70/256 = 27.3%
- X : 0 + 0 + 0 + 0 = 32/256 = 0.0%
- 4 : 0 + 0 + 6 + 33 = 39/256 = 15.2%
- 1 : 127 + 35 + 0 + 0 = 162/256 = 63.3%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 3 : 0 + 15 + 32 + 0 = 47/256 = 18.4%
- 4 : 0 + 14 + 0 + 33 = 47/256 = 18.4%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 2 : 66 + 64 + 0 + 0 = 130/256 = 50.8%
- 3 : 37 + 0 + 32 + 0 = 69/256 = 27.0%
- 4 : 24 + 0 + 0 + 33 = 57/256 = 22.3%
- 1 : 127 + 0 + 25 + 20 = 172/256 = 67.2%
- 2 : 0 + 64 + 7 + 13 = 84/256 = 32.8%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 1 : 127 + 45 + 0 + 29 = 201/256 = 78.5%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 3 : 0 + 19 + 32 + 4 = 55/256 = 21.5%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 1 : 127 + 47 + 25 + 0 = 199/256 = 77.7%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 4 : 0 + 17 + 7 + 33 = 57/256 = 22.3%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 2 : 84 + 64 + 0 + 21 = 169/256 = 66.0%
- 3 : 43 + 0 + 32 + 12 = 87/256 = 34.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 2 : 91 + 64 + 23 + 0 = 178/256 = 69.5%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 4 : 36 + 0 + 9 + 33 = 78/256 = 30.5%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 3 : 83 + 38 + 32 + 0 = 153/256 = 59.8%
- 4 : 44 + 26 + 0 + 33 = 103/256 = 40.2%
- 1 : 127 + 64 + 32 + 33 = 256/256 = 100.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 2 : 127 + 64 + 32 + 33 = 256/256 = 100.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 3 : 127 + 64 + 32 + 33 = 256/256 = 100.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- X : 0 + 0 + 0 + 0 = 0/256 = 0.0%
- 4 : 127 + 64 + 32 + 33 = 256/256 = 100.0%
- 1 1 3 1 1 2 1 2 2 2 3 1 4 2 1 3 4 1 1 1 2 3 1 2 1 2 3 1 2 3 1 2 2 4 3 1 1 1 2 1 3 2 1 2 4 3 4 1 1 2 1 1 3 1 2 1 3 4 1 3 1 1 3 1 2 2 3 1 4 2 2 1 4 2 1 2 1 1 1 2 4 3 1 2 1 2 3 1 3 1 1 1 2 1 1 1 2 4 1 1 1 4 1 1 1 2 2 2 1 1 4 1 1 1 1 2 4 1 1 1 3 4 1 1 1 1 4 4 1 1 3 1 2 4 2 4 2 1 1 1 1 3 4 4 4 1 3 2 2 1 2 3 1 1 1 2 1 1 3 1 1 1 1 2 2 2 3 4 2 1 1 4 3 1 1 2 1 1 1 3 1 4 2 1 1 1 3 1 2 1 1 1 1 3 2 4 2 2 2 2 4 1 1 1 4 1 4 2 4 4 2 1 3 2 1 1 1 1 4 4 2 1 3 2 1 4 1 1 1 2 2 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 2 3 1 3 2 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement