Class SlotActivatedItem

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

public abstract class SlotActivatedItem extends Item
An item that can be activated by being held in specific slots.
Author:
AntumDeluge
  • Field Details

    • activated

      protected boolean activated
      The active state of the item initialized as deactivated.
  • Constructor Details

    • SlotActivatedItem

      public SlotActivatedItem(String name, String clazz, String subclass, Map<String,​String> attributes)
      Default constructor.
      Parameters:
      name - Item's name
      clazz - Item's class or type
      subclass - Item's subclass
      attributes - Attributes available to this item
    • SlotActivatedItem

      public SlotActivatedItem(Item item)
      Copy constructor
      Parameters:
      item - Item to be copied
  • Method Details

    • initializeActiveSlotsList

      public void initializeActiveSlotsList(List<String> list)
      Create a list of slots in which this item can be activated while equipped.
      Overrides:
      initializeActiveSlotsList in class Item
      Parameters:
      list - List of slot active slot names
    • initiateActiveSlotsList

      public void initiateActiveSlotsList(List<String> slotList)
      Fill the list of active slots.
      Parameters:
      slotList - List of slots in which item can be activated
    • onEquipped

      public boolean onEquipped(RPEntity owner, String slot)
      Action to take when item is equipped. If successfully equipped item's activation state is set to true.
      Overrides:
      onEquipped in class Item
      Parameters:
      owner - entity equipping the item
      slot - slot where the item is equipped
      Returns:
      unknown, see the note above
    • onUnequipped

      public boolean onUnequipped()
      Action to take when item is un-equipped. If successfully un-equipped item's activation state is set to false.
      Overrides:
      onUnequipped in class Item
      Returns:
      needs documenting
    • canActivate

      protected boolean canActivate()
      Checks the activation state of the item for activation.
      Returns:
      true if item is not currently activated
    • canDeactivate

      protected boolean canDeactivate()
      Checks the activation state of the item for deactivation.
      Returns:
      true if item is currently activated
    • isActivated

      public boolean isActivated()
      Tests whether the item is currently activated.
      Returns:
      Item's activation state
    • isActiveSlot

      protected boolean isActiveSlot(String slot)
      Tests whether the item can be activated in specified slot.
      Parameters:
      slot - Slot to be tested
      Returns:
      true if slot name is found in active slot list
    • onActivate

      protected boolean onActivate()
      Actions to take when equipped. Should return true on successful activation.
      Returns:
      Activated state
    • onDeactivate

      protected boolean onDeactivate()
      Actions to take when Unequipped. Should return false on successful deactivation.
      Returns:
      Non-activated state
    • toString

      public String toString()
      Description copied from class: RPObject
      This method returns a String that represent the object
      Overrides:
      toString in class Item
      Returns:
      a string representing the object.