Search in sources :

Example 1 with Category

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

the class WaterOfTransmutation method changeWeapon.

private Weapon changeWeapon(MeleeWeapon w) {
    Weapon n;
    Category c = Generator.wepTiers[w.tier - 1];
    do {
        try {
            n = (MeleeWeapon) c.classes[Random.chances(c.probs)].newInstance();
        } catch (Exception e) {
            ShatteredPixelDungeon.reportException(e);
            return null;
        }
    } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
    int level = w.level();
    if (level > 0) {
        n.upgrade(level);
    } else if (level < 0) {
        n.degrade(-level);
    }
    n.enchantment = w.enchantment;
    n.levelKnown = w.levelKnown;
    n.cursedKnown = w.cursedKnown;
    n.cursed = w.cursed;
    n.imbue = w.imbue;
    return n;
}
Also used : Category(com.shatteredpixel.shatteredpixeldungeon.items.Generator.Category) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon) MeleeWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon)

Aggregations

Category (com.shatteredpixel.shatteredpixeldungeon.items.Generator.Category)1 Weapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)1 MeleeWeapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon)1