Search in sources :

Example 1 with PotionOfLevitation

use of com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SecretChestChasmRoom method paint.

@Override
public void paint(Level level) {
    super.paint(level);
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.CHASM);
    Point p = new Point(left + 1, top + 1);
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p));
    p.x = right - 1;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p));
    p.y = bottom - 1;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p));
    p.x = left + 1;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(new GoldenKey(Dungeon.depth), level.pointToCell(p));
    p = new Point(left + 3, top + 3);
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST;
    p.x = right - 3;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST;
    p.y = bottom - 3;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST;
    p.x = left + 3;
    Painter.set(level, p, Terrain.EMPTY_SP);
    level.drop(Generator.random(), level.pointToCell(p)).type = Heap.Type.LOCKED_CHEST;
    level.addItemToSpawn(new PotionOfLevitation());
    entrance().set(Door.Type.HIDDEN);
}
Also used : GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) PotionOfLevitation(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation) Point(com.watabou.utils.Point)

Example 2 with PotionOfLevitation

use of com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation in project shattered-pixel-dungeon-gdx by 00-Evan.

the class TrapsRoom method paint.

public void paint(Level level) {
    Painter.fill(level, this, Terrain.WALL);
    Class<? extends Trap> trapClass;
    switch(Random.Int(4)) {
        case 0:
            trapClass = null;
            break;
        default:
            trapClass = Random.oneOf(levelTraps[Dungeon.depth / 5]);
            break;
    }
    if (trapClass == null) {
        Painter.fill(level, this, 1, Terrain.CHASM);
    } else {
        Painter.fill(level, this, 1, Terrain.TRAP);
    }
    Door door = entrance();
    door.set(Door.Type.REGULAR);
    int lastRow = level.map[left + 1 + (top + 1) * level.width()] == Terrain.CHASM ? Terrain.CHASM : Terrain.EMPTY;
    int x = -1;
    int y = -1;
    if (door.x == left) {
        x = right - 1;
        y = top + height() / 2;
        Painter.fill(level, x, top + 1, 1, height() - 2, lastRow);
    } else if (door.x == right) {
        x = left + 1;
        y = top + height() / 2;
        Painter.fill(level, x, top + 1, 1, height() - 2, lastRow);
    } else if (door.y == top) {
        x = left + width() / 2;
        y = bottom - 1;
        Painter.fill(level, left + 1, y, width() - 2, 1, lastRow);
    } else if (door.y == bottom) {
        x = left + width() / 2;
        y = top + 1;
        Painter.fill(level, left + 1, y, width() - 2, 1, lastRow);
    }
    for (Point p : getPoints()) {
        int cell = level.pointToCell(p);
        if (level.map[cell] == Terrain.TRAP) {
            try {
                level.setTrap(((Trap) trapClass.newInstance()).reveal(), cell);
            } catch (Exception e) {
                ShatteredPixelDungeon.reportException(e);
            }
        }
    }
    int pos = x + y * level.width();
    if (Random.Int(3) == 0) {
        if (lastRow == Terrain.CHASM) {
            Painter.set(level, pos, Terrain.EMPTY);
        }
        level.drop(prize(level), pos).type = Heap.Type.CHEST;
    } else {
        Painter.set(level, pos, Terrain.PEDESTAL);
        level.drop(prize(level), pos);
    }
    level.addItemToSpawn(new PotionOfLevitation());
}
Also used : PotionOfLevitation(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation) Point(com.watabou.utils.Point) Point(com.watabou.utils.Point)

Aggregations

PotionOfLevitation (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation)2 Point (com.watabou.utils.Point)2 GoldenKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey)1