wyvern.lib
Interface Weapon

All Superinterfaces:
Attack, Broadcaster, Damageable, GameObject, MethodHookable, Movable, PropertyList, Readyable
All Known Implementing Classes:
WeaponImpl

public interface Weapon
extends GameObject, Attack, Damageable, Readyable, Movable

Wieldable weapon interface. The three primary classes that derive from Weapon are MeleeWeapon, RangeWeapon and HurledWeapon.

Version:
1.0, Nov 10, 2000
Author:
Steve Yegge

Field Summary
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Method Summary
 void forceUnwield()
          Forcibly unwields the weapon, even if it's cursed.
 java.lang.Class[] getRequiredSlots()
          Returns a list of the slots that this armor requires in order to be worn.
 boolean isWielded()
          Returns true if the weapon has the "wielded" property
 boolean setWielded(boolean wielded, Commandable agent)
          Notifies the weapon it's being wielded.
 
Methods inherited from interface wyvern.lib.GameObject
addContainerChangeListener, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, destroy, externalize, getAlpha, getAppearance, getArchetype, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getTile, getValue, getWeight, inContainer, initialize, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDirection, setImage, setImage, setLayer, setLocations, setMap, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport
 
Methods inherited from interface wyvern.lib.PropertyList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, getDoubleProperty, getInheritedProperty, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 
Methods inherited from interface wyvern.lib.MethodHookable
addMethodHook, removeMethodHook, runMethodHook
 
Methods inherited from interface wyvern.lib.Broadcaster
broadcast, broadcast, broadcast, broadcast, broadcast
 
Methods inherited from interface wyvern.lib.Attack
didDamage, getToHit, getWC, getWeaponSkill, recomputeWCs, setShowAttackerMessage, setToHit, setWC, showAttackerMessage
 
Methods inherited from interface wyvern.lib.properties.Damageable
adjustHP, getHP, getMaxHP, kill
 
Methods inherited from interface wyvern.lib.properties.Readyable
canReady, canUnready, isReadied, notifyReady, notifyUnready
 
Methods inherited from interface wyvern.lib.properties.Movable
shouldStop
 

Method Detail

setWielded

public boolean setWielded(boolean wielded,
                          Commandable agent)
Notifies the weapon it's being wielded.

NOTE: don't call this to try to wield a weapon. You should command the agent to wield the weapon - this will invoke the WieldCommand and make sure the agent has enough body parts available to wield the weapon. This setWielded() function will be called automatically by the WieldCommand. Don't use it to unwield a weapon either - use forceUnwield().

This method runs a method hook called "setWielded". It passes the wielder as the data parameter. You can call isWielded() on the weapon in the method hook to see if it was being wielded or unwielded. If isWielded() returns false, it was being unwielded. The setWielded method-hook is run *after* this method executes, right before the return statement, so all the bonuses are already applied.

Parameters:
wielded - true if it's wielded, else false
Returns:
true if the weapon is OK with being wielded or unwielded. If false, the weapon should consider issuing a message to the agent about why the operation failed.

isWielded

public boolean isWielded()
Returns true if the weapon has the "wielded" property

Returns:
true if the weapon is being wielded

getRequiredSlots

public java.lang.Class[] getRequiredSlots()
Returns a list of the slots that this armor requires in order to be worn. Usually the list has only one slot: a HoldingSlot. Weapons can override this method to require more (or different) slots.

Returns:
a Class[] containing references to the ItemSlot classes required to wield the weapon.

forceUnwield

public void forceUnwield()
Forcibly unwields the weapon, even if it's cursed. This method just calls WieldCommand.forceUnwield() on the agent currently wielding the weapon. Does nothing if not wielded.