|
||||||||||
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.ConeSpell
The class used for all spells that propagate in a cone-shape.
Cones may be aimed in any of 8 directions (NSEW + diagonals), and may have any angular spread up to a practical maximum of perhaps 150 degrees.
A cone makes an isoceles triangle whose apex is the origin of the spell. The length of the cone is the length of the line segment that bisects it, from apex to base. The ratio of the base length to the cone length determines how "fat" the cone is (i.e. its angle). A cone spell has the following properties to parameterize its behavior:
Nested Class Summary |
Nested classes inherited from class wyvern.lib.classes.magic.Spell |
Spell.DamageVisitor, Spell.UsableReagentPredicate |
Field Summary | |
static int |
DEFAULT_CONE_FANOUT
A cone makes an isoceles triangle. |
static int |
DEFAULT_CONE_LENGTH
This is equal to the height of the isoceles triangle made by the cone, or the distance from the apex to the base side. |
static int |
DEFAULT_CONE_SPEED
This is the rate (in millis) at which the cone propagates. |
static int |
DEFAULT_DURATION
This is the length of the rays that emanate from the cone apex. |
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 | |
ConeSpell()
|
Method Summary | |
protected void |
clearDamageCache()
Resets the cache of monsters we've damaged this turn. |
protected void |
computeEndpoints()
Figures out the endpoints of the cone's base, using the cone's direction and fanout. |
void |
damageMonster(Damageable obj,
Spell spell)
Damages the monster, but only if we haven't |
void |
damageMonsters()
Damages all monsters in areas we occupy. |
void |
dispel()
Shuts off the spell. |
Art |
getArt()
ConeSpells are all Evocations. |
protected GameObject |
getBlocker(Point p)
Returns the blocking object or null |
Predicate |
getBlockingPredicate()
Gets the Predicate to use for determining what objects block the spell propagation. |
int |
getConeLength()
Returns the total length of the cone. |
java.lang.String |
getDamageType()
Return the damage type specifier for this spell. |
int |
getFanout()
Returns the amount of "fanout" from the center of the base. |
int[] |
getImageDescriptors()
Returns the appearance of the spell, for drawing it to the client. |
GameMap |
getMap()
Return the map we're active in. |
int |
getMaxSwaths()
Returns the total swaths that should be produced for this cone. |
int |
getNumSwaths()
Returns the number of swaths that have been produced so far. |
java.util.Set |
getPoints()
Returns the set of all the points the spell currently occupies. |
int |
getSpeed()
Returns the propagation speed (in millis) of the spell. |
java.util.LinkedList |
getSwaths()
Returns the list of our current swaths. |
int |
getTile(int xloc,
int yloc)
Overrides MapObject.getTile(). |
void |
hookEvent(java.lang.String hookname,
CommandEvent event)
Caster has broken concentration, so stop adding swaths. |
protected void |
initCone(Point apex)
Sets up initial cone parameters. |
protected void |
initEdgeLists()
Sets up the 2 edges of the triangle. |
void |
initialize()
Sets the default properties for this kind of spell. |
protected boolean |
isBlocked(Point p)
Returns true if the specified point blocks our advance. |
protected void |
moveCone()
Propagates the cone by another "turn". |
void |
newSwath()
Creates a new swath at the apex. |
void |
removeFromMap(Point p)
Removes a reference to the cone spell from the map. |
void |
setAnimated(boolean animate)
Overrides MapObject.setAnimated and doesn't put on the heartbeat list. |
void |
setConeLength(int length)
Sets the cone-length for the spell. |
void |
setDuration(int duration)
Sets the duration for the spell - i.e., the number of "swaths" to generate. |
void |
setFanout(int fanout)
Sets the fanout for the spell. |
void |
setMap(GameMap map,
int x,
int y)
Sets the start location. |
void |
setMaxSwaths(int x)
Change the maximum number of swaths in mid-spell. |
void |
setSpeed(int speed)
Sets the propagation speed for the spell, in millis. |
void |
start()
Starts the spell. |
protected void |
startConcentrationHooks()
Adds hooks to stop spell if caster breaks concentration. |
protected void |
startTimer()
Starts the propagation timer. |
void |
stop()
"Stops" the monster by destroying its event queue. |
protected void |
stopConcentrationHooks()
Removes hooks to stop spell if caster breaks concentration. |
void |
stopTimer()
Stops the current propagation timer. |
void |
timerExpired()
Called by TimerManager to notify object that timer has expired. |
Methods inherited from class wyvern.lib.classes.magic.Spell |
addReagent, canDamageSelf, canEnter, canEnter, castingOnSelf, cloneSpell, consumeReagents, destroy, ensureAI, ensureDirection, ensureReagents, findTargetObject, findTargetObject, fireDirection, fireLocation, getAgent, getAnimationFrames, getCastingDelay, getCommand, getDescString, getElement, getLevel, getLoreCost, getMagicItem, getReagents, getRequiredMana, getSpellArgs, getSpellDescription, getSpellName, getTarget, getTargetName, getTargetPoint, isBlessed, isConjuration, isCursed, isEnchantment, isEvocation, isIncantation, isPotion, logUsage, makeDispellable, reloadSpells, removeFromActiveListIfPresent, setAgent, setLevel, setMagicItem, 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, 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_CONE_FANOUT
The property name for this value is "fanout".
public static final int DEFAULT_CONE_LENGTH
The property name for this value is "cone-length".
public static final int DEFAULT_CONE_SPEED
The property name for this value is "speed".
public static final int DEFAULT_DURATION
The property name for this value is "duration".
Constructor Detail |
public ConeSpell()
Method Detail |
public Art getArt()
getArt
in class Spell
public void initialize()
initialize
in interface GameObject
initialize
in class Spell
public void setMap(GameMap map, int x, int y)
setMap
in interface GameObject
setMap
in class MapObject
map
- the mapx
- x map locationy
- y map locationpublic GameMap getMap()
getMap
in interface GameObject
getMap
in class MapObject
public int[] getImageDescriptors()
Many of the objects in the game are rectangular and have a single bitmap that covers all the map locations they occupy. For this reason, MapObject.getImageDescriptors() assumes the object is rectangular (to save most objects a bunch of work), but spells and the like need to override it. If exploding, we return a list of bitmaps to draw, one for each location the spell occupies. (Every object is asked only once for its appearance, NOT once for every time it's found in the map. This is part of the design for making it easy in the general case).
getImageDescriptors
in interface GameObject
getImageDescriptors
in class MapObject
public int getTile(int xloc, int yloc)
getTile
in interface GameObject
getTile
in class MapObject
xloc
- map x locationyloc
- map y location
public void start()
The spell registers hooks with the caster for move, fire, cast, and some others. If you put a "no-conc" property on the spell before starting it, it'll skip adding the hooks.
start
in interface Commandable
start
in class Spell
public void stop()
Commandable
stop
in interface Commandable
stop
in class AbstractCommandable
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 parameterspublic void dispel()
dispel
in interface Dispellable
dispel
in class Spell
protected void startTimer()
public void stopTimer()
public void timerExpired()
Timed
timerExpired
in interface Timed
protected void moveCone()
protected void initCone(Point apex)
apex
- the point where the cone originatesprotected void computeEndpoints()
protected void initEdgeLists()
public void removeFromMap(Point p)
p
- the point at which we need to remove the referenceprotected GameObject getBlocker(Point p)
protected boolean isBlocked(Point p)
public void newSwath()
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 setMaxSwaths(int x)
public java.lang.String getDamageType()
public int getSpeed()
getSpeed
in class Spell
public Predicate getBlockingPredicate()
getBlockingPredicate
in class Spell
BlocksSpellPredicate
public int getConeLength()
public void setConeLength(int length)
public void setSpeed(int speed)
setSpeed
in class Spell
speed
- the new speed in millispublic void setDuration(int duration)
public void setFanout(int fanout)
public int getFanout()
public int getNumSwaths()
public int getMaxSwaths()
public java.util.LinkedList getSwaths()
public java.util.Set getPoints()
getPoints
in class Spell
public void setAnimated(boolean animate)
setAnimated
in interface GameObject
setAnimated
in class MapObject
animate
- true to animate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |