|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectspellcast.beings.Being
public abstract class Being
The base class for all Beings in Spellcast.
TODO: add equals() and hashCode()
| Field Summary | |
|---|---|
static java.lang.String |
ACTIVE_PROP
The property for the being's active value. |
| Constructor Summary | |
|---|---|
protected |
Being()
Provided for serialization, do not use as a constructor. |
|
Being(Id anId,
java.lang.String aName,
Gender aGender,
int theMaxHitPoints)
Creates a new BeingImpl object. |
| Method Summary | |
|---|---|
void |
addEnchantment(Enchantment anEnchantment)
Add an enchantment to this Being. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this Being. |
Enchantment[] |
getEnchantments()
Return an array of all Enchantments that are in effect upon
this Being. |
Gender |
getGender()
Return the Gender of this Being. |
int |
getHitPoints()
Returns the value of the current Hit Points for this Being. |
Id |
getId()
The Id of this Being. |
boolean |
getLeavesCorpse()
Indicates whether this Being should leave a corpse when it
dies. |
int |
getMaxHitPoints()
Returns the value for the Maximum Hit Points for this Being. |
java.lang.String |
getName()
The name of the Being. |
protected java.beans.PropertyChangeSupport |
getPropertySupport()
The PropertyChangeSupport object used to notify listeners
of changes to properties. |
boolean |
isActive()
Indicates whether this Being is active this turn. |
boolean |
isAlive()
Determine if this Being is currently alive. |
boolean |
isNull()
|
static IBeing |
newNull()
Return a Null IBeing. |
void |
removeEnchantment(Enchantment enchantment)
Remove the specified Enchantment from this
Being. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from this
Being. |
void |
setActive(boolean isActive)
Sets this Being as active for this turn. |
void |
setAlive(boolean isAlive)
Sets whether this Being is currently alive. |
void |
setGender(Gender theGender)
Sets the Gender of this Being. |
void |
setHitPoints(int theHitPoints)
Set the value for the current HitPoints for this Being. |
void |
setId(Id theId)
Set the Id of this Being. |
void |
setLeavesCorpse(boolean shouldLeaveCorpse)
This Being will leave a corpse on death if this value is
true, otherwise no corpse will be created. |
void |
setMaxHitPoints(int theMaxHitPoints)
Set the value for the Maximum Hit Points for this Being. |
void |
setName(java.lang.String theName)
Sets the name of this Being. |
void |
setNull(boolean isNullable)
Set whether this object is a Nullable. |
void |
shouldDie()
Determine if this being should die. |
void |
takeDamage(Damage damageDealt)
The specified damage is dealt to this Being. |
void |
updateEnchantments()
Each Enchantment on this Being is notified
that the turn has been completed via turnComplete. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ACTIVE_PROP
| Constructor Detail |
|---|
protected Being()
public Being(Id anId,
java.lang.String aName,
Gender aGender,
int theMaxHitPoints)
anId - theId to use for this Being.aName - the name of thisBeing.aGender - theGender of this Being.theMaxHitPoints - the maximum hit points of thisBeing.| Method Detail |
|---|
protected final java.beans.PropertyChangeSupport getPropertySupport()
PropertyChangeSupport object used to notify listeners
of changes to properties.
PropertyChangeSupport.public final void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to this Being.
addPropertyChangeListener in interface PropertyUpdaterlistener - the PropertyChangeListener to add.public final void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from this
Being.
removePropertyChangeListener in interface PropertyUpdaterlistener - the PropertyChangeListener to remove.public final void addEnchantment(Enchantment anEnchantment)
addEnchantment in interface IBeinganEnchantment - the enchantment to add.public final void removeEnchantment(Enchantment enchantment)
Enchantment from this
Being. If the enchantment does not exist then nothing is
removed.
removeEnchantment in interface IBeingenchantment - the enchantment to remove. Ignored if the enchantment
is not in effect on this Being.public final Enchantment[] getEnchantments()
Enchantments that are in effect upon
this Being.
getEnchantments in interface IBeingEnchantments that are in effect
upon this Being.public final void updateEnchantments()
Enchantment on this Being is notified
that the turn has been completed via turnComplete. If the
Enchantment indicates that it should no longer be in
effect then it is removed.
updateEnchantments in interface IBeingEnchantment.turnComplete()public final boolean isActive()
Being is active this turn.
isActive in interface IBeingBeing is active this turn.public final void setActive(boolean isActive)
Being as active for this turn.
setActive in interface IBeingisActive - if thisBeing is active for this turn, false
otherwise.public final boolean isAlive()
Being is currently alive. True if alive,
false otherwise.
isAlive in interface IBeingBeing is alive, false otherwise.public final void setAlive(boolean isAlive)
Being is currently alive. True if alive,
false otherwise.
setAlive in interface IBeingisAlive - true if alive, false otherwise.public final void shouldDie()
shouldDie in interface IBeingpublic final Id getId()
Id of this Being.
getId in interface IBeingId of this Being.public final void setId(Id theId)
Id of this Being.
setId in interface IBeingtheId - the Id of this Being.public final int getHitPoints()
Being.
The current hit points will never exceed max hit points.
getHitPoints in interface IBeingBeing.public final void setHitPoints(int theHitPoints)
HitPoints for this Being. Any
values that are negative are converted into 0. Any values that are
greater than getMaxHitPoints are converted into
getMaxHitPoints.
setHitPoints in interface IBeingtheHitPoints - the value to set the Hit Points to. Any negative
values are converted to 0. Any values that are greater
thangetMaxHitPoints are converted into
getMaxHitPoints.public final int getMaxHitPoints()
Being.
getMaxHitPoints in interface IBeingBeing.public final void setMaxHitPoints(int theMaxHitPoints)
Being.
Only positive values are allowed for maxHitPoints. Any invalid values
are silently ignored and the value is set to 0.
setMaxHitPoints in interface IBeingtheMaxHitPoints - the value to set the Maximum Hit Points to. Valid
values are > 0. Invalid values are silently ignored and the
value is set to 0.public final void takeDamage(Damage damageDealt)
Enchantments that provide resistance to the
DamageType being dealt then the damage is reduced to zero.
takeDamage in interface IBeingdamageDealt - the damage to deal to this Being.public final java.lang.String getName()
Being.
getName in interface IBeingBeing.public final void setName(java.lang.String theName)
Being.
setName in interface IBeingtheName - the name for this Being.public final Gender getGender()
Gender of this Being.
getGender in interface IBeingGender of this Being.public final void setGender(Gender theGender)
Gender of this Being.
setGender in interface IBeingtheGender - the Gender of this Being.public final boolean getLeavesCorpse()
Being should leave a corpse when it
dies.
getLeavesCorpse in interface IBeingpublic final void setLeavesCorpse(boolean shouldLeaveCorpse)
Being will leave a corpse on death if this value is
true, otherwise no corpse will be created.
setLeavesCorpse in interface IBeingshouldLeaveCorpse - true if a corpse should be created on death,
false otherwise.public final boolean isNull()
isNull in interface util.Nullablepublic final void setNull(boolean isNullable)
Nullable.
isNullable - true if this object is a Null instance, false
otherwise.public static IBeing newNull()
IBeing.
IBeing.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||