Enum Spellbook

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Spellbook>

    public enum Spellbook
    extends java.lang.Enum<Spellbook>
    • Enum Constant Detail

      • STANDARD

        public static final Spellbook STANDARD
      • ANCIENT

        public static final Spellbook ANCIENT
      • ARCEUUS

        public static final Spellbook ARCEUUS
    • Method Detail

      • values

        public static Spellbook[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Spellbook c : Spellbook.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Spellbook valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getSpells

        public CastableSpell[] getSpells()
        Retrieves the array of spells associated with the current spellbook.

        Depending on the type of spellbook (e.g., LUNAR, STANDARD, ANCIENT, or ARCEUUS), this method initializes and returns an array of spells belonging to that specific spellbook. If the spellbook cannot be determined, an empty array is returned.

        If this method is called before the spells are initialized, it will populate the corresponding spell array based on the spellbook type and cache the result for subsequent calls.

        Returns:
        An array of CastableSpell objects representing the spells available in the current spellbook. If the spellbook is not recognized, an empty array of CastableSpell will be returned.
      • isOnStandardSpellbook

        public static boolean isOnStandardSpellbook()
      • isOnAncientSpellbook

        public static boolean isOnAncientSpellbook()
      • isOnLunarSpellbook

        public static boolean isOnLunarSpellbook()
      • isOnArceuusSpellbook

        public static boolean isOnArceuusSpellbook()
      • getCurrentSpellbook

        public static Spellbook getCurrentSpellbook()
        Retrieves the current spellbook being used in the game.

        The method determines the active spellbook by checking the corresponding game variable (varbit) value and matching it with the value of the enum constants defined in Spellbook.

        If no match is found, the STANDARD spellbook is returned by default.

        Returns:
        The active Spellbook instance, which represents the currently selected spellbook in the game. Defaults to STANDARD if no match is found.