Search in sources :

Example 1 with Artifact

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

the class Bones method leave.

public static void leave() {
    item = null;
    switch(2) {
        case 0:
            item = Dungeon.hero.belongings.weapon;
            break;
        case 1:
            item = Dungeon.hero.belongings.armor;
            break;
        case 2:
            item = Dungeon.hero.belongings.ring1;
            break;
        case 3:
            item = Dungeon.hero.belongings.ring2;
            break;
    }
    if (item == null || (item instanceof Artifact && !(item instanceof Ring))) {
        if (Dungeon.gold() > 0) {
            item = new Gold(Random.IntRange(1, Dungeon.gold()));
        } else {
            item = new Gold(1);
        }
    }
    depth = Dungeon.depth;
    Bundle bundle = new Bundle();
    bundle.put(LEVEL, depth);
    bundle.put(ITEM, item);
    try {
        OutputStream output = FileSystem.getOutputStream(BONES_FILE);
        Bundle.write(bundle, output);
        output.close();
    } catch (IOException ignored) {
    }
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Ring(com.watabou.pixeldungeon.items.rings.Ring) Bundle(com.watabou.utils.Bundle) OutputStream(java.io.OutputStream) IOException(java.io.IOException) Artifact(com.watabou.pixeldungeon.items.rings.Artifact)

Example 2 with Artifact

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

the class ItemSlot method item.

public void item(Item item) {
    if (item == null) {
        active = false;
        icon.setVisible(false);
        emitter.setVisible(false);
        emitter.on = false;
        topLeft.setVisible(false);
        topRight.setVisible(false);
        bottomRight.setVisible(false);
        return;
    }
    active = true;
    icon.setVisible(true);
    topLeft.setVisible(true);
    topRight.setVisible(true);
    bottomRight.setVisible(true);
    icon.view(item);
    if (item.emitter() != null) {
        emitter.setVisible(true);
        emitter.pour(item.emitter(), item.emitterInterval());
    } else {
        emitter.setVisible(false);
        emitter.on = false;
    }
    topLeft.text(item.status());
    boolean isArmor = item instanceof Armor;
    boolean isWeapon = item instanceof Weapon;
    if (isArmor || isWeapon) {
        if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
            int str = isArmor ? ((Armor) item).STR : ((Weapon) item).STR;
            topRight.text(Utils.format(TXT_STRENGTH, str));
            if (str > Dungeon.hero.effectiveSTR()) {
                topRight.hardlight(DEGRADED);
            } else {
                topRight.resetColor();
            }
        } else {
            topRight.text(Utils.format(TXT_TYPICAL_STR, isArmor ? ((Armor) item).typicalSTR() : ((MeleeWeapon) item).typicalSTR()));
            topRight.hardlight(WARNING);
        }
        topRight.measure();
    } else {
        topRight.text(null);
    }
    int level = item.visiblyUpgraded();
    if (level != 0) {
        bottomRight.text(Utils.format(TXT_LEVEL, level));
        bottomRight.measure();
        bottomRight.hardlight(level > 0 ? UPGRADED : DEGRADED);
    } else {
        bottomRight.text(null);
    }
    if (item instanceof Artifact) {
        Artifact artifact = (Artifact) item;
        String text = artifact.getText();
        if (text != null) {
            topLeft.text(artifact.getText());
            topLeft.hardlight(artifact.getColor());
            topLeft.setVisible(true);
            topLeft.measure();
        }
    }
    layout();
}
Also used : MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) Armor(com.watabou.pixeldungeon.items.armor.Armor) Weapon(com.watabou.pixeldungeon.items.weapon.Weapon) MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) Artifact(com.watabou.pixeldungeon.items.rings.Artifact)

Aggregations

Artifact (com.watabou.pixeldungeon.items.rings.Artifact)2 Gold (com.watabou.pixeldungeon.items.Gold)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 Ring (com.watabou.pixeldungeon.items.rings.Ring)1 Weapon (com.watabou.pixeldungeon.items.weapon.Weapon)1 MeleeWeapon (com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon)1 Bundle (com.watabou.utils.Bundle)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1