Search in sources :

Example 1 with Scroll

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Burning method act.

@Override
public boolean act() {
    if (target.isAlive()) {
        int damage = Random.NormalIntRange(1, 3 + target.HT / 40);
        Buff.detach(target, Chill.class);
        if (target instanceof Hero) {
            Hero hero = (Hero) target;
            if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Brimstone.class)) {
                Buff.affect(target, Brimstone.BrimstoneShield.class);
            } else {
                hero.damage(damage, this);
                burnIncrement++;
                // at 4+ turns, there is a (turns-3)/3 chance an item burns
                if (Random.Int(3) < (burnIncrement - 3)) {
                    burnIncrement = 0;
                    ArrayList<Item> burnable = new ArrayList<>();
                    // does not reach inside of containers
                    for (Item i : hero.belongings.backpack.items) {
                        if ((i instanceof Scroll && !(i instanceof ScrollOfUpgrade || i instanceof ScrollOfMagicalInfusion)) || i instanceof MysteryMeat) {
                            burnable.add(i);
                        }
                    }
                    if (!burnable.isEmpty()) {
                        Item toBurn = Random.element(burnable).detach(hero.belongings.backpack);
                        if (toBurn instanceof MysteryMeat) {
                            ChargrilledMeat steak = new ChargrilledMeat();
                            if (!steak.collect(hero.belongings.backpack)) {
                                Dungeon.level.drop(steak, hero.pos).sprite.drop();
                            }
                        }
                        Heap.burnFX(hero.pos);
                        GLog.w(Messages.get(this, "burnsup", Messages.capitalize(toBurn.toString())));
                    }
                }
            }
        } else {
            target.damage(damage, this);
        }
        if (target instanceof Thief) {
            Item item = ((Thief) target).item;
            if (item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) {
                target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
                ((Thief) target).item = null;
            } else if (item instanceof MysteryMeat) {
                target.sprite.emitter().burst(ElmoParticle.FACTORY, 6);
                ((Thief) target).item = new ChargrilledMeat();
            }
        }
    } else {
        Brimstone.BrimstoneShield brimShield = target.buff(Brimstone.BrimstoneShield.class);
        if (brimShield != null)
            brimShield.startDecay();
        detach();
    }
    if (Dungeon.level.flamable[target.pos] && Blob.volumeAt(target.pos, Fire.class) == 0) {
        GameScene.add(Blob.seed(target.pos, 4, Fire.class));
    }
    spend(TICK);
    left -= TICK;
    if (left <= 0 || (Dungeon.level.water[target.pos] && !target.flying)) {
        detach();
    }
    return true;
}
Also used : ChargrilledMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat) Thief(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) ArrayList(java.util.ArrayList) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Brimstone(com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone) Fire(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)

Example 2 with Scroll

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ShopRoom method ChooseBag.

protected static Bag ChooseBag(Belongings pack) {
    // 0=pouch, 1=holder, 2=bandolier, 3=holster
    int[] bagItems = new int[4];
    // count up items in the main bag
    for (Item item : pack.backpack.items) {
        if (item instanceof Plant.Seed || item instanceof Runestone)
            bagItems[0]++;
        if (item instanceof Scroll)
            bagItems[1]++;
        if (item instanceof Potion)
            bagItems[2]++;
        if (item instanceof Wand || item instanceof MissileWeapon)
            bagItems[3]++;
    }
    // disqualify bags that have already been dropped
    if (Dungeon.LimitedDrops.VELVET_POUCH.dropped())
        bagItems[0] = -1;
    if (Dungeon.LimitedDrops.SCROLL_HOLDER.dropped())
        bagItems[1] = -1;
    if (Dungeon.LimitedDrops.POTION_BANDOLIER.dropped())
        bagItems[2] = -1;
    if (Dungeon.LimitedDrops.MAGICAL_HOLSTER.dropped())
        bagItems[3] = -1;
    // find the best bag to drop. This does give a preference to later bags, if counts are equal
    int bestBagIdx = 0;
    for (int i = 1; i <= 3; i++) {
        if (bagItems[bestBagIdx] <= bagItems[i]) {
            bestBagIdx = i;
        }
    }
    // drop it, or return nothing if no bag works
    if (bagItems[bestBagIdx] == -1)
        return null;
    switch(bestBagIdx) {
        case 0:
        default:
            Dungeon.LimitedDrops.VELVET_POUCH.drop();
            return new VelvetPouch();
        case 1:
            Dungeon.LimitedDrops.SCROLL_HOLDER.drop();
            return new ScrollHolder();
        case 2:
            Dungeon.LimitedDrops.POTION_BANDOLIER.drop();
            return new PotionBandolier();
        case 3:
            Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop();
            return new MagicalHolster();
    }
}
Also used : Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) VelvetPouch(com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch) ScrollHolder(com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder) Runestone(com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone) Point(com.watabou.utils.Point) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Plant(com.shatteredpixel.shatteredpixeldungeon.plants.Plant) MagicalHolster(com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster) PotionBandolier(com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier) MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 3 with Scroll

use of com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Heap method burn.

public void burn() {
    if (type == Type.MIMIC) {
        Mimic m = Mimic.spawnAt(pos, items);
        if (m != null) {
            Buff.affect(m, Burning.class).reignite(m);
            m.sprite.emitter().burst(FlameParticle.FACTORY, 5);
            destroy();
        }
    }
    if (type != Type.HEAP) {
        return;
    }
    boolean burnt = false;
    boolean evaporated = false;
    for (Item item : items.toArray(new Item[0])) {
        if (item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) {
            items.remove(item);
            burnt = true;
        } else if (item instanceof Dewdrop) {
            items.remove(item);
            evaporated = true;
        } else if (item instanceof MysteryMeat) {
            replace(item, ChargrilledMeat.cook((MysteryMeat) item));
            burnt = true;
        } else if (item instanceof Bomb) {
            items.remove(item);
            ((Bomb) item).explode(pos);
            // stop processing the burning, it will be replaced by the explosion.
            return;
        }
    }
    if (burnt || evaporated) {
        if (Dungeon.level.heroFOV[pos]) {
            if (burnt) {
                burnFX(pos);
            } else {
                evaporateFX(pos);
            }
        }
        if (isEmpty()) {
            destroy();
        } else if (sprite != null) {
            sprite.view(items.peek());
        }
    }
}
Also used : Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) ScrollOfMagicalInfusion(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion) MysteryMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat) ScrollOfUpgrade(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade) Burning(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)

Aggregations

Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)3 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)2 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)2 ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)2 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Burning (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)1 Brimstone (com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone)1 MagicalHolster (com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster)1 PotionBandolier (com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier)1 ScrollHolder (com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder)1 VelvetPouch (com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch)1 ChargrilledMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 Runestone (com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone)1 Wand (com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)1 MissileWeapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)1