Search in sources :

Example 1 with IronKey

use of com.watabou.pixeldungeon.items.keys.IronKey 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)

Example 2 with IronKey

use of com.watabou.pixeldungeon.items.keys.IronKey in project pixel-dungeon by watabou.

the class LibraryPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY);
    Room.Door entrance = room.entrance();
    Point a = null;
    Point b = null;
    if (entrance.x == room.left) {
        a = new Point(room.left + 1, entrance.y - 1);
        b = new Point(room.left + 1, entrance.y + 1);
        fill(level, room.right - 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.x == room.right) {
        a = new Point(room.right - 1, entrance.y - 1);
        b = new Point(room.right - 1, entrance.y + 1);
        fill(level, room.left + 1, room.top + 1, 1, room.height() - 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.top) {
        a = new Point(entrance.x + 1, room.top + 1);
        b = new Point(entrance.x - 1, room.top + 1);
        fill(level, room.left + 1, room.bottom - 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    } else if (entrance.y == room.bottom) {
        a = new Point(entrance.x + 1, room.bottom - 1);
        b = new Point(entrance.x - 1, room.bottom - 1);
        fill(level, room.left + 1, room.top + 1, room.width() - 1, 1, Terrain.BOOKSHELF);
    }
    if (a != null && level.map[a.x + a.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, a, Terrain.STATUE);
    }
    if (b != null && level.map[b.x + b.y * Level.WIDTH] == Terrain.EMPTY) {
        set(level, b, Terrain.STATUE);
    }
    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 || level.heaps.get(pos) != null);
        level.drop(prize(level), pos);
    }
    entrance.set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 3 with IronKey

use of com.watabou.pixeldungeon.items.keys.IronKey in project pixel-dungeon by watabou.

the class VaultPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    fill(level, room, 2, Terrain.EMPTY);
    int cx = (room.left + room.right) / 2;
    int cy = (room.top + room.bottom) / 2;
    int c = cx + cy * Level.WIDTH;
    switch(Random.Int(3)) {
        case 0:
            level.drop(prize(level), c).type = Type.LOCKED_CHEST;
            level.addItemToSpawn(new GoldenKey());
            break;
        case 1:
            Item i1, i2;
            do {
                i1 = prize(level);
                i2 = prize(level);
            } while (i1.getClass() == i2.getClass());
            level.drop(i1, c).type = Type.CRYSTAL_CHEST;
            level.drop(i2, c + Level.NEIGHBOURS8[Random.Int(8)]).type = Type.CRYSTAL_CHEST;
            level.addItemToSpawn(new GoldenKey());
            break;
        case 2:
            level.drop(prize(level), c);
            set(level, c, Terrain.PEDESTAL);
            break;
    }
    room.entrance().set(Room.Door.Type.LOCKED);
    level.addItemToSpawn(new IronKey());
}
Also used : Item(com.watabou.pixeldungeon.items.Item) GoldenKey(com.watabou.pixeldungeon.items.keys.GoldenKey) IronKey(com.watabou.pixeldungeon.items.keys.IronKey)

Example 4 with IronKey

use of com.watabou.pixeldungeon.items.keys.IronKey in project pixel-dungeon by watabou.

the class PitPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY);
    Room.Door entrance = room.entrance();
    entrance.set(Room.Door.Type.LOCKED);
    Point well = null;
    if (entrance.x == room.left) {
        well = new Point(room.right - 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.x == room.right) {
        well = new Point(room.left + 1, Random.Int(2) == 0 ? room.top + 1 : room.bottom - 1);
    } else if (entrance.y == room.top) {
        well = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.bottom - 1);
    } else if (entrance.y == room.bottom) {
        well = new Point(Random.Int(2) == 0 ? room.left + 1 : room.right - 1, room.top + 1);
    }
    set(level, well, Terrain.EMPTY_WELL);
    int remains = room.random();
    while (level.map[remains] == Terrain.EMPTY_WELL) {
        remains = room.random();
    }
    level.drop(new IronKey(), remains).type = Type.SKELETON;
    if (Random.Int(5) == 0) {
        level.drop(Generator.random(Generator.Category.RING), remains);
    } else {
        level.drop(Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR)), remains);
    }
    int n = Random.IntRange(1, 2);
    for (int i = 0; i < n; i++) {
        level.drop(prize(level), remains);
    }
}
Also used : IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 5 with IronKey

use of com.watabou.pixeldungeon.items.keys.IronKey in project pixel-dungeon by watabou.

the class PrisonBossLevel method createItems.

@Override
protected void createItems() {
    int keyPos = anteroom.random();
    while (!passable[keyPos]) {
        keyPos = anteroom.random();
    }
    drop(new IronKey(), keyPos).type = Heap.Type.CHEST;
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = roomEntrance.random();
        } while (pos == entrance || map[pos] == Terrain.SIGN);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) IronKey(com.watabou.pixeldungeon.items.keys.IronKey) Point(com.watabou.utils.Point)

Aggregations

IronKey (com.watabou.pixeldungeon.items.keys.IronKey)9 Point (com.watabou.utils.Point)7 Room (com.watabou.pixeldungeon.levels.Room)6 Item (com.watabou.pixeldungeon.items.Item)2 Alchemy (com.watabou.pixeldungeon.actors.blobs.Alchemy)1 Statue (com.watabou.pixeldungeon.actors.mobs.Statue)1 Gold (com.watabou.pixeldungeon.items.Gold)1 Heap (com.watabou.pixeldungeon.items.Heap)1 GoldenKey (com.watabou.pixeldungeon.items.keys.GoldenKey)1