Java Code Examples for com.watabou.utils.PathFinder#getStepBack()

The following examples show how to use com.watabou.utils.PathFinder#getStepBack() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Dungeon.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 6 votes vote down vote up
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
	
	if (ch.flying || ch.buff( Tormented.class ) != null || ch.buff( Vertigo.class ) != null || ch.buff( Blinded.class ) != null) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}

       if (ch instanceof Mob && !(ch instanceof Piranha)) {
           BArray.or( passable, Level.illusory, passable );
       }
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
               int pos = ((Char)actor).pos;
               if (visible[pos] && ((Char) actor).invisible == 0) {
                   passable[pos] = false;
               }
		}
	}

	passable[cur] = true;
	
	return PathFinder.getStepBack( cur, from, passable );
	
}
 
Example 2
Source File: Dungeon.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
	
	if (ch.flying) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			int pos = ((Char)actor).pos;
			if (visible[pos]) {
				passable[pos] = false;
			}
		}
	}
	passable[cur] = true;
	
	return PathFinder.getStepBack( cur, from, passable );
	
}
 
Example 3
Source File: Dungeon.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {
	
	if (ch.flying) {
		BArray.or( pass, Level.avoid, passable );
	} else {
		System.arraycopy( pass, 0, passable, 0, Level.LENGTH );
	}
	
	for (Actor actor : Actor.all()) {
		if (actor instanceof Char) {
			int pos = ((Char)actor).pos;
			if (visible[pos]) {
				passable[pos] = false;
			}
		}
	}
	passable[cur] = true;
	
	return PathFinder.getStepBack( cur, from, passable );
	
}
 
Example 4
Source File: Dungeon.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
public static int flee( Char ch, int from, boolean[] pass, boolean[] visible, boolean chars ) {

		setupPassable();
		if (ch.flying) {
			BArray.or( pass, Dungeon.level.avoid, passable );
		} else {
			System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
		}

		if (Char.hasProp(ch, Char.Property.LARGE)){
			BArray.and( pass, Dungeon.level.openSpace, passable );
		}

		if (chars) {
			for (Char c : Actor.chars()) {
				if (visible[c.pos]) {
					passable[c.pos] = false;
				}
			}
		}
		passable[ch.pos] = true;
		
		return PathFinder.getStepBack( ch.pos, from, passable );
		
	}
 
Example 5
Source File: Dungeon.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
public static int flee( Char ch, int cur, int from, boolean pass[], boolean[] visible ) {

		setupPassable();
		if (ch.flying) {
			BArray.or( pass, Dungeon.level.avoid, passable );
		} else {
			System.arraycopy( pass, 0, passable, 0, Dungeon.level.length() );
		}
		
		for (Char c : Actor.chars()) {
			if (visible[c.pos]) {
				passable[c.pos] = false;
			}
		}
		passable[cur] = true;
		
		return PathFinder.getStepBack( cur, from, passable );
		
	}
 
Example 6
Source File: Dungeon.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public static int flee(Char ch, int cur, int from, boolean pass[]) {

        if (ch.isFlying()) {
            BArray.or(pass, level.avoid, passable);
        } else {
            System.arraycopy(pass, 0, passable, 0, level.getLength());
        }

        markActorsAsUnpassableIgnoreFov();
        markObjects(ch);

        passable[cur] = true;

        return PathFinder.getStepBack(cur, from, passable);
    }