wyvern.lib.classes
Class Corpse.CorpseState

java.lang.Object
  extended bywyvern.lib.classes.Corpse.CorpseState
Enclosing class:
Corpse

public abstract static class Corpse.CorpseState
extends java.lang.Object

Uses the State pattern to represent the state of the corpse, and handle state transitions.


Field Summary
static Corpse.CorpseState FRESH
           
static Corpse.CorpseState PUTRID
           
static Corpse.CorpseState RANCID
           
static Corpse.CorpseState SMELLY
           
 
Method Summary
 void addCorpseDescriptionPrefix(Corpse corpse)
          Optionally adds a prefix to the corpse description, such as "smelly".
abstract  java.lang.String getPrefix()
          Returns the prefix to add to the corpse description.
 void removeCorpseDescriptionPrefix(Corpse corpse)
          Removes the corpse-description prefix we added for this state, if any.
abstract  void transitionState(Corpse corpse)
          Each CorpseState knows what to do when the timer expires for the current state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRESH

public static final Corpse.CorpseState FRESH

SMELLY

public static final Corpse.CorpseState SMELLY

RANCID

public static final Corpse.CorpseState RANCID

PUTRID

public static final Corpse.CorpseState PUTRID
Method Detail

transitionState

public abstract void transitionState(Corpse corpse)
Each CorpseState knows what to do when the timer expires for the current state. It switches states, adjusts the poison level, and eventually destroys the corpse.


getPrefix

public abstract java.lang.String getPrefix()
Returns the prefix to add to the corpse description.

Returns:
the prefix, such as "smelly", or null if we don't modify the corpse description in this state.

addCorpseDescriptionPrefix

public void addCorpseDescriptionPrefix(Corpse corpse)
Optionally adds a prefix to the corpse description, such as "smelly".


removeCorpseDescriptionPrefix

public void removeCorpseDescriptionPrefix(Corpse corpse)
Removes the corpse-description prefix we added for this state, if any.