Search in sources :

Example 1 with Wand

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;
}
Also used : Wand(com.watabou.pixeldungeon.items.wands.Wand)

Example 2 with Wand

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);
            }
        }
    }
}
Also used : Armor(com.watabou.pixeldungeon.items.armor.Armor) Ring(com.watabou.pixeldungeon.items.rings.Ring) PointF(com.watabou.utils.PointF) Wand(com.watabou.pixeldungeon.items.wands.Wand) CharSprite(com.watabou.pixeldungeon.sprites.CharSprite) Weapon(com.watabou.pixeldungeon.items.weapon.Weapon) MissileWeapon(com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)

Example 3 with Wand

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;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Wand(com.watabou.pixeldungeon.items.wands.Wand)

Example 4 with Wand

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;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Wand(com.watabou.pixeldungeon.items.wands.Wand)

Example 5 with Wand

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;
}
Also used : MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) Wand(com.watabou.pixeldungeon.items.wands.Wand) KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon)

Aggregations

Wand (com.watabou.pixeldungeon.items.wands.Wand)5 Item (com.watabou.pixeldungeon.items.Item)2 KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 Ring (com.watabou.pixeldungeon.items.rings.Ring)1 Weapon (com.watabou.pixeldungeon.items.weapon.Weapon)1 MeleeWeapon (com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon)1 MissileWeapon (com.watabou.pixeldungeon.items.weapon.missiles.MissileWeapon)1 CharSprite (com.watabou.pixeldungeon.sprites.CharSprite)1 PointF (com.watabou.utils.PointF)1