Search in sources :

Example 1 with Item

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

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 2 with Item

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

the class HuntressArmor method doSpecial.

@Override
public void doSpecial() {
    Item proto = new Shuriken();
    for (Mob mob : Dungeon.level.mobs) {
        if (Level.fieldOfView[mob.pos]) {
            Callback callback = new Callback() {

                @Override
                public void call() {
                    curUser.attack(targets.get(this));
                    targets.remove(this);
                    if (targets.isEmpty()) {
                        curUser.spendAndNext(curUser.attackDelay());
                    }
                }
            };
            ((MissileSprite) curUser.sprite.parent.recycle(MissileSprite.class)).reset(curUser.pos, mob.pos, proto, callback);
            targets.put(callback, mob);
        }
    }
    if (targets.size() == 0) {
        GLog.w(TXT_NO_ENEMIES);
        return;
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.sprite.zap(curUser.pos);
    curUser.busy();
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Callback(com.watabou.utils.Callback) Shuriken(com.watabou.pixeldungeon.items.weapon.missiles.Shuriken) MissileSprite(com.watabou.pixeldungeon.sprites.MissileSprite)

Example 3 with Item

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

the class PoolPainter 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 < 4; 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 4 with Item

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

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.WIDTH || pos == door + Level.WIDTH) {
        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)

Example 5 with Item

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

the class CavesBossLevel method createItems.

@Override
protected void createItems() {
    Item item = Bones.get();
    if (item != null) {
        int pos;
        do {
            pos = Random.IntRange(ROOM_LEFT, ROOM_RIGHT) + Random.IntRange(ROOM_TOP + 1, ROOM_BOTTOM) * WIDTH;
        } while (pos == entrance || map[pos] == Terrain.SIGN);
        drop(item, pos).type = Heap.Type.SKELETON;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Aggregations

Item (com.watabou.pixeldungeon.items.Item)39 Heap (com.watabou.pixeldungeon.items.Heap)4 ArrayList (java.util.ArrayList)4 Hero (com.watabou.pixeldungeon.actors.hero.Hero)3 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)3 Point (com.watabou.utils.Point)3 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)2 Flare (com.watabou.pixeldungeon.effects.Flare)2 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)2 Gold (com.watabou.pixeldungeon.items.Gold)2 MysteryMeat (com.watabou.pixeldungeon.items.food.MysteryMeat)2 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)2 Wand (com.watabou.pixeldungeon.items.wands.Wand)2 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)2 Group (com.watabou.noosa.Group)1 SkinnedBlock (com.watabou.noosa.SkinnedBlock)1 DungeonTilemap (com.watabou.pixeldungeon.DungeonTilemap)1 FogOfWar (com.watabou.pixeldungeon.FogOfWar)1 Char (com.watabou.pixeldungeon.actors.Char)1 Blob (com.watabou.pixeldungeon.actors.blobs.Blob)1