|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Monster AIs control monsters and think for them.
Field Summary | |
static int |
DEFAULT_MONSTER_INERTIA
If a monster is moving randomly, since there's nothing to do, we have them sit still this percentage of the time, to cut down on CPU load. |
static int |
DEFAULT_WANDER_RANGE
If a monster has a "stay-near" property but doesn't specify a "wander-range" property, this is the value that will be used. |
Method Summary | |
void |
addCommandable(Commandable m)
Adds a Commandable to this AI's sphere of influence. |
void |
addToHateList(Commandable hater,
Commandable hated)
Adds someone to a monster's I-hate-you list. |
Command |
getCommand(CommandEvent cmd,
Commandable agent)
Returns the Command that will handle the specified command for a commandable. |
boolean |
isControlling(Commandable m)
Returns true if the AI is producing for the specified Commandable's queue (i.e. it thinks it's controlling the commandable). |
void |
notifyAttacked(Commandable defender,
Commandable attacker)
When a monster is attacked, it sends this message to its AI. |
void |
registerCommand(java.lang.String command,
Command handler,
Commandable agent)
Registers a command with the AI. |
void |
removeCommandable(Commandable m)
Removes a Commandable from this AI's control. |
void |
requestEvent(EventQueue q)
Notifies the AI that a queue is ready to be serviced. |
void |
think(Commandable m,
EventQueue q)
Decides what to do next. |
void |
thinkForQueue(EventQueue q)
Takes a queue and puts something in it, based on properties of the owner of the queue. |
void |
unregisterCommand(java.lang.String command,
Command handler,
Commandable agent)
Unregisters a command with the AI. |
Field Detail |
public static final int DEFAULT_WANDER_RANGE
public static final int DEFAULT_MONSTER_INERTIA
Method Detail |
public void registerCommand(java.lang.String command, Command handler, Commandable agent)
command
- the command to registerhandler
- the Command object who's registering itagent
- the agent for which to register the commandpublic void unregisterCommand(java.lang.String command, Command handler, Commandable agent)
command
- the command to unregisterhandler
- the Command object who's unregistering itagent
- the agent that used to have the command registeredpublic Command getCommand(CommandEvent cmd, Commandable agent)
agent
- the Commandable who is being commandedcmd
- the command the Commandable is trying to perform
public void requestEvent(EventQueue q)
q
- the EventQueue that's ready for an eventpublic void think(Commandable m, EventQueue q)
m
- the Commandable to think forq
- the Commandable's event queue, for convenience
(it's the same as the one returned by m.getQueue() );public void thinkForQueue(EventQueue q)
q
- the Commandable's event queue, for convenience
(it's the same as the one returned by m.getQueue() );public void addCommandable(Commandable m)
m
- a Commandable to add.public void removeCommandable(Commandable m)
m
- the Commandable to remove
java.lang.IllegalArgumentException
- if the Commandable isn't
under this AI's controlpublic boolean isControlling(Commandable m)
m
- the Commandable to check
public void notifyAttacked(Commandable defender, Commandable attacker)
defender
- the monster under the AI's controlattacker
- whoever attacked the monsterpublic void addToHateList(Commandable hater, Commandable hated)
hater
- the monster who now hates someonehated
- the player or monster the hater hates
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |