Search in sources :

Example 1 with Alchemy

use of com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SecretLaboratoryRoom method paint.

public void paint(Level level) {
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.EMPTY_SP);
    entrance().set(Door.Type.HIDDEN);
    Point pot = center();
    Painter.set(level, pot, Terrain.ALCHEMY);
    Alchemy alchemy = new Alchemy();
    alchemy.seed(level, pot.x + level.width() * pot.y, Random.IntRange(30, 60));
    level.blobs.put(Alchemy.class, alchemy);
    int n = Random.IntRange(2, 3);
    HashMap<Class<? extends Potion>, Float> chances = new HashMap<>(potionChances);
    for (int i = 0; i < n; i++) {
        int pos;
        do {
            pos = level.pointToCell(random());
        } while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
        try {
            Class<? extends Potion> potionCls = Random.chances(chances);
            chances.put(potionCls, 0f);
            level.drop(potionCls.newInstance(), pos);
        } catch (Exception e) {
            ShatteredPixelDungeon.reportException(e);
        }
    }
}
Also used : Alchemy(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy) Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) HashMap(java.util.HashMap) Point(com.watabou.utils.Point) Point(com.watabou.utils.Point)

Example 2 with Alchemy

use of com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy in project shattered-pixel-dungeon-gdx by 00-Evan.

the class LaboratoryRoom method paint.

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

Aggregations

Alchemy (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy)2 Point (com.watabou.utils.Point)2 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 HashMap (java.util.HashMap)1