use of com.watabou.pixeldungeon.items.wands.Wand in project pixel-dungeon by watabou.
the class WaterOfTransmutation method changeWand.
private Wand changeWand(Wand w) {
Wand n;
do {
n = (Wand) Generator.random(Category.WAND);
} while (n.getClass() == w.getClass());
n.level(0);
n.upgrade(w.level());
n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown;
n.cursed = w.cursed;
return n;
}
use of com.watabou.pixeldungeon.items.wands.Wand in project pixel-dungeon by watabou.
the class Item method use.
public void use() {
if (level > 0 && !isBroken()) {
int threshold = (int) (maxDurability() * DURABILITY_WARNING_LEVEL);
if (durability-- >= threshold && threshold > durability && levelKnown) {
GLog.w(TXT_GONNA_BREAK, name());
}
if (isBroken()) {
getBroken();
if (levelKnown) {
GLog.n(TXT_BROKEN, name());
Dungeon.hero.interrupt();
CharSprite sprite = Dungeon.hero.sprite;
PointF point = sprite.center().offset(0, -16);
if (this instanceof Weapon) {
sprite.parent.add(Degradation.weapon(point));
} else if (this instanceof Armor) {
sprite.parent.add(Degradation.armor(point));
} else if (this instanceof Ring) {
sprite.parent.add(Degradation.ring(point));
} else if (this instanceof Wand) {
sprite.parent.add(Degradation.wand(point));
}
Sample.INSTANCE.play(Assets.SND_DEGRADE);
}
}
}
}
use of com.watabou.pixeldungeon.items.wands.Wand in project pixel-dungeon by watabou.
the class Belongings method charge.
public int charge(boolean full) {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand) item;
if (wand.curCharges < wand.maxCharges) {
wand.curCharges = full ? wand.maxCharges : wand.curCharges + 1;
count++;
wand.updateQuickslot();
}
}
}
return count;
}
use of com.watabou.pixeldungeon.items.wands.Wand in project pixel-dungeon by watabou.
the class Belongings method discharge.
public int discharge() {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand) item;
if (wand.curCharges > 0) {
wand.curCharges--;
count++;
wand.updateQuickslot();
}
}
}
return count;
}
use of com.watabou.pixeldungeon.items.wands.Wand in project pixel-dungeon by watabou.
the class Hero method attackProc.
@Override
public int attackProc(Char enemy, int damage) {
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
if (wep != null) {
wep.proc(this, enemy, damage);
switch(subClass) {
case GLADIATOR:
if (wep instanceof MeleeWeapon) {
damage += Buff.affect(this, Combo.class).hit(enemy, damage);
}
break;
case BATTLEMAGE:
if (wep instanceof Wand) {
Wand wand = (Wand) wep;
if (wand.curCharges >= wand.maxCharges) {
wand.use();
} else if (damage > 0) {
wand.curCharges++;
wand.updateQuickslot();
ScrollOfRecharging.charge(this);
}
damage += wand.curCharges;
}
case SNIPER:
if (rangedWeapon != null) {
Buff.prolong(this, SnipersMark.class, attackDelay() * 1.1f).object = enemy.id();
}
break;
default:
}
}
return damage;
}
Aggregations