wyvern.lib.skills
Class BerserkSkill

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.kernel.commands.AbstractCommandable
              extended bywyvern.lib.classes.magic.Spell
                  extended bywyvern.lib.classes.magic.TimedSpell
                      extended bywyvern.lib.spells.Berserk
                          extended bywyvern.lib.skills.BerserkSkill
All Implemented Interfaces:
AddRemoveNotify, Broadcaster, Command, Commandable, Dispellable, GameObject, Hookable, HookCallback, MethodHookable, MutableProperty, PropertyList, RemoteAudio, Targetable, Timed

public class BerserkSkill
extends Berserk
implements Command, AddRemoveNotify, MutableProperty, HookCallback

Class that allows berserkers to enter a homicidal rage. Adds the "berserk" command. Also extends the Berserk spell, but makes it so that only the sk-berserk skill actually matters.

Version:
1.0, Feb 24, 2001
Author:
Kiz

Nested Class Summary
 
Nested classes inherited from class wyvern.lib.classes.magic.Spell
Spell.DamageVisitor, Spell.UsableReagentPredicate
 
Field Summary
static int BERSERK_DELAY
          15 minutes before you can berserk again.
 
Fields inherited from class wyvern.lib.spells.Berserk
bungle_, speed_, strength_, target_
 
Fields inherited from class wyvern.lib.classes.magic.TimedSpell
timer_
 
Fields inherited from class wyvern.lib.classes.magic.Spell
AIR, AIR_AND_DEATH, AIR_AND_LIFE, AIR_AND_MIND, AIR_AND_SPIRIT, ART_MANA_REDUCTIONS, bitmaps_, CONJURATION, damager_, DEATH, DEATH_AND_MIND, DEATH_AND_SPIRIT, EARTH, EARTH_AND_AIR, EARTH_AND_DEATH, EARTH_AND_LIFE, EARTH_AND_MIND, EARTH_AND_SPIRIT, ENCHANTMENT, EVOCATION, FIRE, FIRE_AND_AIR, FIRE_AND_DEATH, FIRE_AND_EARTH, FIRE_AND_LIFE, FIRE_AND_MIND, FIRE_AND_SPIRIT, FIRE_AND_WATER, INCANTATION, LIFE, LIFE_AND_DEATH, LIFE_AND_MIND, LIFE_AND_SPIRIT, MIND, MIND_AND_SPIRIT, SELF_DAMAGE_CHANCE, SPIRIT, WATER, WATER_AND_AIR, WATER_AND_DEATH, WATER_AND_EARTH, WATER_AND_LIFE, WATER_AND_MIND, WATER_AND_SPIRIT
 
Fields inherited from class wyvern.kernel.commands.AbstractCommandable
hookList_, queue_, started_
 
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
 
Fields inherited from interface wyvern.common.net.RemoteAudio
DEFAULT_ALERT_GAIN, DEFAULT_ALERT_REPEAT_DELAY, DEFAULT_ALERT_REPEATS, DEFAULT_GAIN, DEFAULT_REPEAT_DELAY, DEFAULT_REPEATS
 
Constructor Summary
BerserkSkill()
           
 
Method Summary
 java.lang.Object createClone()
          Produces a clone of the property for the caller.
 CommandEvent createEvent(CommandEvent initial)
          Creates the command event.
 boolean execute(CommandEvent event)
          Executes the event.
 int getLevel(int element)
          Ignore all the mage-skill ratings - all that matters is sk-berserk.
 long getRequiredWaitTime(Commandable agent)
          Returns the total time the agent has to wait between uses of the berserk skill.
 boolean goBerserk(CommandEvent event)
          Tries to go berserk.
 void hookEvent(java.lang.String hookName, CommandEvent event)
          Player died.
 long howLongSinceLastBerserk(Commandable agent)
          Returns the number of milliseconds that have passed since they last used the berserk skill.
 boolean knowsCommand(java.lang.String command)
          Returns true if we want to handle this command.
 void makeDispellable()
          Don't let it show up in agent's cast-list.
 void notifyAdd(PropertyList obj)
          Notifies the property that it's being added.
 void notifyRemove(PropertyList obj)
          Notifies the property that it's being removed.
 void removeEffects()
          Called by dispel() - instructs the subclass to remove its spell effects.
 boolean startSpell(Commandable agent)
          Starts us as a spell.
 java.lang.String toString()
          Returns the short (usually one-line) description of the object.
 
Methods inherited from class wyvern.lib.spells.Berserk
redoLoad, start
 
Methods inherited from class wyvern.lib.classes.magic.TimedSpell
dispel, killTimer, setTimer, timerExpired
 
