Search in sources :

Example 31 with Item

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

the class ShopPainter method range.

private static Item[] range() {
    ArrayList<Item> items = new ArrayList<>();
    switch(Dungeon.depth) {
        case 6:
            items.add((Random.Int(2) == 0 ? new Quarterstaff() : new Spear()).identify());
            items.add(new LeatherArmor().identify());
            items.add(new Weightstone());
            items.add(new TomeOfKnowledge().identify());
            break;
        case 11:
            items.add((Random.Int(2) == 0 ? new Sword() : new Mace()).identify());
            items.add(new MailArmor().identify());
            items.add(new Weightstone());
            items.add(new TomeOfKnowledge().identify());
            break;
        case 16:
            items.add((Random.Int(2) == 0 ? new Longsword() : new BattleAxe()).identify());
            items.add(new ScaleArmor().identify());
            items.add(new Weightstone());
            items.add(new TomeOfKnowledge().identify());
            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 Weightstone());
            items.add(new Torch());
            items.add(new Torch());
            break;
        case 27:
            switch(Random.Int(3)) {
                case 0:
                    items.add(new Claymore().identify());
                    break;
                case 1:
                    items.add(new Halberd().identify());
                    break;
                case 2:
                    items.add(new GothicArmor().identify());
                    break;
            }
            items.add(new PotionOfHealing());
            items.add(new PotionOfExperience());
            items.add(new PotionOfMight());
            break;
    }
    items.add(new PotionOfHealing());
    for (int i = 0; i < 2; 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());
    Collections.shuffle(items);
    return items.toArray(new Item[items.size()]);
}
Also used : PotionOfExperience(com.watabou.pixeldungeon.items.potions.PotionOfExperience) MailArmor(com.watabou.pixeldungeon.items.armor.MailArmor) ScrollOfIdentify(com.watabou.pixeldungeon.items.scrolls.ScrollOfIdentify) TomeOfKnowledge(com.nyrds.pixeldungeon.items.books.TomeOfKnowledge) ArrayList(java.util.ArrayList) BattleAxe(com.watabou.pixeldungeon.items.weapon.melee.BattleAxe) ScrollOfMagicMapping(com.watabou.pixeldungeon.items.scrolls.ScrollOfMagicMapping) Halberd(com.nyrds.pixeldungeon.items.guts.weapon.melee.Halberd) Torch(com.watabou.pixeldungeon.items.Torch) Item(com.watabou.pixeldungeon.items.Item) Longsword(com.watabou.pixeldungeon.items.weapon.melee.Longsword) Sword(com.watabou.pixeldungeon.items.weapon.melee.Sword) LeatherArmor(com.watabou.pixeldungeon.items.armor.LeatherArmor) PotionOfHealing(com.watabou.pixeldungeon.items.potions.PotionOfHealing) Glaive(com.watabou.pixeldungeon.items.weapon.melee.Glaive) GothicArmor(com.nyrds.pixeldungeon.items.guts.armor.GothicArmor) PotionOfMight(com.watabou.pixeldungeon.items.potions.PotionOfMight) Claymore(com.nyrds.pixeldungeon.items.guts.weapon.melee.Claymore) ScaleArmor(com.watabou.pixeldungeon.items.armor.ScaleArmor) Quarterstaff(com.watabou.pixeldungeon.items.weapon.melee.Quarterstaff) Point(com.watabou.utils.Point) Weightstone(com.watabou.pixeldungeon.items.Weightstone) WarHammer(com.watabou.pixeldungeon.items.weapon.melee.WarHammer) ScrollOfRemoveCurse(com.watabou.pixeldungeon.items.scrolls.ScrollOfRemoveCurse) PlateArmor(com.watabou.pixeldungeon.items.armor.PlateArmor) Mace(com.watabou.pixeldungeon.items.weapon.melee.Mace) OverpricedRation(com.watabou.pixeldungeon.items.food.OverpricedRation) Ankh(com.watabou.pixeldungeon.items.Ankh) Spear(com.watabou.pixeldungeon.items.weapon.melee.Spear)

Example 32 with Item

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

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.getWidth();
        if (level.getHeap(cell) != null) {
            do {
                cell = room.random(level);
            } while (level.getHeap(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 33 with Item

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

the class CityBossLevel method createItems.

@Override
protected void createItems() {
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = Random.IntRange(_Left() + 1, _Left() + HALL_WIDTH - 2) + Random.IntRange(TOP + HALL_HEIGHT + 1, TOP + HALL_HEIGHT + CHAMBER_HEIGHT) * getWidth();
        } while (pos == entrance);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 34 with Item

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

the class HallsBossLevel method createItems.

@Override
protected void createItems() {
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = Random.IntRange(_RoomLeft(), _RoomRight()) + Random.IntRange(_RoomTop() + 1, _RoomBottom()) * getWidth();
        } while (pos == entrance);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 35 with Item

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

the class AzuterronNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (Quest.completed) {
        sell();
        return true;
    }
    if (Quest.given) {
        Item item = hero.belongings.getItem(HeartOfDarkness.class);
        if (item != null) {
            item.removeItemFrom(Dungeon.hero);
            Item reward = new PotionOfMight();
            if (reward.doPickUp(Dungeon.hero)) {
                GLog.i(Hero.TXT_YOU_NOW_HAVE, reward.name());
            } else {
                Dungeon.level.drop(reward, hero.getPos()).sprite.drop();
            }
            Quest.complete();
            GameScene.show(new WndQuest(this, TXT_QUEST_END));
        } else {
            GameScene.show(new WndQuest(this, TXT_QUEST));
        }
    } else {
        GameScene.show(new WndQuest(this, TXT_QUEST_START));
        Quest.given = true;
        Quest.process();
        Journal.add(Journal.Feature.AZUTERRON.desc());
    }
    return true;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) WndTradeItem(com.watabou.pixeldungeon.windows.WndTradeItem) WndQuest(com.watabou.pixeldungeon.windows.WndQuest) PotionOfMight(com.watabou.pixeldungeon.items.potions.PotionOfMight)

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