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;
}
Aggregations