Search in sources :

Example 61 with Item

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

the class Burning method act.

@Override
public boolean act() {
    if (target.isAlive()) {
        if (target instanceof Hero) {
            Buff.prolong(target, Light.class, TICK * 1.01f);
        }
        target.damage(Random.Int(1, 5), this);
        if (target instanceof Hero) {
            Item item = ((Hero) target).belongings.randomUnequipped();
            if (item instanceof Scroll) {
                item = item.detach(((Hero) target).belongings.backpack);
                GLog.w(TXT_BURNS_UP, item.toString());
                Heap.burnFX(target.pos);
            } else if (item instanceof MysteryMeat) {
                item = item.detach(((Hero) target).belongings.backpack);
                ChargrilledMeat steak = new ChargrilledMeat();
                if (!steak.collect(((Hero) target).belongings.backpack)) {
                    Dungeon.level.drop(steak, target.pos).sprite.drop();
                }
                GLog.w(TXT_BURNS_UP, item.toString());
                Heap.burnFX(target.pos);
            }
        } else if (target instanceof Thief && ((Thief) target).item instanceof Scroll) {
            ((Thief) target).item = null;
            target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
        }
    } else {
        detach();
    }
    if (Level.flamable[target.pos]) {
        GameScene.add(Blob.seed(target.pos, 4, Fire.class));
    }
    spend(TICK);
    left -= TICK;
    if (left <= 0 || Random.Float() > (2 + (float) target.HP / target.HT) / 3 || (Level.water[target.pos] && !target.flying)) {
        detach();
    }
    return true;
}
Also used : Item(com.watabou.pixeldungeon.items.Item) ChargrilledMeat(com.watabou.pixeldungeon.items.food.ChargrilledMeat) Thief(com.watabou.pixeldungeon.actors.mobs.Thief) Scroll(com.watabou.pixeldungeon.items.scrolls.Scroll) Fire(com.watabou.pixeldungeon.actors.blobs.Fire) Hero(com.watabou.pixeldungeon.actors.hero.Hero) MysteryMeat(com.watabou.pixeldungeon.items.food.MysteryMeat)

Example 62 with Item

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

the class Frost method attachTo.

@Override
public boolean attachTo(Char target) {
    if (super.attachTo(target)) {
        target.paralysed = true;
        Burning.detach(target, Burning.class);
        if (target instanceof Hero) {
            Hero hero = (Hero) target;
            Item item = hero.belongings.randomUnequipped();
            if (item instanceof MysteryMeat) {
                item = item.detach(hero.belongings.backpack);
                FrozenCarpaccio carpaccio = new FrozenCarpaccio();
                if (!carpaccio.collect(hero.belongings.backpack)) {
                    Dungeon.level.drop(carpaccio, target.pos).sprite.drop();
                }
            }
        }
        return true;
    } else {
        return false;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) FrozenCarpaccio(com.watabou.pixeldungeon.items.food.FrozenCarpaccio) Hero(com.watabou.pixeldungeon.actors.hero.Hero) MysteryMeat(com.watabou.pixeldungeon.items.food.MysteryMeat)

Example 63 with Item

use of com.watabou.pixeldungeon.items.Item 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 64 with Item

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

the class Belongings method observe.

public void observe() {
    if (weapon != null) {
        weapon.identify();
        Badges.validateItemLevelAquired(weapon);
    }
    if (armor != null) {
        armor.identify();
        Badges.validateItemLevelAquired(armor);
    }
    if (ring1 != null) {
        ring1.identify();
        Badges.validateItemLevelAquired(ring1);
    }
    if (ring2 != null) {
        ring2.identify();
        Badges.validateItemLevelAquired(ring2);
    }
    for (Item item : backpack) {
        item.cursedKnown = true;
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item)

Example 65 with Item

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

Aggregations

Item (com.watabou.pixeldungeon.items.Item)93 Hero (com.watabou.pixeldungeon.actors.hero.Hero)8 WndTradeItem (com.watabou.pixeldungeon.windows.WndTradeItem)8 Heap (com.watabou.pixeldungeon.items.Heap)6 IronKey (com.watabou.pixeldungeon.items.keys.IronKey)6 Point (com.watabou.utils.Point)6 ArrayList (java.util.ArrayList)6 IChaosItem (com.nyrds.pixeldungeon.items.chaos.IChaosItem)5 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)5 Gold (com.watabou.pixeldungeon.items.Gold)5 WndQuest (com.watabou.pixeldungeon.windows.WndQuest)5 IActingItem (com.nyrds.pixeldungeon.items.artifacts.IActingItem)4 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)4 Wand (com.watabou.pixeldungeon.items.wands.Wand)4 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)3 ScrollOfUpgrade (com.watabou.pixeldungeon.items.scrolls.ScrollOfUpgrade)3 TomeOfKnowledge (com.nyrds.pixeldungeon.items.books.TomeOfKnowledge)2 BlackSkull (com.nyrds.pixeldungeon.items.necropolis.BlackSkull)2 Char (com.watabou.pixeldungeon.actors.Char)2 Belongings (com.watabou.pixeldungeon.actors.hero.Belongings)2