Kernel_bin.Magic_Data.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System.IO;
  2. namespace FF8
  3. {
  4. public partial class Kernel_bin
  5. {
  6. /// <summary>
  7. /// Magic Data
  8. /// </summary>
  9. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Magic-data"/>
  10. public class Magic_Data
  11. {
  12. public const int id = 1;
  13. public const int count = 57;
  14. public FF8String Name { get; private set; }
  15. public FF8String Description { get; private set; }
  16. public override string ToString() => Name;
  17. //0x0000 2 bytes Offset to spell name
  18. //0x0002 2 bytes Offset to spell description
  19. public Magic_ID MagicID; //0x0004 2 bytes Magic ID
  20. public byte Unknown; //0x0006 1 byte Unknown
  21. public Attack_Type Attack_type; //0x0007 1 byte Attack type
  22. public byte Spellpower; //0x0008 1 byte Spell power(used in damage formula)
  23. public byte Unknown2; //0x0009 1 byte Unknown
  24. public Target Default_target;//0x000A 1 byte Default_target
  25. public Attack_Flags Attack_flags; //0x000B 1 byte Attack Flags
  26. public byte Draw_resist; //0x000C 1 byte Draw resist(how hard is the magic to draw)
  27. public byte Hit_count; //0x000D 1 byte Hit count(works with meteor animation, not sure about others)
  28. public Element Element; //0x000E 1 byte Element
  29. public byte Unknown3; //0x000F 1 byte Unknown
  30. public Statuses0 Statuses0; //0x0014 2 bytes Statuses 0
  31. public Statuses1 Statuses1; //0x0010 4 bytes Statuses 1
  32. public byte Status_attack; //0x0016 1 byte Status attack enabler
  33. public byte HP_J; //0x0017 1 byte Characters HP junction value
  34. public byte STR_J; //0x0018 1 byte Characters STR junction value
  35. public byte VIT_J; //0x0019 1 byte Characters VIT junction value
  36. public byte MAG_J; //0x001A 1 byte Characters MAG junction value
  37. public byte SPR_J; //0x001B 1 byte Characters SPR junction value
  38. public byte SPD_J; //0x001C 1 byte Characters SPD junction value
  39. public byte EVA_J; //0x001D 1 byte Characters EVA junction value
  40. public byte HIT_J; //0x001E 1 byte Characters HIT junction value
  41. public byte LUCK_J; //0x001F 1 byte Characters LUCK junction value
  42. public byte Elem_J_atk; //0x0020 1 byte Characters J - Elem attack
  43. public byte Elem_J_atk_val;//0x0021 1 byte Characters J - Elem attack value
  44. public byte Elem_J_def; //0x0022 1 byte Characters J - Elem defense
  45. public byte Elem_J_def_val;//0x0023 1 byte Characters J - Elem defense value
  46. public byte Stat_J_atk_val;//0x0024 1 byte Characters J - Status attack value
  47. public byte Stat_J_def_val;//0x0025 1 byte Characters J - Status defense value
  48. public byte[] Stat_J_atk; //0x0026 2 bytes Characters J - Statuses Attack
  49. public byte[] Stat_J_def; //0x0028 2 bytes Characters J - Statuses Defend
  50. public byte[] GF_Compatibility;
  51. //0x002A 1 byte Quezacolt compatibility
  52. //0x002B 1 byte Shiva compatibility
  53. //0x002C 1 byte Ifrit compatibility
  54. //0x002D 1 byte Siren compatibility
  55. //0x002E 1 byte Brothers compatibility
  56. //0x002F 1 byte Diablos compatibility
  57. //0x0030 1 byte Carbuncle compatibility
  58. //0x0031 1 byte Leviathan compatibility
  59. //0x0032 1 byte Pandemona compatibility
  60. //0x0033 1 byte Cerberus compatibility
  61. //0x0034 1 byte Alexander compatibility
  62. //0x0035 1 byte Doomtrain compatibility
  63. //0x0036 1 byte Bahamut compatibility
  64. //0x0037 1 byte Cactuar compatibility
  65. //0x0038 1 byte Tonberry compatibility
  66. //0x0039 1 byte Eden compatibility
  67. public byte[] Unknown4; //0x003A 2 bytes Unknown
  68. public void Read(BinaryReader br, int i)
  69. {
  70. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
  71. Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1);
  72. br.BaseStream.Seek(4, SeekOrigin.Current);
  73. MagicID = (Magic_ID)br.ReadUInt16();
  74. Unknown = br.ReadByte();
  75. Attack_type = (Attack_Type)br.ReadByte();
  76. Spellpower = br.ReadByte();
  77. Unknown2 = br.ReadByte();
  78. Default_target = (Target)br.ReadByte();
  79. Attack_flags = (Attack_Flags)br.ReadByte();
  80. Draw_resist = br.ReadByte();
  81. Hit_count = br.ReadByte();
  82. Element = (Element)br.ReadByte();
  83. Unknown3 = br.ReadByte();
  84. Statuses1 = (Statuses1)br.ReadUInt32();
  85. Statuses0 = (Statuses0)br.ReadUInt16();
  86. Status_attack = br.ReadByte();
  87. HP_J = br.ReadByte();
  88. STR_J = br.ReadByte();
  89. VIT_J = br.ReadByte();
  90. MAG_J = br.ReadByte();
  91. SPR_J = br.ReadByte();
  92. SPD_J = br.ReadByte();
  93. EVA_J = br.ReadByte();
  94. HIT_J = br.ReadByte();
  95. LUCK_J = br.ReadByte();
  96. Elem_J_atk = br.ReadByte();
  97. Elem_J_atk_val = br.ReadByte();
  98. Elem_J_def = br.ReadByte();
  99. Elem_J_def_val = br.ReadByte();
  100. Stat_J_atk_val = br.ReadByte();
  101. Stat_J_def_val = br.ReadByte();
  102. Stat_J_atk = br.ReadBytes(2);
  103. Stat_J_def = br.ReadBytes(2);
  104. GF_Compatibility = br.ReadBytes(16);
  105. Unknown4 = br.ReadBytes(2);
  106. }
  107. public static Magic_Data[] Read(BinaryReader br)
  108. {
  109. var ret = new Magic_Data[count];
  110. for (int i = 0; i < count; i++)
  111. {
  112. var tmp = new Magic_Data();
  113. tmp.Read(br, i);
  114. ret[i] = tmp;
  115. }
  116. return ret;
  117. }
  118. }
  119. }
  120. }