wyvern.lib.ai.behaviors
Class WanderRandomlyBE

java.lang.Object
  extended bywyvern.lib.ai.behaviors.BehaviorElement
      extended bywyvern.lib.ai.behaviors.WanderRandomlyBE

public class WanderRandomlyBE
extends BehaviorElement


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
 java.lang.String chooseRandomDir()
          Chooses a random direction for the commandable.
 boolean getAction(Commandable monster, Behavior behavior)
           
static BehaviorElement getImpl()
           
 void moveRandomly(Commandable agent)
          Moves the monster in a random direction, possibly pausing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WANDER_RANGE

public static final 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.

See Also:
Constant Field Values

DEFAULT_MONSTER_INERTIA

public static final 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. You can override it with an "inertia" int property on the monster.

See Also:
Constant Field Values
Method Detail

getImpl

public static BehaviorElement getImpl()

getAction

public boolean getAction(Commandable monster,
                         Behavior behavior)
Overrides:
getAction in class BehaviorElement

moveRandomly

public void moveRandomly(Commandable agent)
Moves the monster in a random direction, possibly pausing. If the monster has a "stay-near" property (wyvern.lib.Point), the monster will try to stay within "wander-range" of the specified point, with a default range if not specified.

Parameters:
agent - the monster to command

chooseRandomDir

public java.lang.String chooseRandomDir()
Chooses a random direction for the commandable. Utility method for subclasses.

Returns:
a direction command, or "wait" 1 time in 9