Search in sources :

Example 1 with ScrollHolder

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

the class Level method drop.

public Heap drop(Item item, int cell) {
    if (Dungeon.isChallenged(Challenges.NO_FOOD) && item instanceof Food) {
        item = new Gold(item.price());
    } else if (Dungeon.isChallenged(Challenges.NO_ARMOR) && item instanceof Armor) {
        item = new Gold(item.price());
    } else if (Dungeon.isChallenged(Challenges.NO_HEALING) && item instanceof PotionOfHealing) {
        item = new Gold(item.price());
    } else if (Dungeon.isChallenged(Challenges.NO_HERBALISM) && item instanceof SeedPouch) {
        item = new Gold(item.price());
    } else if (Dungeon.isChallenged(Challenges.NO_SCROLLS) && (item instanceof Scroll || item instanceof ScrollHolder)) {
        if (item instanceof ScrollOfUpgrade) {
        // These scrolls still can be found
        } else {
            item = new Gold(item.price());
        }
    }
    if ((map[cell] == Terrain.ALCHEMY) && !(item instanceof Plant.Seed)) {
        int n;
        do {
            n = cell + NEIGHBOURS8[Random.Int(8)];
        } while (map[n] != Terrain.EMPTY_SP);
        cell = n;
    }
    Heap heap = heaps.get(cell);
    if (heap == null) {
        heap = new Heap();
        heap.pos = cell;
        if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) {
            Dungeon.dropToChasm(item);
            GameScene.discard(heap);
        } else {
            heaps.put(cell, heap);
            GameScene.add(heap);
        }
    } else if (heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST) {
        int n;
        do {
            n = cell + Level.NEIGHBOURS8[Random.Int(8)];
        } while (!Level.passable[n] && !Level.avoid[n]);
        return drop(item, n);
    }
    heap.drop(item);
    if (Dungeon.level != null) {
        press(cell, null);
    }
    return heap;
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Plant(com.watabou.pixeldungeon.plants.Plant) Armor(com.watabou.pixeldungeon.items.armor.Armor) SeedPouch(com.watabou.pixeldungeon.items.bags.SeedPouch) Scroll(com.watabou.pixeldungeon.items.scrolls.Scroll) PotionOfHealing(com.watabou.pixeldungeon.items.potions.PotionOfHealing) ScrollHolder(com.watabou.pixeldungeon.items.bags.ScrollHolder) ScrollOfUpgrade(com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade) Heap(com.watabou.pixeldungeon.items.Heap) Food(com.watabou.pixeldungeon.items.food.Food)

Example 2 with ScrollHolder

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

Aggregations

ScrollHolder (com.watabou.pixeldungeon.items.bags.ScrollHolder)2 SeedPouch (com.watabou.pixeldungeon.items.bags.SeedPouch)2 PotionOfHealing (com.watabou.pixeldungeon.items.potions.PotionOfHealing)2 Ankh (com.watabou.pixeldungeon.items.Ankh)1 Gold (com.watabou.pixeldungeon.items.Gold)1 Heap (com.watabou.pixeldungeon.items.Heap)1 Item (com.watabou.pixeldungeon.items.Item)1 Torch (com.watabou.pixeldungeon.items.Torch)1 Weightstone (com.watabou.pixeldungeon.items.Weightstone)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 WandHolster (com.watabou.pixeldungeon.items.bags.WandHolster)1 Food (com.watabou.pixeldungeon.items.food.Food)1 OverpricedRation (com.watabou.pixeldungeon.items.food.OverpricedRation)1 Scroll (com.watabou.pixeldungeon.items.scrolls.Scroll)1 ScrollOfIdentify (com.watabou.pixeldungeon.items.scrolls.ScrollOfIdentify)1 ScrollOfMagicMapping (com.watabou.pixeldungeon.items.scrolls.ScrollOfMagicMapping)1 ScrollOfRemoveCurse (com.watabou.pixeldungeon.items.scrolls.ScrollOfRemoveCurse)1 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)1 Plant (com.watabou.pixeldungeon.plants.Plant)1 Point (com.watabou.utils.Point)1