wyvern.lib
Interface SpellList

All Known Implementing Classes:
SpellListImpl

public interface SpellList

Manages the list of spells a player or monster knows.

Version:
1.0, Nov 07, 1999
Author:
Eric Weber

Method Summary
 void addSpell(java.lang.String path)
          Adds a spell to the list; used by the map editor.
 boolean forgetSpell(java.lang.String path, Commandable agent)
          Forgets a spell.
 int getSize()
          Returns the number of spells in this list.
 java.lang.String[] getSpells()
          Returns the spell display names in this list.
 java.lang.String getSpellString()
          Returns the list of spell display names in the form "spell_1 spell_2 spell_3" (used to implement the client-side spell list)
 boolean knowsSpell(java.lang.String path)
          Checks whether the player knows this spell.
 void learnSpell(java.lang.String path)
          Learns a spell.
 boolean okToLearn(java.lang.String name, Commandable agent, java.lang.StringBuffer reason)
          Checks whether player is allowed to learn this spell, taking into account the lore cost of the spell and available lore points.
 

Method Detail

learnSpell

public void learnSpell(java.lang.String path)
Learns a spell.

Parameters:
path - the spell class, e.g. wyvern.lib.spells.LightningBolt or wyvern/wiz/foo/spells/myspell.py

forgetSpell

public boolean forgetSpell(java.lang.String path,
                           Commandable agent)
Forgets a spell.

Parameters:
path - the class of the spell to forget
agent - the agent to whom to return the lore points for the spell, or null if not applicable.
Returns:
true if spell was previously known

knowsSpell

public boolean knowsSpell(java.lang.String path)
Checks whether the player knows this spell.

Parameters:
path - the class of the spell to check, OR the display name of the spell
Returns:
true if spell is known

okToLearn

public boolean okToLearn(java.lang.String name,
                         Commandable agent,
                         java.lang.StringBuffer reason)
Checks whether player is allowed to learn this spell, taking into account the lore cost of the spell and available lore points.

Parameters:
name - the class of the spell to check
agent - the agent trying to learn the spell
reason - the error message, if any
Returns:
true if spell is permitted. If false, the reason is appended to the reason buffer

getSpells

public java.lang.String[] getSpells()
Returns the spell display names in this list.


getSize

public int getSize()
Returns the number of spells in this list.


addSpell

public void addSpell(java.lang.String path)
Adds a spell to the list; used by the map editor.

Parameters:
path - the class of the spell to add

getSpellString

public java.lang.String getSpellString()
Returns the list of spell display names in the form "spell_1 spell_2 spell_3" (used to implement the client-side spell list)

Returns:
the spell list, with spell names having underscores