Search in sources :

Example 6 with Pushing

use of com.watabou.pixeldungeon.effects.Pushing in project pixel-dungeon by watabou.

the class CursePersonification method attackProc.

@Override
public int attackProc(Char enemy, int damage) {
    for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
        int ofs = Level.NEIGHBOURS8[i];
        if (enemy.pos - pos == ofs) {
            int newPos = enemy.pos + ofs;
            if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar(newPos) == null) {
                Actor.addDelayed(new Pushing(enemy, enemy.pos, newPos), -1);
                enemy.pos = newPos;
                // FIXME
                if (enemy instanceof Mob) {
                    Dungeon.level.mobPress((Mob) enemy);
                } else {
                    Dungeon.level.press(newPos, enemy);
                }
            }
            break;
        }
    }
    return super.attackProc(enemy, damage);
}
Also used : Pushing(com.watabou.pixeldungeon.effects.Pushing)

Aggregations

Pushing (com.watabou.pixeldungeon.effects.Pushing)6 ArrayList (java.util.ArrayList)4 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)1 Char (com.watabou.pixeldungeon.actors.Char)1 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)1 Bee (com.watabou.pixeldungeon.actors.mobs.npcs.Bee)1 Item (com.watabou.pixeldungeon.items.Item)1