monrovia.game.creatures
Class GameCreature

java.lang.Object
  |
  +--monrovia.server.platform.GameObject
        |
        +--monrovia.server.platform.Creature
              |
              +--monrovia.server.platform.map.PlayerCreature
                    |
                    +--monrovia.game.creatures.GameCreature
Direct Known Subclasses:
ComputerGameCreature

public class GameCreature
extends PlayerCreature

GameCreature class implements the game specific properties required of all the creatures in the game


Field Summary
protected  GameCreature mAttackTarget
           
protected static java.lang.String mMsgCrit
           
protected static java.lang.String mMsgFleeFalse
           
protected static java.lang.String mMsgFleeTrue
           
protected static java.lang.String mMsgHit
           
protected static java.lang.String mMsgMiss
           
protected static java.lang.String mMsgYouCrit
           
protected static java.lang.String mMsgYouFleeFalse
           
protected static java.lang.String mMsgYouFleeTrue
           
protected static java.lang.String mMsgYouHit
           
protected static java.lang.String mMsgYouMiss
           
 
Constructor Summary
GameCreature()
          Default constructor
 
Method Summary
 void addEnemy(GameCreature pCreature)
          Add an enemy and if no attack target exists set it to be this
 void addParameters(ParameterMap pParameters)
          This method will be called to initialize the parameters.
 boolean canMove()
          Can we move, or are we being held harshly
 void checkParameters(ParameterMap pParameters)
          This method will be called to check the parameters.
protected  int d(int pInt)
          Calculate d(n) of an integer (dice side)
 boolean doDamage(GameCreature pCreature)
          Do damage to this creature
 void escaped()
          Escaped is called, when the creature has escaped and the enemies should be notified of the escape
 java.util.List getOptionalParameters()
          Returns a list of optional parameters.
 int getParam(java.lang.String pString)
          Type conversion help
 Stat[] getStatistics()
          Returns the statistics for this creature
 boolean isMoving()
          Are we moving this round
 void removeEnemy(GameCreature pCreature)
          Remove an enemy and if no attack target exists set it to be the first one
 void resetObject()
          Resets this creature
 void setMoving(boolean pMoving)
          Set this creature moving status this round
 void setParam(java.lang.String pString, int pInt)
          Type conversion help
 void setTarget(GameCreature pCreature)
          Set the target for attacks
 boolean tryFlee(GameCreature pCreature)
          Checks if flight attempt is successful
 void update()
          Update should be called at the end of each round by the platform to update hit points etc.
 
Methods inherited from class monrovia.server.platform.map.PlayerCreature
addMessage, addStatUpdate, addStatUpdate, die, exit, getMessages, initialize, isPlayer, isSavePoint, reconnect, sendUpdate, setPlayer, setSavePoint, setSenders
 
Methods inherited from class monrovia.server.platform.Creature
findFreePointNear, getCommandMessage, getIconID, getNeededParameters, getStartArea, getStartPoint, isAlive, setAlive, setCommandMessage
 
Methods inherited from class monrovia.server.platform.GameObject
addParameter, clearCommandMarks, create, getArea, getCommandMark, getGI, getID, getLocation, getName, getParameter, removeParameter, resetParameters, setCommandMark, setParameter, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mMsgHit

protected static final java.lang.String mMsgHit

mMsgCrit

protected static final java.lang.String mMsgCrit

mMsgMiss

protected static final java.lang.String mMsgMiss

mMsgFleeTrue

protected static final java.lang.String mMsgFleeTrue

mMsgFleeFalse

protected static final java.lang.String mMsgFleeFalse

mMsgYouHit

protected static final java.lang.String mMsgYouHit

mMsgYouCrit

protected static final java.lang.String mMsgYouCrit

mMsgYouMiss

protected static final java.lang.String mMsgYouMiss

mMsgYouFleeTrue

protected static final java.lang.String mMsgYouFleeTrue

mMsgYouFleeFalse

protected static final java.lang.String mMsgYouFleeFalse

mAttackTarget

protected GameCreature mAttackTarget
Constructor Detail

GameCreature

public GameCreature()
Default constructor
Method Detail

resetObject

public void resetObject()
Resets this creature
Overrides:
resetObject in class GameObject

addParameters

public void addParameters(ParameterMap pParameters)
Description copied from class: GameObject
This method will be called to initialize the parameters.

Overrides:
addParameters in class PlayerCreature
Following copied from class: monrovia.server.platform.GameObject
Parameters:
pParameters - Add the parameters here

getOptionalParameters

public java.util.List getOptionalParameters()
Description copied from class: GameObject
Returns a list of optional parameters. This is used to tell what parameters the user can set for example when adding a player.
Overrides:
getOptionalParameters in class Creature

checkParameters

public void checkParameters(ParameterMap pParameters)
                     throws StorageException
Description copied from class: GameObject
This method will be called to check the parameters.

Overrides:
checkParameters in class Creature
Following copied from class: monrovia.server.platform.GameObject
Parameters:
pParameters - Check that the parameters are OK
Throws:
StorageException - Throw this if you find an error.

getStatistics

public Stat[] getStatistics()
Returns the statistics for this creature
Overrides:
getStatistics in class Creature

setTarget

public void setTarget(GameCreature pCreature)
Set the target for attacks

addEnemy

public void addEnemy(GameCreature pCreature)
Add an enemy and if no attack target exists set it to be this

removeEnemy

public void removeEnemy(GameCreature pCreature)
Remove an enemy and if no attack target exists set it to be the first one

setMoving

public void setMoving(boolean pMoving)
Set this creature moving status this round

isMoving

public boolean isMoving()
Are we moving this round

canMove

public boolean canMove()
Can we move, or are we being held harshly

escaped

public void escaped()
Escaped is called, when the creature has escaped and the enemies should be notified of the escape

update

public void update()
Update should be called at the end of each round by the platform to update hit points etc.
Overrides:
update in class Creature

doDamage

public boolean doDamage(GameCreature pCreature)
Do damage to this creature
Parameters:
pCreature - the creature, that does the damage
Returns:
true if this creature dies

tryFlee

public boolean tryFlee(GameCreature pCreature)
Checks if flight attempt is successful
Parameters:
pCreature - the creature that attempts to flee from the creature that is being called

getParam

public int getParam(java.lang.String pString)
Type conversion help

setParam

public void setParam(java.lang.String pString,
                     int pInt)
Type conversion help

d

protected int d(int pInt)
Calculate d(n) of an integer (dice side)
Parameters:
pInt - number to calculate d(n) of