Class Magic

java.lang.Object
dev.twilite.game.facade.Magic

public class Magic extends Object
Magic spellbook helpers backed by item parameters and live player state.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Spellbook families available through the magic tab.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    autocast(Spell spell, boolean defensiveCasting)
    Selects a spell for autocasting.
    static boolean
    Returns whether the current combat setup supports spell autocasting.
    static Spell
    Returns the currently autocasted spell, or null if none is selected.
    static boolean
    Returns whether the supplied spell is currently selected for autocasting.
    static boolean
    Returns whether any spell is currently selected for autocasting.
    static Magic.Book
    Returns the currently active spellbook.
    static void
    cast(Spell spell)
    Casts a spell from the current spellbook interface.
    static void
    cast(Spell spell, Interactable target)
    Casts a spell on an interactable target.
    static boolean
    castable(Spell spell)
    Returns whether the player currently has the runes and level required for spell.
    static boolean
    castable(Spell spell, int mainhand, int offhand)
    Returns whether the supplied equipment context has the runes and level required for spell.
    static boolean
    Returns whether autocast is set to defensive casting mode.
    static int
    Returns the available count for a rune, including combination runes, rune pouch, and equipment.
    static int
    runeCount(Rune rune, int mainhand, int offhand)
    Returns the available count for a rune using the supplied equipment context.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Magic

      public Magic()
  • Method Details

    • book

      public static Magic.Book book()
      Returns the currently active spellbook.
    • autocasting

      public static boolean autocasting()
      Returns whether any spell is currently selected for autocasting.
    • autocastable

      public static boolean autocastable()
      Returns whether the current combat setup supports spell autocasting.
    • defensiveCasting

      public static boolean defensiveCasting()
      Returns whether autocast is set to defensive casting mode.
    • autocast

      public static void autocast(Spell spell, boolean defensiveCasting)
      Selects a spell for autocasting.

      If the autocast interface is already open, this selects the spell from it. Otherwise, this opens the normal or defensive autocast selector and returns. The method does nothing when the requested spell and casting mode are already active, when the player lacks the required Magic level, or when the spell has no autocast component index or the current combat setup does not enable autocasting.

      Parameters:
      spell - spell to select for autocasting
      defensiveCasting - true to use defensive autocasting
    • autocasted

      public static boolean autocasted(Spell spell)
      Returns whether the supplied spell is currently selected for autocasting.
    • cast

      public static void cast(Spell spell)
      Casts a spell from the current spellbook interface.
      Parameters:
      spell - spell to cast
    • cast

      public static void cast(Spell spell, Interactable target)
      Casts a spell on an interactable target.
      Parameters:
      spell - spell to cast
      target - target to receive the selected spell action
    • autocasted

      public static Spell autocasted()
      Returns the currently autocasted spell, or null if none is selected.
    • castable

      public static boolean castable(Spell spell)
      Returns whether the player currently has the runes and level required for spell.
      Parameters:
      spell - spell to check
    • castable

      public static boolean castable(Spell spell, int mainhand, int offhand)
      Returns whether the supplied equipment context has the runes and level required for spell.
    • runeCount

      public static int runeCount(Rune rune)
      Returns the available count for a rune, including combination runes, rune pouch, and equipment.
    • runeCount

      public static int runeCount(Rune rune, int mainhand, int offhand)
      Returns the available count for a rune using the supplied equipment context.