Class TimedStackableItem

All Implemented Interfaces:
EquipListener, TurnListener, UseListener, Stackable<StackableItem>, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
TimedInvisibility

public abstract class TimedStackableItem extends StackableItem
Abstract base class for a stackable timed item. Extend this class and implement methods useItem(Player) and itemFinished(Player).
Author:
johnnnny
  • Constructor Details

    • TimedStackableItem

      public TimedStackableItem(String name, String clazz, String subclass, Map<String,​String> attributes)
      Creates a TimedItem.
      Parameters:
      name -
      clazz -
      subclass -
      attributes -
    • TimedStackableItem

      public TimedStackableItem(TimedStackableItem item)
      copy constructor.
      Parameters:
      item - item to copy
  • Method Details

    • onUsed

      public boolean onUsed(RPEntity user)
      Description copied from interface: UseListener
      Invoked when the object is used.
      Specified by:
      onUsed in interface UseListener
      Overrides:
      onUsed in class Item
      Parameters:
      user - the RPEntity who uses the object
      Returns:
      true if successful
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Description copied from interface: TurnListener
      This method is called when the turn number is reached.
      Specified by:
      onTurnReached in interface TurnListener
      Overrides:
      onTurnReached in class Item
      Parameters:
      currentTurn - current turn number
    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class Item
      Returns:
      description from the players point of view
    • getAmount

      public int getAmount()
      Get the length of the timed event in turns.
      Returns:
      length in turns
    • useItem

      public abstract boolean useItem(Player player)
      Called when the player uses the item. Implement this in a subclass.
      Parameters:
      player -
      Returns:
      true if the usage is successful
    • itemFinished

      public abstract void itemFinished(Player player)
      Called when the used item is finished. Implement this in a subclass.
      Parameters:
      player -