OGS Java API Spec

ogs.magic
Class SpellList

java.lang.Object
  |
  +--ogs.magic.SpellList

public abstract class SpellList
extends Object

A spell list associates spells with cclasses and domains. The association between a spell and a cclass or domain determines the spell level. A spell level is an integer value that can range from 0 to 9.

See Also:
CClass, Domain

Field Summary
protected  HashMap casterMap
          Maps cclasses and domains to spells.
 
Constructor Summary
protected SpellList()
          Create an empty spell list.
 
Method Summary
 Integer getLevel(Class spellClass, Class casterClass)
          Determine the spell level for a class of spell and caster.
 Integer getLevel(Spell spell, Class casterClass)
          Determine the spell level for a spell and a class of caster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

casterMap

protected HashMap casterMap
Maps cclasses and domains to spells. A spell list is implemented with a map of maps. The first map is the caster map. The caster map maps casters (derived classes of CClass or Domain) to a map of spells. Each spell map maps spells (derived classes of Spell) to the equivalent spell level represented as an Integer. Derived classes must build the caster map and spell maps.

Constructor Detail

SpellList

protected SpellList()
Create an empty spell list. An empty spell list has no casters and thus no spells or spell levels to map to.

Method Detail

getLevel

public Integer getLevel(Class spellClass,
                        Class casterClass)
Determine the spell level for a class of spell and caster. The class of caster must be a class derived from CClass or Domain.

Parameters:
spellClass - A class derived from Spell.
casterClass - A class derived from CClass or Domain.
Returns:
Spell level or null if not caster and spell not found.
Throws:
ClassCastException - If the spell or caster class is not derived from the appropriate class.

getLevel

public Integer getLevel(Spell spell,
                        Class casterClass)
Determine the spell level for a spell and a class of caster. This function takes into account any metamagic feats that are attached to the spell. If the spell has any metamagic feats, the total slots from the metamagic feats are added to the spell's normal level. The class of caster may be a class derived from CClass or Domain.

Parameters:
spell - A spell object.
casterClass - A class derived from CClass or Domain.
Returns:
Spell level or null if not caster and spell not found.
Throws:
ClassCastException - If the spell or caster class is not derived from the appropriate class.

OGS Java API Spec