|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.CastCommand
Handles casting spells.
Method Summary | |
void |
addCommands(java.util.Map commands,
CommandList list)
Tells the Command to add the commands that it wants to implement into the passed data structure. |
boolean |
adjustCasterMana(CastEvent event)
Deducts the appropriate amount of mana. |
CommandEvent |
createEvent(CommandEvent initial)
Creates the command event for the "cast" command. |
boolean |
dispel(CastEvent event)
Dispels a spell you've cast. |
boolean |
execute(CommandEvent ev)
Implements Command.execute() |
static CastCommand |
getImpl()
|
boolean |
isNoSpellsArea(CastEvent event)
Checks whether it's OK to cast the spell in this location. |
boolean |
knowsCommand(java.lang.String command)
Returns true if this Command wants to handle the command. |
boolean |
knowsSpell(Commandable agent,
java.lang.String spell)
|
boolean |
reagents(CastEvent event)
Lists the reagents for a particular spell. |
boolean |
showActiveSpells(CommandEvent event)
Displays to the user a list of the spells they have active. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static CastCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
BuiltInCommand
addCommands
in interface BuiltInCommand
commands
- a Map whose keys are commands, and whose values
are Commands that handle those commands.list
- the CommandList the Command is being added to.public boolean knowsCommand(java.lang.String command)
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
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
The command supports the following syntax:
castYou can specify a direction to cast it, a specific map position to cast it on/at (e. 10 -8), or "on/at" at target. "on" and "at" are currently synonymous.[dir | x y | [on|at ] | [with-args ]]
If you specify "with-args", the remainder of the argument string is passed to the spell using setSpellArgs(). Examples:
cast knock cast fireball north cast earth wall 17 10 cast polymorph other at orc cast detect magic on gray stone cast magic mouth with-args Abandon All Hope Ye Who Enter HereThe event that's returned has a number of properties set:
createEvent
in interface Command
initial
- the original event with the command text
public boolean isNoSpellsArea(CastEvent event)
event
- the event
public boolean execute(CommandEvent ev)
execute
in interface Command
ev
- the CommandEvent to execute
Command.execute(wyvern.lib.CommandEvent)
public boolean adjustCasterMana(CastEvent event)
event
- the eventpublic boolean reagents(CastEvent event)
event
- the event
public boolean knowsSpell(Commandable agent, java.lang.String spell)
public boolean dispel(CastEvent event)
public boolean showActiveSpells(CommandEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |