Search in sources :

Example 1 with Alchemy

use of com.watabou.pixeldungeon.actors.blobs.Alchemy in project pixel-dungeon by watabou.

the class LaboratoryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    Room.Door entrance = room.entrance();
    Point pot = null;
    if (entrance.x == room.left) {
        pot = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.x == room.right) {
        pot = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.y == room.top) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
    } else if (entrance.y == room.bottom) {
        pot = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
    }
    set(level, pot, Terrain.ALCHEMY);
    Alchemy alchemy = new Alchemy();
    alchemy.seed(pot.x + Level.WIDTH * pot.y, 1);
    level.blobs.put(Alchemy.class, alchemy);
    int n = Random.IntRange(2, 3);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = room.random();
        } while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : Alchemy(com.watabou.pixeldungeon.actors.blobs.Alchemy) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Aggregations

Alchemy (com.watabou.pixeldungeon.actors.blobs.Alchemy)1 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)1 Room (com.watabou.pixeldungeon.levels.Room)1 Point (com.watabou.utils.Point)1