Search in sources :

Example 61 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Hero method actPickUp.

private boolean actPickUp(HeroAction.PickUp action) {
    int dst = action.dst;
    if (pos == dst) {
        Heap heap = Dungeon.level.heaps.get(pos);
        if (heap != null) {
            Item item = heap.peek();
            if (item.doPickUp(this)) {
                heap.pickUp();
                if (item instanceof Dewdrop || item instanceof TimekeepersHourglass.sandBag || item instanceof DriedRose.Petal || item instanceof Key) {
                // Do Nothing
                } else {
                    boolean important = ((item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion) && ((Scroll) item).isKnown()) || ((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion) item).isKnown());
                    if (important) {
                        GLog.p(Messages.get(this, "you_now_have", item.name()));
                    } else {
                        GLog.i(Messages.get(this, "you_now_have", item.name()));
                    }
                }
                curAction = null;
            } else {
                heap.sprite.drop();
                ready();
            }
        } else {
            ready();
        }
        return false;
    } else if (getCloser(dst)) {
        return true;
    } else {
        ready();
        return false;
    }
}
Also used : PotionOfMight(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight) TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) PotionOfStrength(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) WndTradeItem(com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem) Dewdrop(com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) IronKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey) SkeletonKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey) GoldenKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey) Key(com.shatteredpixel.shatteredpixeldungeon.items.keys.Key) CrystalKey(com.shatteredpixel.shatteredpixeldungeon.items.keys.CrystalKey) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 62 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WellWater method affect.

protected boolean affect(int pos) {
    Heap heap;
    if (pos == Dungeon.hero.pos && affectHero(Dungeon.hero)) {
        cur[pos] = 0;
        return true;
    } else if ((heap = Dungeon.level.heaps.get(pos)) != null) {
        Item oldItem = heap.peek();
        Item newItem = affectItem(oldItem);
        if (newItem != null) {
            if (newItem == oldItem) {
            } else if (oldItem.quantity() > 1) {
                oldItem.quantity(oldItem.quantity() - 1);
                heap.drop(newItem);
            } else {
                heap.replace(oldItem, newItem);
            }
            heap.sprite.link();
            cur[pos] = 0;
            return true;
        } else {
            int newPlace;
            do {
                newPlace = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
            } while (!Dungeon.level.passable[newPlace] && !Dungeon.level.avoid[newPlace]);
            Dungeon.level.drop(heap.pickUp(), newPlace).sprite.drop(pos);
            return false;
        }
    } else {
        return false;
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 63 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Combo method getIcon.

@Override
public Image getIcon() {
    Image icon;
    if (((Hero) target).belongings.weapon != null) {
        icon = new ItemSprite(((Hero) target).belongings.weapon.image, null);
    } else {
        icon = new ItemSprite(new Item() {

            {
                image = ItemSpriteSheet.WEAPON_HOLDER;
            }
        });
    }
    if (count >= 10)
        icon.tint(0xFFFF0000);
    else if (count >= 8)
        icon.tint(0xFFFFCC00);
    else if (count >= 6)
        icon.tint(0xFFFFFF00);
    else if (count >= 4)
        icon.tint(0xFFCCFF00);
    else
        icon.tint(0xFF00FF00);
    return icon;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ItemSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite) Image(com.watabou.noosa.Image)

Example 64 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class LootIndicator method update.

@Override
public void update() {
    if (Dungeon.hero.ready) {
        Heap heap = Dungeon.level.heaps.get(Dungeon.hero.pos);
        if (heap != null) {
            Item item = heap.type == Heap.Type.CHEST || heap.type == Heap.Type.MIMIC ? ItemSlot.CHEST : heap.type == Heap.Type.LOCKED_CHEST ? ItemSlot.LOCKED_CHEST : heap.type == Heap.Type.CRYSTAL_CHEST ? ItemSlot.CRYSTAL_CHEST : heap.type == Heap.Type.TOMB ? ItemSlot.TOMB : heap.type == Heap.Type.SKELETON ? ItemSlot.SKELETON : heap.type == Heap.Type.REMAINS ? ItemSlot.REMAINS : heap.peek();
            if (item != lastItem || item.quantity() != lastQuantity) {
                lastItem = item;
                lastQuantity = item.quantity();
                slot.item(item);
                flash();
            }
            visible = true;
        } else {
            lastItem = null;
            visible = false;
        }
    }
    slot.enable(visible && Dungeon.hero.ready);
    super.update();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 65 with Item

use of com.shatteredpixel.shatteredpixeldungeon.items.Item in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WndAlchemy method updateState.

private void updateState() {
    ArrayList<Item> ingredients = filterInput(Item.class);
    Recipe recipe = Recipe.findRecipe(ingredients);
    if (recipe != null) {
        output.item(recipe.sampleOutput(ingredients));
        output.visible = true;
        btnCombine.enable(true);
    } else {
        btnCombine.enable(false);
        output.visible = false;
    }
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Recipe(com.shatteredpixel.shatteredpixeldungeon.items.Recipe)

Aggregations

Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)67 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)14 ArrayList (java.util.ArrayList)14 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)9 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)7 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)7 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)7 Point (com.watabou.utils.Point)7 IronKey (com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey)6 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)5 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)4 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)4 WndTradeItem (com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem)4 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)3 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)3 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)3 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)2 Belongings (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings)2 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)2 Ankh (com.shatteredpixel.shatteredpixeldungeon.items.Ankh)2