|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.properties.PList wyvern.kernel.maps.MapObject wyvern.kernel.commands.AbstractCommandable wyvern.lib.classes.magic.Spell wyvern.lib.classes.magic.BoltSpell
Generic, parameterizable bolt/ray spell. Can travel any cardinal direction. Parameters are "speed" (in millis), "duration" (number turns it propagates) and "length" (max length of the bolt).
Nested Class Summary |
Nested classes inherited from class wyvern.lib.classes.magic.Spell |
Spell.DamageVisitor, Spell.UsableReagentPredicate |
Field Summary | |
static int |
DEFAULT_BOLT_DURATION
Number of turns the bolt will propagate. |
static int |
DEFAULT_BOLT_MAX_LENGTH
Default length of the bolt if it encounters no obstructions. |
static int |
DEFAULT_BOLT_SPEED
Default rate (in millis) at which the bolt propagates. |
static java.lang.Object |
DUMMY_LIGHT
|
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 | |
BoltSpell()
|
Method Summary | |
void |
addLight(Point p)
Adds a light source to the map for one of our locations. |
void |
bounced(GameObject blocker,
int x,
int y)
Called if the spell bounces off of a blocking object. |
protected boolean |
canPutInMap(GameMap map,
int x,
int y)
Returns true if the spell can be placed in the passed map at the specified location. |
protected void |
clearDamageCache()
Resets the cache of monsters we've damaged this turn. |
protected void |
clearVariables()
Nulls out all instance variables. |
protected void |
computeAngle()
Figures out the angle the bolt is travelling at (basically, dX and dY). |
CommandEvent |
createEvent(CommandEvent initial)
Creates an event to propagate the bolt spell. |
void |
damageMonster(Damageable obj,
Spell spell)
Makes sure we only damage a monster one time per propagation cycle, regardless of how big it is. |
void |
damageMonsters()
Damages all monsters in areas we occupy. |
protected boolean |
determineMap()
Figures out which map we're supposed to be in, and where. |
void |
dispel()
Shuts off the spell. |
boolean |
doesBounce()
Returns whether or not the bolt is set to bounce off of things. |
void |
dumpList()
Lists all occupied squares for debugging. |
boolean |
execute(CommandEvent event)
Propagates the bolt. |
int |
getAge()
Returns the current age of the bolt. |
Rectangle |
getBounds()
Returns the bounds of the spell. |
Command |
getCommand(CommandEvent event)
Handle our "bolt" command ourselves. |
int |
getDuration()
Returns the number of turns the bolt will propagate. |
int[] |
getImageDescriptors()
Returns the appearance of the spell. |
java.util.List |
getLocations()
Returns the locations occupied by this spell. |
int |
getMaxLength()
Returns the max length for the bolt. |
java.util.Set |
getPoints()
Returns the locations occupied by this spell. |
int |
getSpeed()
Returns the speed at which this bolt propagates. |
int |
getTile(int x,
int y)
Returns the image number to use at (x, y) |
void |
hookEvent(java.lang.String hookname,
CommandEvent event)
When one of the concentration-hooks is called, stops the spell. |
void |
initialize()
Adds class-default properties. |
boolean |
knowsCommand(java.lang.String cmd)
Returns true if this Command wants to handle the command. |
protected Point |
nextPoint()
Figures out the next point in the bolt's path. |
void |
propagate()
Propagates the bolt along its path. |
void |
removeLight(Point p)
Removes a light we previously added to the map. |
void |
setAnimated()
Disables the standard AnimationParams behavior. |
void |
setBounce(boolean bounce)
Sets whether or not the bolt bounces when blocked |
void |
setDuration(int duration)
Sets the number of turns this bolt will propagate. |
void |
setLength(int maxlen)
Sets the max length for the bolt. |
void |
setMaxLength(int maxlen)
Sets the length of the bolt. |
void |
setSpeed(int speed)
Sets the propagation speed. |
protected int |
sign(int s)
Returns the sign of the integer value passed. |
void |
start()
Sets the spell in the map and gets it going. |
protected void |
startConcentrationHooks()
Sets up the hook callbacks so that the spell stops if you stop concentrating. |
protected void |
stopConcentrationHooks()
Sets up the hook callbacks for spell concentration. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface wyvern.lib.Broadcaster |
broadcast, broadcast, broadcast, broadcast, broadcast |
Field Detail |
public static final int DEFAULT_BOLT_SPEED
public static final int DEFAULT_BOLT_MAX_LENGTH
public static final int DEFAULT_BOLT_DURATION
The property name for this value is "duration".
public static final java.lang.Object DUMMY_LIGHT
Constructor Detail |
public BoltSpell()
Method Detail |
public void initialize()
initialize
in interface GameObject
initialize
in class Spell
public void start()
start
in interface Commandable
start
in class Spell
protected void startConcentrationHooks()
protected void stopConcentrationHooks()
public void hookEvent(java.lang.String hookname, CommandEvent event)
hookEvent
in interface HookCallback
hookname
- the name of the hook, such as "movePreHook".event
- the CommandEvent encapsulating the event parametersprotected boolean determineMap()
protected boolean canPutInMap(GameMap map, int x, int y)
protected void computeAngle()
protected int sign(int s)
protected Point nextPoint()
public void propagate()
public void dumpList()
public void bounced(GameObject blocker, int x, int y)
public void dispel()
dispel
in interface Dispellable
dispel
in class Spell
protected void clearVariables()
public void damageMonsters()
damageMonsters
in class Spell
protected void clearDamageCache()
public void damageMonster(Damageable obj, Spell spell)
damageMonster
in class Spell
obj
- the monster to damagespell
- the spell doing the damage (in case this
needs to be used as a utility by another spell). If the
spell has the property "show-defender-msg", the DamageEvent
generated will show normal damage-messages (depending on
the damage type) to the monster; otherwise it will be silent.public void setSpeed(int speed)
setSpeed
in class Spell
speed
- the speed (in millis)public int getSpeed()
getSpeed
in class Spell
public void setDuration(int duration)
duration
- the number of times the bolt will
call propagate()public int getDuration()
public int getAge()
public boolean doesBounce()
public void setMaxLength(int maxlen)
maxlen
- the maximum distance to travel.public void setLength(int maxlen)
maxlen
- the maximum distance to travel.public int getMaxLength()
public int[] getImageDescriptors()
getImageDescriptors
in interface GameObject
getImageDescriptors
in class MapObject
public java.util.List getLocations()
getLocations
in interface GameObject
getLocations
in class MapObject
public java.util.Set getPoints()
getPoints
in class Spell
public void setBounce(boolean bounce)
public int getTile(int x, int y)
getTile
in interface GameObject
getTile
in class MapObject
x
- map x coordinatey
- map y coordinatepublic Rectangle getBounds()
getBounds
in interface GameObject
getBounds
in class MapObject
public void setAnimated()
public boolean knowsCommand(java.lang.String cmd)
Command
This method exists to allow more than one game object to implement the same command verb, but with different expected arguments.
If two objects register for the same command and the same arguments, the object that was registered most recently gets to handle at the command.
knowsCommand
in interface Command
cmd
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
createEvent
in interface Command
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).
public boolean execute(CommandEvent event)
execute
in interface Command
event
- the propagation event
public Command getCommand(CommandEvent event)
getCommand
in interface Commandable
getCommand
in class Spell
public void addLight(Point p)
public void removeLight(Point p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |