|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.Search
Contains a whole bunch of common ways to look for objects.
Method Summary | |
static Predicate |
createVisiblePredicate(Predicate p,
Commandable agent)
Takes a predicate and wraps it with another predicate that makes sure the returned object isn't invisible to the agent. |
static java.util.List |
findAllMatches(Commandable agent,
Predicate p)
Finds all objects in the map, adjacent to or beneath the agent, that match the passed predicate. |
static GameObject |
findInMap(Commandable agent,
Predicate p)
Searches for an object matching the specified predicate. |
static GameObject |
findNeighbor(Commandable agent,
Predicate p)
Searches the locations around an agent for an object matching the specified predicate. |
static GameObject |
findObject(Commandable agent,
Predicate p)
Looks for the specified object in the vicinity of the agent. |
static GameObject |
findTarget(Commandable agent,
Predicate match)
This utility method looks first in the agent's inventory, then on the ground beneath the agent, for an object that passes the specified predicate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static GameObject findNeighbor(Commandable agent, Predicate p)
agent
- the GameObject to look aroundp
- a Predicate to use for searching the mappublic static GameObject findObject(Commandable agent, Predicate p)
Unlike findNeighbor, this method gives preference to objects beneath the agent. So if you say "find wand", and there are two of them, it'll return the one beneath you and not the one next to you.
agent
- the agent to check (must be in a map)p
- the predicate used to tell which object to grab.public static GameObject findTarget(Commandable agent, Predicate match)
agent
- agentmatch
- predicate to match withpublic static GameObject findInMap(Commandable agent, Predicate p)
agent
- the agent to check (must be in a map)p
- the predicate used to tell which object to grab.
public static Predicate createVisiblePredicate(Predicate p, Commandable agent)
p
- the original predicateagent
- the agent trying to find somethingpublic static java.util.List findAllMatches(Commandable agent, Predicate p)
agent
- the agent to check (must be in a map)p
- the predicate used to tell which object to grab.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |