wyvern.lib.classes.weapons
Class Missile

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.lib.classes.weapons.WeaponImpl
              extended bywyvern.lib.classes.weapons.Missile
All Implemented Interfaces:
Applyable, Attack, Broadcaster, Damageable, GameObject, MethodHookable, Movable, PickupInterest, PropertyList, Readyable, Weapon
Direct Known Subclasses:
Arrow, BlowgunDart, Bolt, SlingStone

public class Missile
extends WeaponImpl
implements Movable

This is the class used for arrows, darts, sling stones, and any other object that flies through the air.

Version:
1.0, Jun 10, 1998
Author:
Steve Yegge

Field Summary
protected  Weapon rangeWeapon_
          The weapon that fired this missile.
protected  java.lang.String[] skills_
           
 
Fields inherited from class wyvern.lib.classes.weapons.WeaponImpl
DEFAULT_WEAPON_HP, wcs_
 
Fields inherited from class wyvern.kernel.maps.MapObject
IN_MAP_EDITOR, listenerList_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
Missile()
           
 
Method Summary
 boolean canEnter(GameMap map, Point loc)
          Returns true if the missile can enter the specified square.
 CommandEvent checkHit(Monster m)
          Returns true if we should hit the specified monster.
 void ensureAI()
          We have no AI.
 Commandable getAgent()
          Returns the agent who fired this missile.
 Predicate getBlockingPredicate()
          Gets a Predicate used to decide whether the missile is blocked by a given object.
 java.lang.String getName()
          Returns the name of this missile type, such as "arrow".
 java.lang.String getPluralName()
          Returns the name + "s": subclasses need to override if they have a plural name that doesn't fit this form
 Weapon getRangeWeapon()
          Returns the range-weapon that fired this missile, if any.
 int getToHit()
          Returns the base chance to hit for the weapon, against all attackers.
 java.lang.String getWeaponSkill()
          Returns weapon-skill for this weapon.
 void initialize()
          Initializes the object's default properties.
 void setAgent(Commandable agent)
          Sets the agent who fired this missile.
 void setRangeWeapon(Weapon weapon)
          Sets the range weapon used to fire this missile.
 
Methods inherited from class wyvern.lib.classes.weapons.WeaponImpl
addSlayWC, adjustHP, apply, canReady, canUnready, checkDrop, destroy, didDamage, dropped, forceUnwield, getDescription, getHP, getMaxHP, getRequiredSlots, getWC, hitMonster, isReadied, isWielded, kill, notifyReady, notifyUnready, pickedUp, recomputeWCs, setDefaultHP, setShowAttackerMessage, setToHit, setWC, setWielded, shouldStop, showAttackerMessage, toString, tryGettingCaught
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMethodHook, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, curse, cycleFrame, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, 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, groupString, inContainer, initLocs, 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, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMethodHook, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, runMethodHook, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDefaultBitmap, setDefaultCategory, setDefaultDesc, setDefaultImage, setDefaultIntProperty, setDefaultLayer, setDefaultMaterial, setDefaultProperty, setDefaultShortDesc, setDirection, setImage, setImage, setLayer, setLocations, setMap, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, updateMapLocation
 
Methods inherited from class wyvern.kernel.properties.PList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wyvern.lib.properties.Movable
shouldStop
 
Methods inherited from interface wyvern.lib.GameObject
addContainerChangeListener, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, curse, cycleFrame, externalize, getAlpha, getAppearance, getArchetype, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, 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, 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
 

Field Detail

skills_

protected java.lang.String[] skills_

rangeWeapon_

protected Weapon rangeWeapon_
The weapon that fired this missile. Null if it was thrown or wielded.

Constructor Detail

Missile

public Missile()
Method Detail

initialize

public void initialize()
Description copied from interface: GameObject
Initializes the object's default properties. Any GameObject implementation that wishes to initialize itself should do so here, rather than in the constructor. This is because nearly all game objects inherit from an archetype, and the archetype parent pointer isn't set until the object's constructor finishes. This is a good place to add any class-default properties for an object - properties that the object gets regardless of which archetype it inherits from. WARNING: don't forget to call the superclass' initialize() method, or the object may not function properly. For instance, it won't become animated even if it specifies animation parameters in the archetype.

Specified by:
initialize in interface GameObject
Overrides:
initialize in class WeaponImpl

ensureAI

public void ensureAI()
We have no AI.


getName

public java.lang.String getName()
Returns the name of this missile type, such as "arrow".

Returns:
a human-readable name; defaults to the short description on the object.

getPluralName

public java.lang.String getPluralName()
Returns the name + "s": subclasses need to override if they have a plural name that doesn't fit this form

Returns:
the plural name of the missile type, such as "arrows"

canEnter

public boolean canEnter(GameMap map,
                        Point loc)
Returns true if the missile can enter the specified square. Pretty much only stopped by blocking objects.

Specified by:
canEnter in interface GameObject
Overrides:
canEnter in class MapObject

checkHit

public CommandEvent checkHit(Monster m)
Returns true if we should hit the specified monster.

Overrides:
checkHit in class WeaponImpl
Parameters:
m - the monster to shoot at
Returns:
a HitCommand.HitEvent if we hit, to enqueue into the monster's queue. Returns null if we missed.

getBlockingPredicate

public Predicate getBlockingPredicate()
Gets a Predicate used to decide whether the missile is blocked by a given object. Defaults to a BlocksSpellPredicate.

Returns:
the Predicate used by the canEnter method

getAgent

public Commandable getAgent()
Returns the agent who fired this missile.


setAgent

public void setAgent(Commandable agent)
Sets the agent who fired this missile.


getWeaponSkill

public java.lang.String getWeaponSkill()
Returns weapon-skill for this weapon.

Specified by:
getWeaponSkill in interface Attack
Returns:
sk-range if we're in flight from being fired, or null if not

getRangeWeapon

public Weapon getRangeWeapon()
Returns the range-weapon that fired this missile, if any.

Returns:
the weapon, if one was used, or null if none

setRangeWeapon

public void setRangeWeapon(Weapon weapon)
Sets the range weapon used to fire this missile. Set by the firing range weapon, typically, so the combat system code can add in any bonuses from the weapon.


getToHit

public int getToHit()
Returns the base chance to hit for the weapon, against all attackers. Includes the to-hit from the bow used to fire the missile.

Specified by:
getToHit in interface Attack
Overrides:
getToHit in class WeaponImpl
Returns:
the chance to hit (missile + bow)