Search in sources :

Example 1 with Shopkeeper

use of com.watabou.pixeldungeon.actors.mobs.npcs.Shopkeeper in project pixel-dungeon by watabou.

the class ShopPainter method placeShopkeeper.

private static void placeShopkeeper(Level level, Room room) {
    int pos;
    do {
        pos = room.random();
    } while (level.heaps.get(pos) != null);
    Mob shopkeeper = level instanceof LastShopLevel ? new ImpShopkeeper() : new Shopkeeper();
    shopkeeper.pos = pos;
    level.mobs.add(shopkeeper);
    if (level instanceof LastShopLevel) {
        for (int i = 0; i < Level.NEIGHBOURS9.length; i++) {
            int p = shopkeeper.pos + Level.NEIGHBOURS9[i];
            if (level.map[p] == Terrain.EMPTY_SP) {
                level.map[p] = Terrain.WATER;
            }
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Shopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.Shopkeeper) ImpShopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.ImpShopkeeper) ImpShopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.ImpShopkeeper) LastShopLevel(com.watabou.pixeldungeon.levels.LastShopLevel) Point(com.watabou.utils.Point)

Example 2 with Shopkeeper

use of com.watabou.pixeldungeon.actors.mobs.npcs.Shopkeeper in project pixel-dungeon-remix by NYRDS.

the class ShopPainter method placeShopkeeper.

private static void placeShopkeeper(Level level, Room room) {
    int pos;
    do {
        pos = room.random(level);
    } while (level.getHeap(pos) != null);
    Mob shopkeeper = level instanceof LastShopLevel ? new ImpShopkeeper() : new Shopkeeper();
    if (Dungeon.depth == 27) {
        shopkeeper = new AzuterronNPC();
    }
    shopkeeper.setPos(pos);
    level.mobs.add(shopkeeper);
    if (level instanceof LastShopLevel) {
        for (int i = 0; i < Level.NEIGHBOURS9.length; i++) {
            int p = shopkeeper.getPos() + Level.NEIGHBOURS9[i];
            if (level.map[p] == Terrain.EMPTY_SP) {
                level.map[p] = Terrain.WATER;
            }
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) AzuterronNPC(com.nyrds.pixeldungeon.mobs.npc.AzuterronNPC) Shopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.Shopkeeper) ImpShopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.ImpShopkeeper) ImpShopkeeper(com.watabou.pixeldungeon.actors.mobs.npcs.ImpShopkeeper) LastShopLevel(com.watabou.pixeldungeon.levels.LastShopLevel) Point(com.watabou.utils.Point)

Aggregations

Mob (com.watabou.pixeldungeon.actors.mobs.Mob)2 ImpShopkeeper (com.watabou.pixeldungeon.actors.mobs.npcs.ImpShopkeeper)2 Shopkeeper (com.watabou.pixeldungeon.actors.mobs.npcs.Shopkeeper)2 LastShopLevel (com.watabou.pixeldungeon.levels.LastShopLevel)2 Point (com.watabou.utils.Point)2 AzuterronNPC (com.nyrds.pixeldungeon.mobs.npc.AzuterronNPC)1