Class Spell


public class Spell extends Object
Magic spell class.
Since:
2018-12-06
  • Field Details

    • name

      String name
      Name of the spell.
    • level

      int level
      Level of the spell.
    • range

      int range
      Range in inches (5-foot unit).
    • duration

      int duration
      Duration in turns (1-minute unit).
    • area

      Area of effect.
    • mode

      Mode of usage.
    • casting

      Game-sim casting formula.
  • Constructor Details

    • Spell

      Spell(String[] s)
      Constructor (from string descriptor).
  • Method Details

    • parseRange

      private static int parseRange(String s)
      Parse a range descriptor.
    • parseDuration

      private static int parseDuration(String s)
      Parse a duration descriptor.
    • parseMode

      private static Spell.Mode parseMode(String s)
      Parse a mode descriptor.
    • parseArea

      private static Spell.AreaOfEffect parseArea(String s)
      Parse area of effect descriptor.
    • parseShape

      private static Spell.Shape parseShape(String s)
      Parse area shape from descriptor.
    • parseSize

      private static int parseSize(String s)
      Parse area size from descriptor.
    • getName

      public String getName()
      Get the name.
    • getLevel

      public int getLevel()
      Get the level.
    • getRange

      public int getRange()
      Get the range.
    • getDuration

      public int getDuration()
      Get the duration.
    • getShape

      public Spell.Shape getShape()
      Get the shape.
    • getSize

      public int getSize()
      Get the size.
    • getMode

      public Spell.Mode getMode()
      Get the mode.
    • getMaxTargetsInArea

      public int getMaxTargetsInArea()
      Get max targets in area of spell. Assumes all targets are man-sized (1 inch space).
    • isAreaEffect

      public boolean isAreaEffect()
      Is this spell an area-effect type?
    • setCasting

      public void setCasting(SpellCasting.Casting c)
      Set the game-sim casting formula, if available.
    • isCastable

      public boolean isCastable()
      Does this spell have a casting formula usable in the sim?
    • getMaxTargetNum

      public int getMaxTargetNum()
      Expose casting max targets number.
    • isThreatTo

      public boolean isThreatTo(Monster monster)
      Expose is-threat to monster check.
    • cast

      public void cast(Monster caster, Party friends, Party enemies)
      Cast this spell to help against enemy party.
    • toString

      public String toString()
      Identify this object as a string.
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)
      Main test function.