Search in sources :

Example 1 with Herbalism

use of com.watabou.pixeldungeon.items.rings.RingOfHerbalism.Herbalism in project pixel-dungeon by watabou.

the class HighGrass method trample.

public static void trample(Level level, int pos, Char ch) {
    Level.set(pos, Terrain.GRASS);
    GameScene.updateMap(pos);
    if (!Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
        int herbalismLevel = 0;
        if (ch != null) {
            Herbalism herbalism = ch.buff(Herbalism.class);
            if (herbalism != null) {
                herbalismLevel = herbalism.level;
            }
        }
        // Seed
        if (herbalismLevel >= 0 && Random.Int(18) <= Random.Int(herbalismLevel + 1)) {
            level.drop(Generator.random(Generator.Category.SEED), pos).sprite.drop();
        }
        // Dew
        if (herbalismLevel >= 0 && Random.Int(6) <= Random.Int(herbalismLevel + 1)) {
            level.drop(new Dewdrop(), pos).sprite.drop();
        }
    }
    int leaves = 4;
    // Warlock's barkskin
    if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN) {
        Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
        leaves = 8;
    }
    CellEmitter.get(pos).burst(LeafParticle.LEVEL_SPECIFIC, leaves);
    Dungeon.observe();
}
Also used : Dewdrop(com.watabou.pixeldungeon.items.Dewdrop) Hero(com.watabou.pixeldungeon.actors.hero.Hero) Barkskin(com.watabou.pixeldungeon.actors.buffs.Barkskin) Herbalism(com.watabou.pixeldungeon.items.rings.RingOfHerbalism.Herbalism)

Aggregations

Barkskin (com.watabou.pixeldungeon.actors.buffs.Barkskin)1 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Dewdrop (com.watabou.pixeldungeon.items.Dewdrop)1 Herbalism (com.watabou.pixeldungeon.items.rings.RingOfHerbalism.Herbalism)1