wyvern.lib.predicates
Class BlocksSpellPredicate

java.lang.Object
  extended bywyvern.lib.predicates.BlocksSpellPredicate
All Implemented Interfaces:
LocationPredicate, Predicate

public class BlocksSpellPredicate
extends java.lang.Object
implements LocationPredicate

This predicate checks for the presence of objects that block spells.

Version:
1.0, Jan 31, 1998
Author:
Steve Yegge

Field Summary
static BlocksSpellPredicate PREDICATE
           
 
Constructor Summary
BlocksSpellPredicate()
           
 
Method Summary
static boolean canWalk(GameObject obj, int x, int y)
          Returns true if the target object's can-walk property includes the specified point, in map coordinates.
 boolean predicate(GameObject obj)
          This method is provided in case someone tries to use a BlocksSpellPredicate as a normal Predicate function.
 boolean predicate(int x, int y, GameObject obj)
          Does a more specialized check on the object, looking at the can-walk list to see if it actually allows motion there.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREDICATE

public static final BlocksSpellPredicate PREDICATE
Constructor Detail

BlocksSpellPredicate

public BlocksSpellPredicate()
Method Detail

predicate

public boolean predicate(GameObject obj)
This method is provided in case someone tries to use a BlocksSpellPredicate as a normal Predicate function. It won't be able to figure out properly if the object is blocking, because it can't check the object's can_walk list.

Specified by:
predicate in interface Predicate
Parameters:
obj - any GameObject
Returns:
true if the object blocks spells

predicate

public boolean predicate(int x,
                         int y,
                         GameObject obj)
Does a more specialized check on the object, looking at the can-walk list to see if it actually allows motion there.

Specified by:
predicate in interface LocationPredicate
Parameters:
x - map x location
y - map y location
obj - object at (x, y)
Returns:
true if the object blocks spells at (x, y)

canWalk

public static boolean canWalk(GameObject obj,
                              int x,
                              int y)
Returns true if the target object's can-walk property includes the specified point, in map coordinates.

Parameters:
obj - an object to examine
x - map x coordinate
y - map y coordinate
Returns:
true if the object has a "can-walk" PointList, and the list contains the passed (x, y) map location. If there's no can-walk list, or the list doesn't contain the passed point, returns false.