Search in sources :

Example 1 with KindOfWeapon

use of com.watabou.pixeldungeon.items.KindOfWeapon in project pixel-dungeon by watabou.

the class Hero method damageRoll.

@Override
public int damageRoll() {
    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    int dmg;
    if (wep != null) {
        dmg = wep.damageRoll(this);
    } else {
        dmg = STR() > 10 ? Random.IntRange(1, STR() - 9) : 1;
    }
    return buff(Fury.class) != null ? (int) (dmg * 1.5f) : dmg;
}
Also used : KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon)

Example 2 with KindOfWeapon

use of com.watabou.pixeldungeon.items.KindOfWeapon in project pixel-dungeon by watabou.

the class Hero method attackSkill.

@Override
public int attackSkill(Char target) {
    int bonus = 0;
    for (Buff buff : buffs(RingOfAccuracy.Accuracy.class)) {
        bonus += ((RingOfAccuracy.Accuracy) buff).level;
    }
    float accuracy = (bonus == 0) ? 1 : (float) Math.pow(1.4, bonus);
    if (rangedWeapon != null && Level.distance(pos, target.pos) == 1) {
        accuracy *= 0.5f;
    }
    KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
    if (wep != null) {
        return (int) (attackSkill * accuracy * wep.acuracyFactor(this));
    } else {
        return (int) (attackSkill * accuracy);
    }
}
Also used : RingOfAccuracy(com.watabou.pixeldungeon.items.rings.RingOfAccuracy) KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon) Buff(com.watabou.pixeldungeon.actors.buffs.Buff)

Example 3 with KindOfWeapon

use of com.watabou.pixeldungeon.items.KindOfWeapon 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)

Example 4 with KindOfWeapon

use of com.watabou.pixeldungeon.items.KindOfWeapon in project pixel-dungeon by watabou.

the class Monk method attackProc.

@Override
public int attackProc(Char enemy, int damage) {
    if (Random.Int(6) == 0 && enemy == Dungeon.hero) {
        Hero hero = Dungeon.hero;
        KindOfWeapon weapon = hero.belongings.weapon;
        if (weapon != null && !(weapon instanceof Knuckles) && !weapon.cursed) {
            hero.belongings.weapon = null;
            Dungeon.level.drop(weapon, hero.pos).sprite.drop();
            GLog.w(TXT_DISARM, name, weapon.name());
        }
    }
    return damage;
}
Also used : Knuckles(com.watabou.pixeldungeon.items.weapon.melee.Knuckles) Hero(com.watabou.pixeldungeon.actors.hero.Hero) KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon)

Aggregations

KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)4 Buff (com.watabou.pixeldungeon.actors.buffs.Buff)1 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 RingOfAccuracy (com.watabou.pixeldungeon.items.rings.RingOfAccuracy)1 Wand (com.watabou.pixeldungeon.items.wands.Wand)1 Knuckles (com.watabou.pixeldungeon.items.weapon.melee.Knuckles)1 MeleeWeapon (com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon)1