Search in sources :

Example 1 with IChaosItem

use of com.nyrds.pixeldungeon.items.chaos.IChaosItem 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 IChaosItem

use of com.nyrds.pixeldungeon.items.chaos.IChaosItem in project pixel-dungeon-remix by NYRDS.

the class Hero method damage.

@Override
public void damage(int dmg, Object src) {
    restoreHealth = false;
    super.damage(dmg, src);
    checkIfFurious();
    interrupt();
    if (belongings.armor instanceof SpiderArmor) {
        // Armor proc
        if (Random.Int(100) < 50) {
            GameScene.add(Blob.seed(getPos(), Random.Int(5, 7), Web.class));
        }
    }
    for (Item item : belongings) {
        if (item instanceof IChaosItem && item.isEquipped(this)) {
            if (!(src instanceof Hunger)) {
                ((IChaosItem) item).ownerTakesDamage(dmg);
            }
        }
    }
}
Also used : 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) Hunger(com.watabou.pixeldungeon.actors.buffs.Hunger) Web(com.watabou.pixeldungeon.actors.blobs.Web) IChaosItem(com.nyrds.pixeldungeon.items.chaos.IChaosItem) SpiderArmor(com.nyrds.pixeldungeon.items.common.armor.SpiderArmor)

Aggregations

IActingItem (com.nyrds.pixeldungeon.items.artifacts.IActingItem)2 IChaosItem (com.nyrds.pixeldungeon.items.chaos.IChaosItem)2 Item (com.watabou.pixeldungeon.items.Item)2 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)2 SpiderArmor (com.nyrds.pixeldungeon.items.common.armor.SpiderArmor)1 Web (com.watabou.pixeldungeon.actors.blobs.Web)1 Hunger (com.watabou.pixeldungeon.actors.buffs.Hunger)1 KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)1 Wand (com.watabou.pixeldungeon.items.wands.Wand)1 MeleeWeapon (com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon)1