Search in sources :

Example 1 with MeleeWeapon

use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon in project pixel-dungeon-remix by NYRDS.

the class Hero method attackProc.

@Override
public int attackProc(@NonNull 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() && damage > 0) {
                        wand.curCharges(wand.curCharges() + 1);
                        QuickSlot.refresh();
                        ScrollOfRecharging.charge(this);
                    }
                    damage += wand.curCharges();
                }
                break;
            case SNIPER:
                if (rangedWeapon != null) {
                    Buff.prolong(enemy, SnipersMark.class, attackDelay() * 1.1f);
                }
                break;
            case SHAMAN:
                if (wep instanceof Wand) {
                    Wand wand = (Wand) wep;
                    if (wand.affectTarget()) {
                        if (Random.Int(4) == 0) {
                            wand.zap(enemy.getPos());
                        }
                    }
                }
                break;
            default:
        }
    }
    for (Item item : belongings) {
        if (item instanceof IChaosItem && item.isEquipped(this)) {
            ((IChaosItem) item).ownerDoesDamage(this, damage);
        }
    }
    return damage;
}
Also used : MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) Item(com.watabou.pixeldungeon.items.Item) WndTradeItem(com.watabou.pixeldungeon.windows.WndTradeItem) IActingItem(com.nyrds.pixeldungeon.items.artifacts.IActingItem) IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) Wand(com.watabou.pixeldungeon.items.wands.Wand) KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon)

Example 2 with MeleeWeapon

use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon 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 3 with MeleeWeapon

use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon in project pixel-dungeon-remix by NYRDS.

the class ItemSlot method item.

public void item(Item item) {
    if (item == null) {
        active = false;
        icon.setVisible(false);
        emitter.setVisible(false);
        emitter.on = false;
        topLeft.setVisible(false);
        topRight.setVisible(false);
        bottomRight.setVisible(false);
        return;
    }
    active = true;
    icon.setVisible(true);
    topLeft.setVisible(true);
    topRight.setVisible(true);
    bottomRight.setVisible(true);
    icon.view(item);
    if (item.emitter() != null) {
        emitter.setVisible(true);
        emitter.pour(item.emitter(), item.emitterInterval());
    } else {
        emitter.setVisible(false);
        emitter.on = false;
    }
    topLeft.text(item.status());
    boolean isArmor = item instanceof Armor;
    boolean isWeapon = item instanceof Weapon;
    if (isArmor || isWeapon) {
        if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
            int str = isArmor ? ((Armor) item).STR : ((Weapon) item).STR;
            topRight.text(Utils.format(TXT_STRENGTH, str));
            if (str > Dungeon.hero.effectiveSTR()) {
                topRight.hardlight(DEGRADED);
            } else {
                topRight.resetColor();
            }
        } else {
            topRight.text(Utils.format(TXT_TYPICAL_STR, isArmor ? ((Armor) item).typicalSTR() : ((MeleeWeapon) item).typicalSTR()));
            topRight.hardlight(WARNING);
        }
        topRight.measure();
    } else {
        topRight.text(null);
    }
    int level = item.visiblyUpgraded();
    if (level != 0) {
        bottomRight.text(Utils.format(TXT_LEVEL, level));
        bottomRight.measure();
        bottomRight.hardlight(level > 0 ? UPGRADED : DEGRADED);
    } else {
        bottomRight.text(null);
    }
    if (item instanceof Artifact) {
        Artifact artifact = (Artifact) item;
        String text = artifact.getText();
        if (text != null) {
            topLeft.text(artifact.getText());
            topLeft.hardlight(artifact.getColor());
            topLeft.setVisible(true);
            topLeft.measure();
        }
    }
    layout();
}
Also used : MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) Armor(com.watabou.pixeldungeon.items.armor.Armor) Weapon(com.watabou.pixeldungeon.items.weapon.Weapon) MeleeWeapon(com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon) Artifact(com.watabou.pixeldungeon.items.rings.Artifact)

Aggregations

MeleeWeapon (com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon)3 KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)2 Wand (com.watabou.pixeldungeon.items.wands.Wand)2 IActingItem (com.nyrds.pixeldungeon.items.artifacts.IActingItem)1 IChaosItem (com.nyrds.pixeldungeon.items.chaos.IChaosItem)1 Item (com.watabou.pixeldungeon.items.Item)1 Armor (com.watabou.pixeldungeon.items.armor.Armor)1 Artifact (com.watabou.pixeldungeon.items.rings.Artifact)1 Weapon (com.watabou.pixeldungeon.items.weapon.Weapon)1 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)1