Search in sources :

Example 6 with Armor

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

the class ScrollOfRemoveCurse method uncurse.

public static boolean uncurse(Hero hero, Item... items) {
    boolean procced = false;
    for (Item item : items) {
        if (item != null && item.cursed) {
            item.cursed = false;
            procced = true;
        }
        if (item instanceof Weapon) {
            Weapon w = (Weapon) item;
            if (w.hasCurseEnchant()) {
                w.enchant(null);
                w.cursed = false;
                procced = true;
            }
        }
        if (item instanceof Armor) {
            Armor a = (Armor) item;
            if (a.hasCurseGlyph()) {
                a.inscribe(null);
                a.cursed = false;
                procced = true;
            }
        }
        if (item instanceof Bag) {
            for (Item bagItem : ((Bag) item).items) {
                if (bagItem != null && bagItem.cursed) {
                    bagItem.cursed = false;
                    procced = true;
                }
            }
        }
    }
    if (procced) {
        hero.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
        // for ring of might
        hero.updateHT(false);
    }
    return procced;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) WndBag(com.shatteredpixel.shatteredpixeldungeon.windows.WndBag) Bag(com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 7 with Armor

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

the class ScrollOfUpgrade method onItemSelected.

@Override
protected void onItemSelected(Item item) {
    upgrade(curUser);
    // ...yes this is rather messy
    if (item instanceof Weapon) {
        Weapon w = (Weapon) item;
        boolean wasCursed = w.cursed;
        boolean hadCursedEnchant = w.hasCurseEnchant();
        boolean hadGoodEnchant = w.hasGoodEnchant();
        w.upgrade();
        if (hadCursedEnchant && !w.hasCurseEnchant()) {
            removeCurse(Dungeon.hero);
        } else if (wasCursed && !w.cursed) {
            weakenCurse(Dungeon.hero);
        }
        if (hadGoodEnchant && !w.hasGoodEnchant()) {
            GLog.w(Messages.get(Weapon.class, "incompatible"));
        }
    } else if (item instanceof Armor) {
        Armor a = (Armor) item;
        boolean wasCursed = a.cursed;
        boolean hadCursedGlyph = a.hasCurseGlyph();
        boolean hadGoodGlyph = a.hasGoodGlyph();
        a.upgrade();
        if (hadCursedGlyph && !a.hasCurseGlyph()) {
            removeCurse(Dungeon.hero);
        } else if (wasCursed && !a.cursed) {
            weakenCurse(Dungeon.hero);
        }
        if (hadGoodGlyph && !a.hasGoodGlyph()) {
            GLog.w(Messages.get(Armor.class, "incompatible"));
        }
    } else if (item instanceof Wand || item instanceof Ring) {
        boolean wasCursed = item.cursed;
        item.upgrade();
        if (wasCursed && !item.cursed) {
            removeCurse(Dungeon.hero);
        }
    } else {
        item.upgrade();
    }
    Badges.validateItemLevelAquired(item);
}
Also used : Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) Ring(com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 8 with Armor

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

the class Hero method speed.

@Override
public float speed() {
    float speed = super.speed();
    speed *= RingOfHaste.speedMultiplier(this);
    Armor armor = belongings.armor;
    if (armor != null) {
        if (armor.hasGlyph(Swiftness.class)) {
            speed *= (1.1f + 0.01f * belongings.armor.level());
        } else if (armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]) {
            speed *= (1.5f + 0.05f * belongings.armor.level());
        }
    }
    int aEnc = armor != null ? armor.STRReq() - STR() : 0;
    if (aEnc > 0)
        speed /= Math.pow(1.2, aEnc);
    Momentum momentum = buff(Momentum.class);
    if (momentum != null) {
        ((HeroSprite) sprite).sprint(1f + 0.05f * momentum.stacks());
        speed *= momentum.speedMultiplier();
    }
    return speed;
}
Also used : Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) Momentum(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum) HeroSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite)

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