Search in sources :

Example 1 with Armor

use of com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor 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 Armor

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

the class Guard method createLoot.

@Override
protected Item createLoot() {
    // first see if we drop armor, overall chance is 1/8
    if (Random.Int(2) == 0) {
        Armor loot;
        do {
            loot = Generator.randomArmor();
        // 50% chance of re-rolling tier 4 or 5 items
        } while (loot.tier >= 4 && Random.Int(2) == 0);
        loot.level(0);
        return loot;
    // otherwise, we may drop a health potion. overall chance is 1/8 * (6-potions dropped)/6
    // with 0 potions dropped that simplifies to 1/8
    } else {
        if (Random.Float() < ((6f - Dungeon.LimitedDrops.GUARD_HP.count) / 6f)) {
            Dungeon.LimitedDrops.GUARD_HP.drop();
            return new PotionOfHealing();
        }
    }
    return null;
}
Also used : Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) PotionOfHealing(com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing)

Example 3 with Armor

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

the class CursingTrap method curse.

public static void curse(Hero hero) {
    // items the trap wants to curse because it will create a more negative effect
    ArrayList<Item> priorityCurse = new ArrayList<>();
    // items the trap can curse if nothing else is available.
    ArrayList<Item> canCurse = new ArrayList<>();
    KindOfWeapon weapon = hero.belongings.weapon;
    if (weapon instanceof Weapon && !weapon.cursed && !(weapon instanceof Boomerang)) {
        if (((Weapon) weapon).enchantment == null)
            priorityCurse.add(weapon);
        else
            canCurse.add(weapon);
    }
    Armor armor = hero.belongings.armor;
    if (armor != null && !armor.cursed) {
        if (armor.glyph == null)
            priorityCurse.add(armor);
        else
            canCurse.add(armor);
    }
    KindofMisc misc1 = hero.belongings.misc1;
    if (misc1 != null) {
        canCurse.add(misc1);
    }
    KindofMisc misc2 = hero.belongings.misc2;
    if (misc2 != null) {
        canCurse.add(misc2);
    }
    Collections.shuffle(priorityCurse);
    Collections.shuffle(canCurse);
    int numCurses = Random.Int(2) == 0 ? 1 : 2;
    for (int i = 0; i < numCurses; i++) {
        if (!priorityCurse.isEmpty()) {
            curse(priorityCurse.remove(0));
        } else if (!canCurse.isEmpty()) {
            curse(canCurse.remove(0));
        }
    }
    EquipableItem.equipCursed(hero);
    GLog.n(Messages.get(CursingTrap.class, "curse"));
}
Also used : EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) KindofMisc(com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc) ArrayList(java.util.ArrayList) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Boomerang(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 4 with Armor

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

the class CryptRoom method prize.

private static Item prize(Level level) {
    // 1 floor set higher than normal
    Armor prize = Generator.randomArmor((Dungeon.depth / 5) + 1);
    if (Challenges.isItemBlocked(prize)) {
        return new Gold().random();
    }
    // if it isn't already cursed, give it a free upgrade
    if (!prize.cursed) {
        prize.upgrade();
        // curse the armor, unless it has a glyph
        if (!prize.hasGoodGlyph()) {
            prize.cursed = prize.cursedKnown = true;
            prize.inscribe(Armor.Glyph.randomCurse());
        }
    }
    return prize;
}
Also used : Gold(com.shatteredpixel.shatteredpixeldungeon.items.Gold) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)

Example 5 with Armor

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

the class Generator method randomArmor.

public static Armor randomArmor(int floorSet) {
    floorSet = (int) GameMath.gate(0, floorSet, floorSetTierProbs.length - 1);
    try {
        Armor a = (Armor) Category.ARMOR.classes[Random.chances(floorSetTierProbs[floorSet])].newInstance();
        a.random();
        return a;
    } catch (Exception e) {
        ShatteredPixelDungeon.reportException(e);
        return null;
    }
}
Also used : PlateArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor) MailArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) LeatherArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor) ScaleArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor) ClothArmor(com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor)

Aggregations

Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)8 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)3 Weapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)3 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)2 Momentum (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum)1 BrokenSeal (com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal)1 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)1 KindOfWeapon (com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)1 KindofMisc (com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc)1 ClothArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor)1 LeatherArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor)1 MailArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor)1 PlateArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor)1 ScaleArmor (com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor)1 Bag (com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag)1 PotionOfHealing (com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing)1 Ring (com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring)1 Wand (com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)1 Boomerang (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang)1 HeroSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite)1