Search in sources :

Example 1 with EquipableItem

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

the class Blacksmith method upgrade.

public static void upgrade(Item item1, Item item2) {
    Item first, second;
    if (item2.level() > item1.level()) {
        first = item2;
        second = item1;
    } else {
        first = item1;
        second = item2;
    }
    Sample.INSTANCE.play(Assets.SND_EVOKE);
    ScrollOfUpgrade.upgrade(Dungeon.hero);
    Item.evoke(Dungeon.hero);
    if (first.isEquipped(Dungeon.hero)) {
        ((EquipableItem) first).doUnequip(Dungeon.hero, true);
    }
    first.upgrade();
    GLog.p(TXT_LOOKS_BETTER, first.name());
    Dungeon.hero.spendAndNext(2f);
    Badges.validateItemLevelAquired(first);
    if (second.isEquipped(Dungeon.hero)) {
        ((EquipableItem) second).doUnequip(Dungeon.hero, false);
    }
    second.detachAll(Dungeon.hero.belongings.backpack);
    Quest.reforged = true;
    Journal.remove(Journal.Feature.TROLL);
}
Also used : Item(com.watabou.pixeldungeon.items.Item) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem)

Example 2 with EquipableItem

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

the class WndTradeItem method sell.

private void sell(Item item) {
    Hero hero = Dungeon.hero;
    if (item.isEquipped(hero) && !((EquipableItem) item).doUnequip(hero, false)) {
        return;
    }
    item.detachAll(hero.belongings.backpack);
    int price = item.price();
    new Gold(price).doPickUp(hero);
    GLog.i(TXT_SOLD, item.name(), price);
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Hero(com.watabou.pixeldungeon.actors.hero.Hero) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem)

Aggregations

EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)2 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Gold (com.watabou.pixeldungeon.items.Gold)1 Item (com.watabou.pixeldungeon.items.Item)1