Class SlotActivatedItem
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.PassiveEntity
games.stendhal.server.entity.item.Item
games.stendhal.server.entity.item.SlotActivatedItem
- All Implemented Interfaces:
EquipListener,TurnListener,UseListener,Killer,Cloneable,Iterable<String>,Serializable
- Direct Known Subclasses:
StatusResistantItem
An item that can be activated by being held in specific slots.
- Author:
- AntumDeluge
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanThe active state of the item initialized as deactivated.Fields inherited from class games.stendhal.server.entity.item.Item
DEGRADATION_TIMEOUTFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanChecks the activation state of the item for activation.protected booleanChecks the activation state of the item for deactivation.voidinitializeActiveSlotsList(List<String> list)Create a list of slots in which this item can be activated while equipped.voidinitiateActiveSlotsList(List<String> slotList)Fill the list of active slots.booleanTests whether the item is currently activated.protected booleanisActiveSlot(String slot)Tests whether the item can be activated in specified slot.protected booleanActions to take when equipped.protected booleanActions to take when Unequipped.booleanonEquipped(RPEntity owner, String slot)Action to take when item is equipped.booleanAction to take when item is un-equipped.toString()This method returns a String that represent the objectMethods inherited from class games.stendhal.server.entity.item.Item
autobind, canBeEquippedIn, describe, deteriorate, deteriorate, generateRPClass, getAttack, getAttackRate, getAttackRate, getBoundTo, getDamageType, getDefaultAttackRate, getDefense, getDescriptionName, getDeterioration, getInfoString, getItemClass, getItemSubclass, getMinLevel, getName, getPlantGrower, getPossibleSlots, getQuantity, getRangedAttack, getSusceptibility, getTitle, getWeaponType, initializeStatusResistancesList, isBound, isFromCorpse, isOfClass, isPersistent, isUndroppableOnDeath, onPickedUp, onPutOnGround, onPutOnGround, onRemoveFromGround, onTurnReached, onUsed, removeFromWorld, removeOne, repair, setBoundTo, setDamageType, setEquipableSlots, setFromCorpse, setInfoString, setPersistent, setPlantGrower, setSusceptibilities, setUndroppableOnDeath, setUseBehaviorMethods inherited from class games.stendhal.server.entity.Entity
getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onAdded, onMoved, onRemoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped, updateMethods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, equals, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hashCode, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, size, slots, slotsIterator, store, unhide, unstore, writeObject, writeObject, writeToJsonMethods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlotsMethods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
activated
protected boolean activatedThe 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 nameclazz- Item's class or typesubclass- Item's subclassattributes- Attributes available to this item
-
SlotActivatedItem
Copy constructor- Parameters:
item- Item to be copied
-
-
Method Details
-
initializeActiveSlotsList
Create a list of slots in which this item can be activated while equipped.- Overrides:
initializeActiveSlotsListin classItem- Parameters:
list- List of slot active slot names
-
initiateActiveSlotsList
Fill the list of active slots.- Parameters:
slotList- List of slots in which item can be activated
-
onEquipped
Action to take when item is equipped. If successfully equipped item's activation state is set to true.- Overrides:
onEquippedin classItem- Parameters:
owner- entity equipping the itemslot- 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:
onUnequippedin classItem- 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
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
Description copied from class:RPObjectThis method returns a String that represent the object
-