Search in sources :

Example 1 with MeleeWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon 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)

Example 2 with MeleeWeapon

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

the class Skeleton method createLoot.

@Override
protected Item createLoot() {
    Item loot;
    do {
        loot = Generator.randomWeapon();
    // 50% chance of re-rolling tier 4 or 5 melee weapons
    } while (((MeleeWeapon) loot).tier >= 4 && Random.Int(2) == 0);
    loot.level(0);
    return loot;
}
Also used : MeleeWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item)

Example 3 with MeleeWeapon

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

the class Generator method randomWeapon.

public static MeleeWeapon randomWeapon(int floorSet) {
    floorSet = (int) GameMath.gate(0, floorSet, floorSetTierProbs.length - 1);
    try {
        Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])];
        MeleeWeapon w = (MeleeWeapon) c.classes[Random.chances(c.probs)].newInstance();
        w.random();
        return w;
    } catch (Exception e) {
        ShatteredPixelDungeon.reportException(e);
        return null;
    }
}
Also used : MeleeWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon)

Aggregations

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