data.lua 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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, 8 do
  59. Characters[i] = {}
  60. end
  61. -- Young Cloud (9) and Sephiroth (10) of the flashbacks share the slots of Cait Sith (6) and Vincent
  62. -- (7) in the savemap of the game, as in the original game: their data is in those slots.
  63. Characters[9] = nil
  64. Characters[10] = nil
  65. setmetatable(Characters, {
  66. __index = function(characters, id)
  67. if id == 9 then return rawget(characters, 6) end
  68. if id == 10 then return rawget(characters, 7) end
  69. return nil
  70. end
  71. })
  72. --- The party inventory.
  73. --
  74. -- Items can be accessed with indexes 0 - MAX_INVENTORY_SLOTS. Money can be accessed with the
  75. -- index "money". Key items are under the index "key", with indexes 0-50, true or false if the key
  76. -- item is in the inventory. Inventory has the following functions:
  77. -- add_item(item, quantity)
  78. -- remove_item(item, quantity)
  79. -- add_key_item(item)
  80. -- remove_key_item(item)
  81. -- has_key_item(item)
  82. -- get_item_quantity(item)
  83. -- add_money(amount)
  84. -- remove_money(amount)
  85. -- money_to_banks(b1, b2, a1, a2)
  86. -- sort(criteria)
  87. Inventory = {}
  88. Inventory.money = 0
  89. Inventory.key = {}
  90. for i = 0, 50 do
  91. Inventory.key[i] = false
  92. end
  93. Inventory.ITEM_TYPE = {
  94. ITEM = 0,
  95. WEAPON = 1,
  96. ARMOR = 2,
  97. ACCESSORY = 3
  98. }
  99. Inventory.RESTORE_TYPE = {
  100. HP = 0,
  101. MP = 1,
  102. STATUS = 2,
  103. NONE = 3
  104. }
  105. Inventory.ORDER = {
  106. CUSTOM = 0,
  107. FIELD = 1,
  108. BATTLE = 2,
  109. THROW = 3,
  110. TYPE = 4,
  111. NAME = 5,
  112. MOST = 6,
  113. LEAST = 7
  114. }
  115. Materia = {}
  116. --- Types of materia
  117. Materia.TYPE = {
  118. MAGIC = 1,
  119. SUPPORT = 2,
  120. COMMAND = 3,
  121. INDEPENDENT = 4,
  122. SUMMON = 5
  123. }
  124. --- ID of the enemy skill materia. This is handled differently.
  125. Materia.ENEMY_SKILL_ID = 44
  126. --- Abilities confered by independent materia.
  127. Materia.ABILITY = {
  128. STR_PLUS = 0,
  129. VIT_PLUS = 1,
  130. MAG_PLUS = 2,
  131. SPR_PLUS = 3,
  132. DEX_PLUS = 4,
  133. LCK_PLUS = 5,
  134. HP_PLUS = 8,
  135. MP_PLUS = 9,
  136. EXP_PLUS = 10,
  137. COVER = 11,
  138. UNDERWATER = 12,
  139. LONG_RANGE = 80,
  140. COUNTER_ATTACK = 83,
  141. HP_MP = 98,
  142. MEGA_ALL = 99,
  143. MONEY_PLUS = 100,
  144. PREEMPTIVE = 103,
  145. ENC_DOWN = 107,
  146. ENC_UP = 108,
  147. ENCOUNTER_DOWN = 107,
  148. ENCOUNTER_UP = 108,
  149. ENC_CHOCOBO = 109
  150. }
  151. --- Abilities confered by support materia.
  152. --
  153. -- They are dependant on the linked materia.
  154. Materia.LINK = {
  155. ALL = 81,
  156. COMMAND_COUNTER = 84,
  157. MAGIC_COUNTER = 85,
  158. SNEAK_ATTACK = 86,
  159. FINAL_ATTACK = 87,
  160. MP_TURBO = 88,
  161. MP_ABSORB = 89,
  162. HP_ABSORB = 90,
  163. ADDED_CUT = 92,
  164. STEAL_AS_WELL = 93,
  165. ELEMENTAL = 94,
  166. ADDED_EFFECT = 95,
  167. QUADRA_MAGIC = 99
  168. }
  169. --- Battle ATB modes.
  170. BattleType = {
  171. ATB = 0,
  172. WAIT = 1,
  173. }
  174. --- Game data
  175. --
  176. -- TODO: Remove, use banks.
  177. Data = {
  178. progress_game = 0,
  179. moving_linear = false,
  180. moving_jump = false,
  181. money = 0,
  182. love_point_aeris = 50,
  183. love_point_tifa = 30,
  184. love_point_yuffie = 10,
  185. love_point_barret = 0,
  186. battle_love_aeris = 100,
  187. battle_love_tifa = 100,
  188. battle_love_yuffie = 100,
  189. battle_love_barret = 100,
  190. elevtr1_floor = 1,
  191. m1_door1_open = false,
  192. m1_door2_open = false,
  193. m1_jessie_unstuck = true,
  194. m1_bomb_set = false,
  195. m1_226 = false,
  196. m1_times_up = false,
  197. item_sector1_chest1 = false,
  198. -- TODO: From here on, what are these for?
  199. movieFrameNumber = 0,
  200. temp_6_4 = 0,
  201. expectedTriangleId = 0,
  202. }
  203. ScriptState = {
  204. is_executing = false,
  205. }
  206. MenuSettings = {
  207. available = false,
  208. pause_available = false,
  209. battle_type = BattleType.ATB,
  210. battle_speed = 10,
  211. }
  212. --- Current party.
  213. Party = {
  214. MAX = 3,
  215. --- Leader of the party in the field, the character the player controls. nil: the first member.
  216. leader = nil,
  217. [1] = nil,
  218. [2] = nil,
  219. [3] = nil
  220. }
  221. --- Memory banks.
  222. --
  223. -- Used to store gama data.
  224. -- 15 banks (indexes 0-14) with 255 addresses (indexes 0-254) each. Memory banks 4, 5, 7, 8 and 9
  225. -- are temporary and are not saved to the savemap.
  226. Banks = {}
  227. Banks.COUNT = 15
  228. Banks.SIZE = 255
  229. for i = 0, Banks.COUNT do
  230. Banks[i] = {}
  231. for j = 0, Banks.SIZE do
  232. Banks[i][j] = 0
  233. end
  234. end
  235. --- Memory banks for individual bits.
  236. --
  237. -- @todo Delete this, and implement bit operations over Banks.
  238. BitBanks = {}
  239. BitBanks.COUNT = 15
  240. BitBanks.SIZE = 255
  241. for i = 0, BitBanks.COUNT do
  242. BitBanks[i] = {}
  243. for j = 0, BitBanks.SIZE do
  244. BitBanks[i][j] = {}
  245. for k = 0, 8 do
  246. BitBanks[i][j][k] = 0
  247. end
  248. end
  249. end