Search in sources :

Example 1 with EquipableItem

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

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);
    }
    // prevents on-upgrade effects like enchant/glyph removal
    first.level(first.level() + 1);
    Dungeon.hero.spendAndNext(2f);
    Badges.validateItemLevelAquired(first);
    if (second.isEquipped(Dungeon.hero)) {
        ((EquipableItem) second).doUnequip(Dungeon.hero, false);
    }
    second.detachAll(Dungeon.hero.belongings.backpack);
    if (second instanceof Armor) {
        BrokenSeal seal = ((Armor) second).checkSeal();
        if (seal != null) {
            Dungeon.level.drop(seal, Dungeon.hero.pos);
        }
    }
    Quest.reforged = true;
    Notes.remove(Notes.Landmark.TROLL);
}
Also used : EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) BrokenSeal(com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal) EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)

Example 2 with EquipableItem

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

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);
    new Gold(item.price()).doPickUp(hero);
    // selling items in the sell interface doesn't spend time
    hero.spend(-hero.cooldown());
}
Also used : Gold(com.shatteredpixel.shatteredpixeldungeon.items.Gold) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)

Aggregations

EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)2 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 BrokenSeal (com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal)1 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)1