Search in sources :

Example 1 with ChargrilledMeat

use of com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat 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 ChargrilledMeat

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

the class SecretLarderRoom method paint.

@Override
public void paint(Level level) {
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.EMPTY_SP);
    Point c = center();
    Painter.fill(level, c.x - 1, c.y - 1, 3, 3, Terrain.WATER);
    Painter.set(level, c, Terrain.GRASS);
    level.plant(new BlandfruitBush.Seed(), level.pointToCell(c));
    int extraFood = (int) (Hunger.STARVING - Hunger.HUNGRY) * (1 + Dungeon.depth / 5);
    while (extraFood > 0) {
        Food food;
        if (extraFood >= Hunger.STARVING) {
            food = new Pasty();
            extraFood -= Hunger.STARVING;
        } else {
            food = new ChargrilledMeat();
            extraFood -= (Hunger.STARVING - Hunger.HUNGRY);
        }
        int foodPos;
        do {
            foodPos = level.pointToCell(random());
        } while (level.map[foodPos] != Terrain.EMPTY_SP || level.heaps.get(foodPos) != null);
        level.drop(food, foodPos);
    }
    entrance().set(Door.Type.HIDDEN);
}
Also used : Pasty(com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty) ChargrilledMeat(com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat) BlandfruitBush(com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush) Point(com.watabou.utils.Point) Point(com.watabou.utils.Point) Food(com.shatteredpixel.shatteredpixeldungeon.items.food.Food)

Aggregations

ChargrilledMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat)2 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 Brimstone (com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone)1 Food (com.shatteredpixel.shatteredpixeldungeon.items.food.Food)1 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)1 Pasty (com.shatteredpixel.shatteredpixeldungeon.items.food.Pasty)1 Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)1 ScrollOfMagicalInfusion (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion)1 ScrollOfUpgrade (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade)1 BlandfruitBush (com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush)1 Point (com.watabou.utils.Point)1 ArrayList (java.util.ArrayList)1