Advertisement
Zeronoin

Final Fantasy NES Party Targeting

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