NonJunctionableGFsAttacksData.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. namespace OpenVIII
  5. {
  6. namespace Kernel
  7. {
  8. /// <summary>
  9. /// Non-Junctionable GFs Attacks data
  10. /// </summary>
  11. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Non-junctionable-GF-attacks"/>
  12. public sealed class NonJunctionableGFsAttacksData
  13. {
  14. private static NonJunctionableGFsAttacksData CreateInstance(BinaryReader br, int i)
  15. {
  16. return new NonJunctionableGFsAttacksData(br, i);
  17. }
  18. #region Fields
  19. public const int Count = 16;
  20. public const int ID = 9;
  21. #endregion Fields
  22. #region Constructors
  23. private NonJunctionableGFsAttacksData(BinaryReader br, int i)
  24. {
  25. NonGFID = i;
  26. switch (i)
  27. {
  28. case 11:
  29. Angelo = Angelo.Rush;
  30. break;
  31. case 12:
  32. Angelo = Angelo.Recover;
  33. break;
  34. case 13:
  35. Angelo = Angelo.Reverse;
  36. break;
  37. case 14:
  38. Angelo = Angelo.Search;
  39. break;
  40. default:
  41. Angelo = Angelo.None;
  42. break;
  43. }
  44. //0x0000 2 bytes Offset to GF attack name
  45. Name = Memory.Strings.Read(Strings.FileID.Kernel, ID, i);
  46. br.BaseStream.Seek(2, SeekOrigin.Current);
  47. //0x0002 2 bytes Magic ID(decides what animation to play)
  48. MagicID = (MagicID)br.ReadUInt16();
  49. //0x0004 1 byte Attack type
  50. AttackType = (AttackType)br.ReadByte();
  51. //0x0005 1 byte GF power(used in damage formula)
  52. GFPower = br.ReadByte();
  53. //0x0006 1 byte Status attack enabler
  54. StatusAttack = br.ReadByte();
  55. //0x0007 1 byte Unknown
  56. Unknown0 = br.ReadByte();
  57. //0x0008 1 byte Status flags ?
  58. StatusFlags = br.ReadByte();
  59. //0x0009 2 bytes Unknown
  60. Unknown1 = br.ReadBytes(2);
  61. //0x000B 1 byte Element
  62. Element = (Element)br.ReadByte();
  63. //0x000C 1 byte Status 1
  64. //0x000D 1 byte Status 2
  65. //0x000E 1 byte Status 3
  66. //0x000F 1 byte Status 4
  67. Statuses1 = (BattleOnlyStatuses)br.ReadUInt32();
  68. //0x0010 1 byte Status 5
  69. Statuses0 = (PersistentStatuses)br.ReadUInt16();
  70. //0x0011 1 byte Unknown
  71. Unknown2 = br.ReadByte();
  72. //0x0012 1 byte Power Mod(used in damage formula)
  73. PowerMod = br.ReadByte();
  74. //0x0013 1 byte Level Mod(used in damage formula)
  75. LevelMod = br.ReadByte();
  76. }
  77. #endregion Constructors
  78. #region Properties
  79. public Angelo Angelo { get; }
  80. /// <summary>
  81. ///0x0004 1 byte Attack type
  82. /// </summary>
  83. public AttackType AttackType { get; }
  84. /// <summary>
  85. ///0x000B 1 byte Element
  86. /// </summary>
  87. /// <remarks>
  88. /// //0x00 - Non-Elemental
  89. /// //0x01 - Fire
  90. /// //0x02 - Ice
  91. /// //0x04 - Thunder
  92. /// //0x08 - Earth
  93. /// //0x10 - Poison
  94. /// //0x20 - Wind
  95. /// //0x40 - Water
  96. /// //0x80 - Holy
  97. /// </remarks>
  98. public Element Element { get; }
  99. /// <summary>
  100. ///0x0005 1 byte GF power(used in damage formula)
  101. /// </summary>
  102. public byte GFPower { get; }
  103. /// <summary>
  104. /// //0x0013 1 byte Level Mod(used in damage formula)
  105. /// </summary>
  106. public byte LevelMod { get; }
  107. /// <summary>
  108. ///0x0002 2 bytes Magic ID(decides what animation to play)
  109. /// </summary>
  110. public MagicID MagicID { get; }
  111. /// <summary>
  112. ///0x0000 2 bytes Offset to GF attack name
  113. /// </summary>
  114. public FF8String Name { get; }
  115. public int NonGFID { get; }
  116. /// <summary>
  117. /// //0x0012 1 byte Power Mod(used in damage formula)
  118. /// </summary>
  119. public byte PowerMod { get; }
  120. /// <summary>
  121. ///0x0006 1 byte Status attack enabler
  122. /// </summary>
  123. public byte StatusAttack { get; }
  124. /// <summary>
  125. /// //0x0010 1 byte Status 5
  126. /// </summary>
  127. /// <remarks>
  128. /// //0x00 - None
  129. /// //0x01 - Death
  130. /// //0x02 - Poison
  131. /// //0x04 - Petrify
  132. /// //0x08 - Darkness
  133. /// //0x10 - Silence
  134. /// //0x20 - Berserk
  135. /// //0x40 - Zombie
  136. /// //0x80 - ???
  137. /// </remarks>
  138. public PersistentStatuses Statuses0 { get; }
  139. /// <summary>
  140. ///0x000C 1 byte Status 1
  141. /// </summary>
  142. /// <remarks>
  143. /// //0x00 - None
  144. /// //0x01 - Sleep
  145. /// //0x02 - Haste
  146. /// //0x04 - Slow
  147. /// //0x08 - Stop
  148. /// //0x10 - Regen
  149. /// //0x20 - Protect
  150. /// //0x40 - Shell
  151. /// //0x80 - Reflect
  152. ///
  153. /// //0x000D 1 byte Status 2
  154. /// //0x00 - None
  155. /// //0x01 - Aura
  156. /// //0x02 - Curse
  157. /// //0x04 - Doom
  158. /// //0x08 - Invincible
  159. /// //0x10 - Petrifying
  160. /// //0x20 - Float
  161. /// //0x40 - Confusion
  162. /// //0x80 - Drain
  163. /// //0x000E 1 byte Status 3
  164. ///
  165. /// //0x00 - None
  166. /// //0x01 - Eject
  167. /// //0x02 - Double
  168. /// //0x04 - Triple
  169. /// //0x08 - Defend
  170. /// //0x10 - ???
  171. /// //0x20 - ???
  172. /// //0x40 - ???
  173. /// //0x80 - ???
  174. /// //0x000F 1 byte Status 4
  175. ///
  176. /// //0x00 - None
  177. /// //0x01 - Vit0
  178. /// //0x02 - ???
  179. /// //0x04 - ???
  180. /// //0x08 - ???
  181. /// //0x10 - ???
  182. /// //0x20 - ???
  183. /// //0x40 - ???
  184. /// //0x80 - ???
  185. /// </remarks>
  186. public BattleOnlyStatuses Statuses1 { get; }
  187. /// <summary>
  188. ///0x0008 1 byte Status flags ?
  189. /// </summary>
  190. public byte StatusFlags { get; }
  191. /// <summary>
  192. ///0x0007 1 byte Unknown
  193. /// </summary>
  194. public byte Unknown0 { get; }
  195. /// <summary>
  196. ///0x0009 2 bytes Unknown
  197. /// </summary>
  198. public byte[] Unknown1 { get; }
  199. /// <summary>
  200. /// //0x0011 1 byte Unknown
  201. /// </summary>
  202. public byte Unknown2 { get; }
  203. #endregion Properties
  204. #region Methods
  205. public static IReadOnlyList<NonJunctionableGFsAttacksData> Read(BinaryReader br)
  206. => Enumerable.Range(0, Count).Select(x => CreateInstance(br, x)).ToList()
  207. .AsReadOnly();
  208. public override string ToString() => Name?.Value_str ?? base.ToString();
  209. #endregion Methods
  210. }
  211. }
  212. }