Search in sources :

Example 51 with Item

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

the class ShopPainter method range.

private static Item[] range() {
    ArrayList<Item> items = new ArrayList<Item>();
    switch(Dungeon.depth) {
        case 6:
            items.add((Random.Int(2) == 0 ? new Quarterstaff() : new Spear()).identify());
            items.add(new LeatherArmor().identify());
            items.add(new SeedPouch());
            items.add(new Weightstone());
            break;
        case 11:
            items.add((Random.Int(2) == 0 ? new Sword() : new Mace()).identify());
            items.add(new MailArmor().identify());
            items.add(new ScrollHolder());
            items.add(new Weightstone());
            break;
        case 16:
            items.add((Random.Int(2) == 0 ? new Longsword() : new BattleAxe()).identify());
            items.add(new ScaleArmor().identify());
            items.add(new WandHolster());
            items.add(new Weightstone());
            break;
        case 21:
            switch(Random.Int(3)) {
                case 0:
                    items.add(new Glaive().identify());
                    break;
                case 1:
                    items.add(new WarHammer().identify());
                    break;
                case 2:
                    items.add(new PlateArmor().identify());
                    break;
            }
            items.add(new Torch());
            items.add(new Torch());
            break;
    }
    items.add(new PotionOfHealing());
    for (int i = 0; i < 3; i++) {
        items.add(Generator.random(Generator.Category.POTION));
    }
    items.add(new ScrollOfIdentify());
    items.add(new ScrollOfRemoveCurse());
    items.add(new ScrollOfMagicMapping());
    items.add(Generator.random(Generator.Category.SCROLL));
    items.add(new OverpricedRation());
    items.add(new OverpricedRation());
    items.add(new Ankh());
    Item[] range = items.toArray(new Item[0]);
    Random.shuffle(range);
    return range;
}
Also used : ScrollOfIdentify(com.watabou.pixeldungeon.items.scrolls.ScrollOfIdentify) ArrayList(java.util.ArrayList) ScrollHolder(com.watabou.pixeldungeon.items.bags.ScrollHolder) ScrollOfMagicMapping(com.watabou.pixeldungeon.items.scrolls.ScrollOfMagicMapping) Torch(com.watabou.pixeldungeon.items.Torch) Item(com.watabou.pixeldungeon.items.Item) PotionOfHealing(com.watabou.pixeldungeon.items.potions.PotionOfHealing) Point(com.watabou.utils.Point) Weightstone(com.watabou.pixeldungeon.items.Weightstone) WandHolster(com.watabou.pixeldungeon.items.bags.WandHolster) ScrollOfRemoveCurse(com.watabou.pixeldungeon.items.scrolls.ScrollOfRemoveCurse) OverpricedRation(com.watabou.pixeldungeon.items.food.OverpricedRation) Ankh(com.watabou.pixeldungeon.items.Ankh) SeedPouch(com.watabou.pixeldungeon.items.bags.SeedPouch)

Example 52 with Item

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

the class ShopPainter method paint.

public static void paint(Level level, Room room) {
    fill(level, room, Terrain.WALL);
    fill(level, room, 1, Terrain.EMPTY_SP);
    pasWidth = room.width() - 2;
    pasHeight = room.height() - 2;
    int per = pasWidth * 2 + pasHeight * 2;
    Item[] range = range();
    int pos = xy2p(room, room.entrance()) + (per - range.length) / 2;
    for (int i = 0; i < range.length; i++) {
        Point xy = p2xy(room, (pos + per) % per);
        int cell = xy.x + xy.y * Level.WIDTH;
        if (level.heaps.get(cell) != null) {
            do {
                cell = room.random();
            } while (level.heaps.get(cell) != null);
        }
        level.drop(range[i], cell).type = Heap.Type.FOR_SALE;
        pos++;
    }
    placeShopkeeper(level, room);
    for (Room.Door door : room.connected.values()) {
        door.set(Room.Door.Type.REGULAR);
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Point(com.watabou.utils.Point) Room(com.watabou.pixeldungeon.levels.Room) Point(com.watabou.utils.Point)

Example 53 with Item

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

Example 54 with Item

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

the class RegularLevel method createItems.

@Override
protected void createItems() {
    int nItems = 3;
    while (Random.Float() < 0.4f) {
        nItems++;
    }
    for (int i = 0; i < nItems; i++) {
        Heap.Type type = null;
        switch(Random.Int(20)) {
            case 0:
                type = Heap.Type.SKELETON;
                break;
            case 1:
            case 2:
            case 3:
            case 4:
                type = Heap.Type.CHEST;
                break;
            case 5:
                type = Dungeon.depth > 1 ? Heap.Type.MIMIC : Heap.Type.CHEST;
                break;
            default:
                type = Heap.Type.HEAP;
        }
        drop(Generator.random(), randomDropCell()).type = type;
    }
    for (Item item : itemsToSpawn) {
        int cell = randomDropCell();
        if (item instanceof ScrollOfUpgrade) {
            while (map[cell] == Terrain.FIRE_TRAP || map[cell] == Terrain.SECRET_FIRE_TRAP) {
                cell = randomDropCell();
            }
        }
        drop(item, cell).type = Heap.Type.HEAP;
    }
    Item item = Bones.get();
    if (item != null) {
        drop(item, randomDropCell()).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Heap(com.watabou.pixeldungeon.items.Heap) ScrollOfUpgrade(com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 55 with Item

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

the class TrapsPainter method prize.

private static Item prize(Level level) {
    Item prize = level.itemToSpanAsPrize();
    if (prize != null) {
        return prize;
    }
    prize = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR));
    for (int i = 0; i < 3; i++) {
        Item another = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR));
        if (another.level() > prize.level()) {
            prize = another;
        }
    }
    return prize;
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Aggregations

Item (com.watabou.pixeldungeon.items.Item)93 Hero (com.watabou.pixeldungeon.actors.hero.Hero)8 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)8 Heap (com.watabou.pixeldungeon.items.Heap)6 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)6 Point (com.watabou.utils.Point)6 ArrayList (java.util.ArrayList)6 IChaosItem (com.nyrds.pixeldungeon.items.chaos.IChaosItem)5 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)5 Gold (com.watabou.pixeldungeon.items.Gold)5 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)5 IActingItem (com.nyrds.pixeldungeon.items.artifacts.IActingItem)4 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)4 Wand (com.watabou.pixeldungeon.items.wands.Wand)4 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)3 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)3 TomeOfKnowledge (com.nyrds.pixeldungeon.items.books.TomeOfKnowledge)2 BlackSkull (com.nyrds.pixeldungeon.items.necropolis.BlackSkull)2 Char (com.watabou.pixeldungeon.actors.Char)2 Belongings (com.watabou.pixeldungeon.actors.hero.Belongings)2