Search in sources :

Example 26 with Item

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

the class Level method itemToSpanAsPrize.

public Item itemToSpanAsPrize() {
    if (Random.Int(itemsToSpawn.size() + 1) > 0) {
        Item item = Random.element(itemsToSpawn);
        itemsToSpawn.remove(item);
        return item;
    } else {
        return null;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 27 with Item

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

the class PrisonBossLevel method createItems.

@Override
protected void createItems() {
    int keyPos = anteroom.random(this);
    while (!passable[keyPos]) {
        keyPos = anteroom.random(this);
    }
    drop(new IronKey(), keyPos).type = Heap.Type.CHEST;
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = roomEntrance.random(this);
        } while (pos == entrance);
        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 28 with Item

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

the class RegularLevel 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(), randomDropCell()).type = Random.chances(Heap.regularHeaps);
    }
    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) ScrollOfUpgrade(com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 29 with Item

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

the class SewerBossLevel method createItems.

@Override
protected void createItems() {
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = roomEntrance.random(this);
        } while (pos == entrance);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 30 with Item

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

the class RatKingPainter method addChest.

private static void addChest(Level level, int pos, int door) {
    if (pos == door - 1 || pos == door + 1 || pos == door - level.getWidth() || pos == door + level.getWidth()) {
        return;
    }
    Item prize;
    switch(Random.Int(10)) {
        case 0:
            prize = Generator.random(Generator.Category.WEAPON);
            if (prize instanceof MissileWeapon) {
                prize.quantity(1);
            } else {
                prize.degrade(Random.Int(3));
            }
            break;
        case 1:
            prize = Generator.random(Generator.Category.ARMOR).degrade(Random.Int(3));
            break;
        default:
            prize = new Gold(Random.IntRange(1, 5));
            break;
    }
    level.drop(prize, pos).type = Heap.Type.CHEST;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Gold(com.watabou.pixeldungeon.items.Gold) MissileWeapon(com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)

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