Search in sources :

Example 1 with Thief

use of com.watabou.pixeldungeon.actors.mobs.Thief 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)

Aggregations

Fire (com.watabou.pixeldungeon.actors.blobs.Fire)1 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Thief (com.watabou.pixeldungeon.actors.mobs.Thief)1 Item (com.watabou.pixeldungeon.items.Item)1 ChargrilledMeat (com.watabou.pixeldungeon.items.food.ChargrilledMeat)1 MysteryMeat (com.watabou.pixeldungeon.items.food.MysteryMeat)1 Scroll (com.watabou.pixeldungeon.items.scrolls.Scroll)1