Methods inherited from class wyvern.lib.classes.magic.Spell
addReagent, canDamageSelf, canEnter, canEnter, castingOnSelf, cloneSpell, consumeReagents, damageMonster, damageMonsters, destroy, ensureAI, ensureDirection, ensureReagents, findTargetObject, findTargetObject, fireDirection, fireLocation, getAgent, getAnimationFrames, getArt, getBlockingPredicate, getCastingDelay, getCommand, getDescString, getElement, getLevel, getLoreCost, getMagicItem, getPoints, getReagents, getRequiredMana, getSpeed, getSpellArgs, getSpellDescription, getSpellName, getTarget, getTargetName, getTargetPoint, initialize, isBlessed, isConjuration, isCursed, isEnchantment, isEvocation, isIncantation, isPotion, logUsage, reloadSpells, removeFromActiveListIfPresent, setAgent, setLevel, setMagicItem, setSpeed, setSpellArgs, setTarget, setTargetName, setTargetPoint, tellCaster
 
Methods inherited from class wyvern.kernel.commands.AbstractCommandable
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, command, commandNow, ensureEventQueue, fireMessageReceived, getAI, getCapName, getCombatQueue, getEncumbrance, getFiringPoint, getHookList, getHooks, getInventory, getName, getQueue, isCommandable, isStarted, isTelnet, message, message, message, pauseSound, playAlert, playAlert, playDefaultMusic, playPriorityMusic, playPriorityMusic, playSound, playSound, registerCommand, removeAttack, removeHook, removeMessageListener, removeMethodHook, resumeSound, runFailedPostHook, runMethodHook, runPostHook, runPreHook, sendPicture, sendPicture, setAI, setEncumbrance, setMusicGain, setName, setSoundGain, stop, stopAllSounds, stopMusic, stopSound, unregisterCommand
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, 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, groupString, inContainer, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, 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.GameObject
addContainerChangeListener, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, 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, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, 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.Broadcaster
broadcast, broadcast, broadcast, broadcast, broadcast
 

Field Detail

BERSERK_DELAY

public static final int BERSERK_DELAY
15 minutes before you can berserk again. Each point in the skill shaves 30 seconds off, so at skill level 20, it's 5 minutes between berserk sessions.

See Also:
Constant Field Values
Constructor Detail

BerserkSkill

public BerserkSkill()
Method Detail

notifyAdd

public void notifyAdd(PropertyList obj)
Notifies the property that it's being added.

Specified by:
notifyAdd in interface AddRemoveNotify
Parameters:
obj - the GameObject whose property list we're being added to

notifyRemove

public void notifyRemove(PropertyList obj)
Notifies the property that it's being removed.

Specified by:
notifyRemove in interface AddRemoveNotify
Parameters:
obj - the GameObject whose property list we're being removed from

knowsCommand

public boolean knowsCommand(java.lang.String command)
Returns true if we want to handle this command.

Specified by:
knowsCommand in interface Command
Parameters:
command - the command the player typed
Returns:
true if we're handling it

createEvent

public CommandEvent createEvent(CommandEvent initial)
Creates the command event.

Specified by:
createEvent in interface Command
Parameters:
initial - a "blank" CommandEvent containing only the command text and the agent who's performing the command. This initial event is created by the originator of the event (e.g. the AI or player's command preprocessor).
Returns:
a CommandEvent subclass encapsulating this command's execution parameters and state. It should copy in the fields from the passed-in event.

execute

public boolean execute(CommandEvent event)
Executes the event.

Specified by:
execute in interface Command
Parameters:
event - the event
Returns:
true if the event executed successfully

goBerserk

public boolean goBerserk(CommandEvent event)
Tries to go berserk.

Parameters:
event - the command event
Returns:
true if successful

howLongSinceLastBerserk

public long howLongSinceLastBerserk(Commandable agent)
Returns the number of milliseconds that have passed since they last used the berserk skill.


getRequiredWaitTime

public long getRequiredWaitTime(Commandable agent)
Returns the total time the agent has to wait between uses of the berserk skill.


startSpell

public boolean startSpell(Commandable agent)
Starts us as a spell. We reuse ourself over and over.


getLevel

public int getLevel(int element)
Ignore all the mage-skill ratings - all that matters is sk-berserk.


makeDispellable

public void makeDispellable()
Don't let it show up in agent's cast-list.

Overrides:
makeDispellable in class Spell

hookEvent

public void hookEvent(java.lang.String hookName,
                      CommandEvent event)
Player died. Dispel it. It's not in agent's cast-list if they use the skill, so PlayerImpl.burial() won't snuff it out.

Specified by:
hookEvent in interface HookCallback
Parameters:
hookName - the name of the hook, such as "movePreHook".
event - the CommandEvent encapsulating the event parameters

removeEffects

public void removeEffects()
Description copied from class: TimedSpell
Called by dispel() - instructs the subclass to remove its spell effects.

Overrides:
removeEffects in class Berserk

createClone

public java.lang.Object createClone()
Description copied from interface: MutableProperty
Produces a clone of the property for the caller. Note: it's called createClone, not makeClone, because GameObject already has a makeClone. Some GameObjects can be properties (e.g inventories) and we can't do overloaded methods based only on the return type.

Specified by:
createClone in interface MutableProperty

toString

public java.lang.String toString()
Description copied from class: MapObject
Returns the short (usually one-line) description of the object.

Overrides:
toString in class MapObject
Returns:
a short String describing this object. If the object represents a group of items, such as coins, the returned description will be a modified version of the description that includes quantity information.