spellcast.enchantment
Class EnchantmentImpl

java.lang.Object
  extended by spellcast.enchantment.EnchantmentImpl
All Implemented Interfaces:
java.io.Serializable, Enchantment
Direct Known Subclasses:
AmnesiaEnchantment, BlindEnchantment, CharmPersonEnchantment, ConfusionEnchantment, DelayedEffectEnchantment, DiseasedEnchantment, FearEnchantment, HasteEnchantment, InvisibleEnchantment, ParalysisEnchantment, PermanencyEnchantment, PoisonedEnchantment, ProtectionFromEvilEnchantment, ResistColdEnchantment, ResistHeatEnchantment, TimeStopEnchantment

public class EnchantmentImpl
extends java.lang.Object
implements Enchantment

The default implementation of Enchantment.

Version:
$Revision: 1.1 $
Author:
Barrie Treloar
See Also:
Enchantment, Serialized Form

Constructor Summary
protected EnchantmentImpl()
          Provided for serialization, do not use as a constructor.
  EnchantmentImpl(java.lang.String theName, IBeing theCaster, IBeing theTarget)
          Create the Enchantment cast by theCaster at theTarget.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determine is this object equals the specified object.
 IBeing getCaster()
          The caster of the Enchantment.
 java.lang.String getDescription()
          Return the description of this Enchantment.
 int getDuration()
          Return the duration left on this Enchantment before it expires.
 Id getId()
          The Id of this Enchantment.
 java.lang.String getName()
          Return the name of this Enchantment.
 DamageType getResistance()
          Gets the resistance of this Enchantment.
 IBeing getTarget()
          The target of the Enchantment.
 int hashCode()
          The hashCode of this object as per Object.hashCode.
 boolean isPermanent()
          isPermanent indicates whether the Enchantment is permanently enabled.
 boolean isResistant(DamageType damageType)
          isResistant checks to see if the Enchantment will resist the specified DamageType.
 void setCaster(IBeing theCaster)
          Sets the casting Wizard of this Enchantment.
 void setDescription(java.lang.String theDescription)
          Set the description of this Enchantment.
 void setDuration(int theDuration)
          Sets the duration of this Enchantment.
 void setId(Id theId)
          Set the Id of this Enchantment.
 void setName(java.lang.String theName)
          Set the name of this Enchantment.
 void setPermanent(boolean isPermanent)
          Sets whether this Enchantment is permanent.
 void setResistance(DamageType damageType)
          Sets the resistance of this Enchantment to the specified DamageType.
 void setTarget(IBeing theTarget)
          Sets the target IBeing of this Enchantment.
 boolean turnComplete()
          Notify the Enchantment that a turn has been completed and to update itself accordingly.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnchantmentImpl

protected EnchantmentImpl()
Provided for serialization, do not use as a constructor.


EnchantmentImpl

public EnchantmentImpl(java.lang.String theName,
                       IBeing theCaster,
                       IBeing theTarget)
Create the Enchantment cast by theCaster at theTarget.

Parameters:
theName - the name of this Enchantment.
theCaster - the IBeing casting the Enchantment.
theTarget - the IBeing that is the target of the Enchantment.
Method Detail

getId

public final Id getId()
The Id of this Enchantment.

Specified by:
getId in interface Enchantment
Returns:
the Id of this Enchantment.

setId

public final void setId(Id theId)
Set the Id of this Enchantment.

Parameters:
theId - the Id of this Enchantment.

equals

public final boolean equals(java.lang.Object o)
Determine is this object equals the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to test equality against.
Returns:
true if this Enchantment equals the specified object.

hashCode

public final int hashCode()
The hashCode of this object as per Object.hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashCode of this object.

getName

public final java.lang.String getName()
Return the name of this Enchantment.

Specified by:
getName in interface Enchantment
Returns:
the name of this Enchantment.

setName

public final void setName(java.lang.String theName)
Set the name of this Enchantment.

Parameters:
theName - the name of this Enchantment.

getDescription

public final java.lang.String getDescription()
Return the description of this Enchantment.

Specified by:
getDescription in interface Enchantment
Returns:
the description of this Enchantment.

setDescription

public final void setDescription(java.lang.String theDescription)
Set the description of this Enchantment.

Parameters:
theDescription - the description of this Enchantment.

isPermanent

public final boolean isPermanent()
isPermanent indicates whether the Enchantment is permanently enabled. This means that the effect of the permanent spell on the first turn of its permenancy is repeated eternally.

Specified by:
isPermanent in interface Enchantment
Returns:
true if enchantment has been made permanent, false otherwise.

setPermanent

public final void setPermanent(boolean isPermanent)
Sets whether this Enchantment is permanent.

Specified by:
setPermanent in interface Enchantment
Parameters:
isPermanent - whether this Enchantment is permanent.

isResistant

public final boolean isResistant(DamageType damageType)
isResistant checks to see if the Enchantment will resist the specified DamageType.

Specified by:
isResistant in interface Enchantment
Parameters:
damageType - the DamageType to check against for resistance.
Returns:
true if the Enchantment can resist the specified DamageType, false otherwise.

getResistance

public final DamageType getResistance()
Gets the resistance of this Enchantment. If no resistances then NullDamageType is returned.

Returns:
the DamageType that this Enchantment is resistant to. If no resistances then NullDamageType is returned.

setResistance

public final void setResistance(DamageType damageType)
Sets the resistance of this Enchantment to the specified DamageType.

Parameters:
damageType - the DamageType this Enchantment will be resistant to.

getDuration

public final int getDuration()
Return the duration left on this Enchantment before it expires. If the Enchantment is permanent then this value has no meaning.

Specified by:
getDuration in interface Enchantment
Returns:
the duration left on this Enchantment.

setDuration

public final void setDuration(int theDuration)
Sets the duration of this Enchantment.

Parameters:
theDuration - the duration of the Enchantment.

turnComplete

public final boolean turnComplete()
Notify the Enchantment that a turn has been completed and to update itself accordingly. If the Enchantment has worn off then return true, otherwise return false.

Specified by:
turnComplete in interface Enchantment
Returns:
true if the Enchantment has worn off, false otherwise.

getCaster

public final IBeing getCaster()
The caster of the Enchantment.

Specified by:
getCaster in interface Enchantment
Returns:
the caster of the Enchantment.

setCaster

public final void setCaster(IBeing theCaster)
Sets the casting Wizard of this Enchantment.

Parameters:
theCaster - the casting IBeing.

getTarget

public final IBeing getTarget()
The target of the Enchantment.

Specified by:
getTarget in interface Enchantment
Returns:
the target of the Enchantment.

setTarget

public final void setTarget(IBeing theTarget)
Sets the target IBeing of this Enchantment.

Parameters:
theTarget - the target IBeing of this Enchantment.


Copyright © 2001-2005 Spellcast. All Rights Reserved.