SelphieLimitBreakSets.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. namespace OpenVIII
  6. {
  7. namespace Kernel
  8. {
  9. /// <summary>
  10. /// Slot Sets Data
  11. /// </summary>
  12. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Selphie-limit-break-sets"/>
  13. /// <seealso cref="https://finalfantasy.fandom.com/wiki/Slots_(ability_type)#Final_Fantasy_VIII"/>
  14. public sealed class SelphieLimitBreakSets : IReadOnlyList<Slot>
  15. {
  16. #region Fields
  17. public const int ID = 27;
  18. public const int SectionCount = 16;
  19. public const int Size = 16;
  20. #endregion Fields
  21. #region Constructors
  22. private SelphieLimitBreakSets(BinaryReader br)
  23. => Slots = Slot.Read(br);
  24. #endregion Constructors
  25. #region Properties
  26. public int Count => Slots.Count;
  27. public IReadOnlyList<Slot> Slots { get; }
  28. #endregion Properties
  29. #region Indexers
  30. public Slot this[int index] => Slots[index];
  31. #endregion Indexers
  32. #region Methods
  33. public static SelphieLimitBreakSets CreateInstance(BinaryReader br) => new SelphieLimitBreakSets(br);
  34. public static IReadOnlyList<SelphieLimitBreakSets> Read(BinaryReader br)
  35. => Enumerable.Range(0, SectionCount).Select(x => CreateInstance(br)).ToList().AsReadOnly();
  36. public IEnumerator<Slot> GetEnumerator() => Slots.GetEnumerator();
  37. IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)Slots).GetEnumerator();
  38. #endregion Methods
  39. }
  40. }
  41. }