data.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. --- Game static data
  2. --
  3. -- Contains game data, not to be modified during a playthrough.
  4. Game = {
  5. --- Data for character growth calculation on level up.
  6. Growth = {
  7. --- Bonuses given to different stats when leveling up.
  8. bonus = {
  9. --- Bonus given to primary stats when leveling up.
  10. --
  11. -- 12 values (indexes 0-11), one of the values is chosen at random.
  12. primary = {},
  13. --- Bonus given to HP when leveling up.
  14. --
  15. -- 12 values (indexes 0-11), one of them is chosen at random.
  16. hp = {},
  17. --- Bonus given to HP when leveling up.
  18. --
  19. -- 12 values (indexes 0-11), one of them is chosen at random.
  20. mp = {}
  21. },
  22. --- Curves for stat growth.
  23. --
  24. -- Used to determine stat growth for each character. There are 64
  25. -- curves (indexes 0-63). Each curve has 8 segments, with "base" and
  26. -- "gradient" values. Segments are used when reaching levels in
  27. -- brackets:
  28. -- Lv. 2-11: Segment 0.
  29. -- Lv. 12-21: Segment 1.
  30. -- Lv. 22-31: Segment 2.
  31. -- Lv. 32-41: Segment 3.
  32. -- Lv. 42-51: Segment 4.
  33. -- Lv. 52-61: Segment 5.
  34. -- Lv. 62-81: Segment 6.
  35. -- Lv. 82-99: Segment 7.
  36. curves = {}
  37. },
  38. --- Command definitions.
  39. Commands = {},
  40. --- Attack definitions.
  41. Attacks = {},
  42. --- Character definitions.
  43. Characters = {},
  44. --- Item definitions.
  45. --
  46. -- Include items, weapons, armors, and accessories. Key items and materia are not stored here.
  47. Items = {},
  48. --- Materia definitions.
  49. Materia = {},
  50. --- Key items definitions.
  51. Key_Items = {},
  52. --- Summon names definitions.
  53. Summon_Names = {},
  54. }
  55. ControlKey = "";
  56. --- Playable characters
  57. Characters = {}
  58. for i = 1, 11 do
  59. Characters[i] = {}
  60. end
  61. --- The party inventory.
  62. --
  63. -- Items can be accessed with indexes 0 - MAX_INVENTORY_SLOTS. Money can be accessed with the
  64. -- index "money". Key items are under the index "key", with indexes 0-50, true or false if the key
  65. -- item is in the inventory. Inventory has the following functions:
  66. -- add_item(item, quantity)
  67. -- remove_item(item, quantity)
  68. -- add_key_item(item)
  69. -- remove_key_item(item)
  70. -- has_key_item(item)
  71. -- get_item_quantity(item)
  72. -- add_money(amount)
  73. -- remove_money(amount)
  74. -- money_to_2_banks(b1, b2, a1, a2)
  75. -- sort(criteria)
  76. Inventory = {}
  77. Inventory.money = 0
  78. Inventory.key = {}
  79. for i = 0, 50 do
  80. Inventory.key[i] = false
  81. end
  82. Inventory.ITEM_TYPE = {
  83. ITEM = 0,
  84. WEAPON = 1,
  85. ARMOR = 2,
  86. ACCESSORY = 3
  87. }
  88. Inventory.RESTORE_TYPE = {
  89. HP = 0,
  90. MP = 1,
  91. STATUS = 2,
  92. NONE = 3
  93. }
  94. Inventory.ORDER = {
  95. CUSTOM = 0,
  96. FIELD = 1,
  97. BATTLE = 2,
  98. THROW = 3,
  99. TYPE = 4,
  100. NAME = 5,
  101. MOST = 6,
  102. LEAST = 7
  103. }
  104. Materia = {}
  105. --- Types of materia
  106. Materia.TYPE = {
  107. MAGIC = 1,
  108. SUPPORT = 2,
  109. COMMAND = 3,
  110. INDEPENDENT = 4,
  111. SUMMON = 5
  112. }
  113. --- ID of the enemy skill materia. This is handled differently.
  114. Materia.ENEMY_SKILL_ID = 44
  115. --- Abilities confered by independent materia.
  116. Materia.ABILITY = {
  117. STR_PLUS = 0,
  118. VIT_PLUS = 1,
  119. MAG_PLUS = 2,
  120. SPR_PLUS = 3,
  121. DEX_PLUS = 4,
  122. LCK_PLUS = 5,
  123. HP_PLUS = 8,
  124. MP_PLUS = 9,
  125. EXP_PLUS = 10,
  126. COVER = 11,
  127. UNDERWATER = 12,
  128. LONG_RANGE = 80,
  129. COUNTER_ATTACK = 83,
  130. HP_MP = 98,
  131. MEGA_ALL = 99,
  132. MONEY_PLUS = 100,
  133. PREEMPTIVE = 103,
  134. ENC_DOWN = 107,
  135. ENC_UP = 108,
  136. ENC_CHOCOBO = 109
  137. }
  138. --- Abilities confered by support materia.
  139. --
  140. -- They are dependant on the linked materia.
  141. Materia.LINK = {
  142. ALL = 81,
  143. COMMAND_COUNTER = 84,
  144. MAGIC_COUNTER = 85,
  145. SNEAK_ATTACK = 86,
  146. FINAL_ATTACK = 87,
  147. MP_TURBO = 88,
  148. MP_TURBO = 89,
  149. MP_TURBO = 90,
  150. ADDED_CUT = 92,
  151. STEAL_AS_WELL = 93,
  152. ELEMENTAL = 94,
  153. ADDED_EFFECT = 95,
  154. QUADRA_MAGIC = 99
  155. }
  156. --- Battle ATB modes.
  157. BattleType = {
  158. ATB = 0,
  159. WAIT = 1,
  160. }
  161. --- Game data
  162. --
  163. -- TODO: Remove, use banks.
  164. Data = {
  165. progress_game = 0,
  166. moving_linear = false,
  167. moving_jump = false,
  168. money = 0,
  169. love_point_aeris = 50,
  170. love_point_tifa = 30,
  171. love_point_yuffie = 10,
  172. love_point_barret = 0,
  173. battle_love_aeris = 100,
  174. battle_love_tifa = 100,
  175. battle_love_yuffie = 100,
  176. battle_love_barret = 100,
  177. elevtr1_floor = 1,
  178. m1_door1_open = false,
  179. m1_door2_open = false,
  180. m1_jessie_unstuck = true,
  181. m1_bomb_set = false,
  182. m1_226 = false,
  183. m1_times_up = false,
  184. item_sector1_chest1 = false,
  185. -- TODO: From here on, what are these for?
  186. movieFrameNumber = 0,
  187. temp_6_4 = 0,
  188. expectedTriangleId = 0,
  189. }
  190. ScriptState = {
  191. is_executing = false,
  192. }
  193. MenuSettings = {
  194. available = false,
  195. pause_available = false,
  196. battle_type = BattleType.ATB,
  197. battle_speed = 10,
  198. }
  199. --- Current party.
  200. Party = {
  201. MAX = 3,
  202. [1] = nil,
  203. [2] = nil,
  204. [3] = nil
  205. }
  206. --- Memory banks.
  207. --
  208. -- Used to store gama data.
  209. -- 15 banks (indexes 0-14) with 255 addresses (indexes 0-254) each. Memory banks 4, 5, 7, 8 and 9
  210. -- are temporary and are not saved to the savemap.
  211. Banks = {}
  212. Banks.COUNT = 15
  213. Banks.SIZE = 255
  214. for i = 0, Banks.COUNT do
  215. Banks[i] = {}
  216. for j = 0, Banks.SIZE do
  217. Banks[i][j] = 0
  218. end
  219. end
  220. --- Memory banks for individual bits.
  221. --
  222. -- @todo Delete this, and implement bit operations over Banks.
  223. BitBanks = {}
  224. BitBanks.COUNT = 15
  225. BitBanks.SIZE = 255
  226. for i = 0, BitBanks.COUNT do
  227. BitBanks[i] = {}
  228. for j = 0, BitBanks.SIZE do
  229. BitBanks[i][j] = {}
  230. for k = 0, 8 do
  231. BitBanks[i][j][k] = 0
  232. end
  233. end
  234. end