Search in sources :

Example 71 with Item

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

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)

Example 72 with Item

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

the class CavesBossLevel 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 73 with Item

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

the class WandOfTelekinesis method transport.

private void transport(Heap heap) {
    Item item = heap.pickUp();
    item = item.pick(getCurUser(), heap.pos);
    if (item != null) {
        if (item.doPickUp(getCurUser())) {
            getCurUser().itemPickedUp(item);
        } else {
            Dungeon.level.drop(item, getCurUser().getPos()).sprite.drop();
        }
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 74 with Item

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

the class SpiderLevel method createItems.

@Override
protected void createItems() {
    int nItems = 3;
    while (Random.Float() < 0.3f) {
        nItems++;
    }
    for (int i = 0; i < nItems; i++) {
        drop(Generator.random(), randomRespawnCell()).type = Heap.Type.SKELETON;
    }
    for (Item item : itemsToSpawn) {
        int cell = randomRespawnCell();
        if (item instanceof ScrollOfUpgrade) {
            while (map[cell] == Terrain.FIRE_TRAP || map[cell] == Terrain.SECRET_FIRE_TRAP) {
                cell = randomRespawnCell();
            }
        }
        drop(item, cell).type = Heap.Type.HEAP;
    }
    Item item = Bones.get();
    if (item != null) {
        drop(item, randomRespawnCell()).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) ScrollOfUpgrade(com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 75 with Item

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

the class PlagueDoctorNPC method interact.

@Override
public boolean interact(final Hero hero) {
    getSprite().turnTo(getPos(), hero.getPos());
    if (Quest.completed) {
        GameScene.show(new WndQuest(this, TXT_QUEST_COMPLETED));
        return true;
    }
    if (Quest.given) {
        Item item = hero.belongings.getItem(RatHide.class);
        if (item != null && item.quantity() >= 5) {
            item.removeItemFrom(Dungeon.hero);
            Item reward = new RatArmor();
            reward.identify();
            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, (Utils.format(TXT_QUEST, 5))));
        }
    } else {
        String txtQuestStart = Utils.format(TXT_QUEST_START_M, 5);
        if (Dungeon.hero.getGender() == Utils.FEMININE) {
            txtQuestStart = Utils.format(TXT_QUEST_START_F, 5);
        }
        GameScene.show(new WndQuest(this, txtQuestStart));
        Quest.process(hero.getPos());
        Quest.given = true;
        Journal.add(Journal.Feature.PLAGUEDOCTOR.desc());
    }
    return true;
}
Also used : WndQuest(com.watabou.pixeldungeon.windows.WndQuest) Item(com.watabou.pixeldungeon.items.Item) RatArmor(com.nyrds.pixeldungeon.items.common.RatArmor)

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