|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.adom.jade.kernel.GUIDCarrier
de.adom.jade.kernel.DefaultActor
de.adom.jade.beings.Being
Implements an autonomous being in JADE. This is the base class for both monsters and the PC.
By definition all commands a being can execute (either requested by the
monster AI or by external commands) must be named in such a way that they
start with the word do... followed by a verb.
Some of the method names in this class violate all coding standards by
starting with capital letters, omitting the get prefix, etc.
This is done for all methods used in building sentence structures to make
the sentences look as readable as possible. This was necessary because both
the PC and all NPCs use the same message texts and some tricks had to be
used.
Particular care needs to be exercised when displaying messages caused by a being or his actions. There are three types of messages to differentiate:
message method. @see #message
observe method. These messages usually will contain
one or more beings affected by some kind of action - thus a lot
of care needs to be taken to use the correct sequence of You,
word, etc. method calls to create the correct message
independent of whether the PC or an NPC is the source of the message.
inform method. Such methods usually
will only be visible to the PC.
| Constructor Summary | |
|---|---|
Being(Map map)
Initializes the basic data of this being. |
|
| Method Summary | |
|---|---|
void |
act()
Executes the next action of this being. |
protected abstract void |
doAct()
Implements a atual action for this being. |
boolean |
doMove(int direction)
Moves this being one step into a given direction. |
void |
doWait()
The "wait" action. |
boolean |
enterLocation()
Enters the location at the current position of the being. |
boolean |
enterLocation(Connection connection)
Enters the location at the current position of the being. |
protected boolean |
executeRepeatedCommand(Command command)
Executes a command that is executed repetitively. |
int |
getAttribute(int attributeIndex)
Returns an attribute value of the being. |
int |
getAttributeModifier(int attributeIndex)
Returns an attribute modifier of the being. |
int |
getCurrentHitPoints()
Returns the current number of hit points of this being. |
int |
getCurrentPowerPoints()
Returns the current number of power points of this being. |
int |
getDV()
Returns the current defense value of this being. |
long |
getExperiencePoints()
Returns the current experience points of the being. |
Gender |
getGender()
Returns the gender of this being. |
Command |
getLastUsedCommand()
Returns the most recent command used by this being. |
int |
getLastX()
Returns the last x position of this being. |
int |
getLastY()
Returns the last y position of this being. |
int |
getLevel()
Returns the current level of the being. |
abstract java.lang.String |
getLogicalName()
Returns the logical name for tbis being. |
Map |
getMap()
Returns the map this being dwells upon. |
int |
getMaximumHitPoints()
Returns the maximum number of hit points for this being. |
int |
getMaximumPowerPoints()
Returns the maximum number of power points for this being. |
long |
getMoves()
Returns the current number of moves points of the being. |
java.lang.String |
getName()
Returns the name of this being. |
protected int |
getNextActionEnergy()
Returns the energy (in ticks) required for the next action. |
int |
getPV()
Returns the current protection value of this being. |
Race |
getRace()
Returns the race of this being. |
int |
getSightRange()
Returns the basic sight range for this being. |
int |
getSpeed()
Returns the speed score of the being. |
int |
getX()
Returns the x position of this being. |
int |
getY()
Returns the y position of this being. |
protected void |
handleTimedStuff()
Handles all the timers that can run on a being. |
void |
inform(java.lang.String information)
Displays messages meant only for this being. |
void |
initialize()
Initializes a being so that all core values have been set. |
static void |
initializeWordForms()
Initializes all the word forms for all beings. |
void |
install()
Installs the being as a new being on its map. |
boolean |
isAlive()
Checks if this being is still alive. |
boolean |
isBlind()
Checks whether this being has been blinded. |
protected abstract boolean |
isFirstPerson()
Determines whether messages originating from this being use first person singular or third person singular word form. |
protected boolean |
isLastCommandRepeated()
Determines whether the last executed command should be repeated. |
boolean |
isOpenTile(Tile tile)
Checks whether a given tile is open for this being. |
protected boolean |
isReadyToAct()
Determines whether the being can act. |
boolean |
isValid()
Determines whether this action still is going to happen when the time has come. |
boolean |
isVisible()
Determines whether this being currently is visible to the PC. |
boolean |
isVisibleTo(Being being)
Determines whether this being currently is visible to the given being. |
protected abstract boolean |
isVisibleToImpl(Being being)
Determines whether this being currently is visible to the given being. |
void |
message(java.lang.String message)
Displays a message meant for everyone on the map. |
void |
modifyCurrentHitPoints(int modifier)
Modifies the current number of hit points by a given value. |
void |
modifyCurrentPowerPoints(int modifier)
Modifies the current number of hit points by a given value. |
void |
modifyMaximumHitPoints(int modifier)
Modifies the maximum number of hit points for this being. |
void |
modifyMaximumPowerPoints(int modifier)
Modifies the maximum number of power points for this being. |
protected void |
modifyNextActionEnergy(int percentageModifier)
Modifies the energy required for the next action by a certain percentage. |
boolean |
moveTo(int newX,
int newY)
Moves the being to a new position. |
void |
observe(java.lang.String observation)
Displays a message to the user if this being is visible to the PC. |
protected void |
resetNextActionEnergy()
Resets the energy required for the next action. |
void |
setAttribute(int attributeIndex,
int value)
Sets the atribute value for a given attribute. |
void |
setCurrentHitPoints(int value)
Sets the current number of hit points of this being. |
void |
setCurrentPowerPoints(int value)
Sets the current number of power points of this being. |
void |
setGender(Gender theGender)
Sets the gender of the being. |
void |
setLastUsedCommand(Command command)
Stores the most recent command used by this being. |
void |
setMap(Map map)
Sets the map this being dwells on. |
void |
setMaximumHitPoints(int maxHits)
Sets the maximum number of hit points for this being. |
void |
setMaximumPowerPoints(int maxPower)
Sets the maximum number of power points for this being. |
void |
setName(java.lang.String theName)
Sets the name of this being. |
void |
setPosition(int xp,
int yp)
Sets the position of this being on the current map. |
void |
setRace(Race theRace)
Sets the race for this being. |
void |
updateDisplay()
Updates the visibility of the current map. |
java.lang.String |
word(java.lang.String word)
Returns a given word in the appopriate form for this being (either first person or third person). |
abstract java.lang.String |
you()
Returns a text describing this being as the actor. |
java.lang.String |
You()
Returns a text describing this being as the actor with a capital letter at the start. |
void |
You(java.lang.String information)
Informs the being of the results of its action. |
| Methods inherited from class de.adom.jade.kernel.DefaultActor |
|---|
actAgainAfter, getActionPoint, setActionPoint |
| Methods inherited from class de.adom.jade.kernel.GUIDCarrier |
|---|
getGUID |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Being(Map map)
map - the map upon which the being is movign right now; may
be null, if the being is held in some
kind of storage object; in that case no location-dependent
methods may be called| Method Detail |
|---|
public void initialize()
public final void act()
doAct (which needs to be overridden in
derived classes) is called. Finally the next action will be prepared.
act in interface Actoract in class DefaultActorprotected boolean isLastCommandRepeated()
protected boolean executeRepeatedCommand(Command command)
command - the command to executepublic void install()
protected abstract void doAct()
protected void handleTimedStuff()
protected void resetNextActionEnergy()
protected void modifyNextActionEnergy(int percentageModifier)
getNextEnergyAction.
percentageModifier - #getNextEnergyActionprotected int getNextActionEnergy()
protected boolean isReadyToAct()
public int getSpeed()
public int getAttribute(int attributeIndex)
attributeIndex - the index of the attribute
public void setAttribute(int attributeIndex,
int value)
attributeIndex - the index of the attributevalue - teh value of the attributepublic int getAttributeModifier(int attributeIndex)
attributeIndex - the index of the attribute
Attribute for more
detailspublic boolean isAlive()
public boolean isValid()
isValid in interface ActorisValid in class DefaultActorpublic boolean isBlind()
TODO: this method needs to be implemented in a meaningful way.
public void doWait()
public void setGender(Gender theGender)
theGender - the new genderpublic Gender getGender()
public int getCurrentHitPoints()
public void setCurrentHitPoints(int value)
value - the new value for the current number of hit
pointspublic void modifyCurrentHitPoints(int modifier)
public int getMaximumHitPoints()
public void setMaximumHitPoints(int maxHits)
maxHits - the maximum number of hit points for this beingpublic void modifyMaximumHitPoints(int modifier)
modifier - the modifier for the maximum number of hit pointspublic int getCurrentPowerPoints()
public void setCurrentPowerPoints(int value)
value - the new value for the current number of power
pointspublic void modifyCurrentPowerPoints(int modifier)
public int getMaximumPowerPoints()
public void setMaximumPowerPoints(int maxPower)
maxPower - the maximum number of hit points for this beingpublic void modifyMaximumPowerPoints(int modifier)
modifier - the modifier for the maximum number of power pointspublic int getX()
public int getY()
public int getLastX()
public int getLastY()
public void setPosition(int xp,
int yp)
xp - the x coordinate of the positionyp - the y coordinate of the positionpublic final void updateDisplay()
public int getSightRange()
public boolean isOpenTile(Tile tile)
tile - the tile to check
public void setMap(Map map)
map - the map this being dwells onpublic Map getMap()
public boolean isVisible()
public boolean isVisibleTo(Being being)
being - the being that tries to discern this being
protected abstract boolean isVisibleToImpl(Being being)
being - the being that tries to discern this being
public boolean doMove(int direction)
moveTo
will be called to execute the actual move with all consequences resulting
from it.
direction - the direction to move one step to
moveTo(int, int)
public boolean moveTo(int newX,
int newY)
doMove should be called with a given direction if the
being is moved but one step in a non-standard way (e.g. out of its
own will).
newX - the new x coordinate for this beingnewY - the new y coordinate for this being
doMove(int)public abstract java.lang.String getLogicalName()
public void message(java.lang.String message)
public void observe(java.lang.String observation)
observation - the observation to display if the being is visible
to the PCpublic void You(java.lang.String information)
information - the personal information to displaypublic void inform(java.lang.String information)
information - the personal information to displaypublic final java.lang.String word(java.lang.String word)
/data/dictionary.dat
needs a correct entry with the word form in both first and third person singular.
word - the word in first person singular
protected abstract boolean isFirstPerson()
public abstract java.lang.String you()
public java.lang.String You()
public static void initializeWordForms()
public void setRace(Race theRace)
theRace - the race of this beingpublic Race getRace()
public void setName(java.lang.String theName)
theName - the name of this beingpublic java.lang.String getName()
public int getLevel()
public long getExperiencePoints()
public long getMoves()
public int getPV()
public int getDV()
public boolean enterLocation()
public boolean enterLocation(Connection connection)
connection - the connection by which to enter the next location
public void setLastUsedCommand(Command command)
command - the command to storepublic Command getLastUsedCommand()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||