Search in sources :

Example 1 with Camouflage

use of com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage in project shattered-pixel-dungeon-gdx by 00-Evan.

the class HighGrass method trample.

public static void trample(Level level, int pos, Char ch) {
    Level.set(pos, Terrain.GRASS);
    GameScene.updateMap(pos);
    int naturalismLevel = 0;
    if (ch != null) {
        SandalsOfNature.Naturalism naturalism = ch.buff(SandalsOfNature.Naturalism.class);
        if (naturalism != null) {
            if (!naturalism.isCursed()) {
                naturalismLevel = naturalism.itemLevel() + 1;
                naturalism.charge();
            } else {
                naturalismLevel = -1;
            }
        }
    }
    if (naturalismLevel >= 0) {
        // Seed, scales from 1/16 to 1/4
        if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) {
            Item seed = Generator.random(Generator.Category.SEED);
            if (seed instanceof BlandfruitBush.Seed) {
                if (Random.Int(3) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) {
                    level.drop(seed, pos).sprite.drop();
                    Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++;
                }
            } else
                level.drop(seed, pos).sprite.drop();
        }
        // Dew, scales from 1/6 to 1/3
        if (Random.Int(24 - naturalismLevel * 3) <= 3) {
            level.drop(new Dewdrop(), pos).sprite.drop();
        }
    }
    int leaves = 4;
    if (ch instanceof Hero) {
        Hero hero = (Hero) ch;
        // Barkskin
        if (hero.subClass == HeroSubClass.WARDEN) {
            Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
            leaves += 4;
        }
        // Camouflage
        if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Camouflage.class)) {
            Buff.affect(hero, Camouflage.Camo.class).set(3 + hero.belongings.armor.level());
            leaves += 4;
        }
    }
    CellEmitter.get(pos).burst(LeafParticle.LEVEL_SPECIFIC, leaves);
    if (Dungeon.level.heroFOV[pos])
        Dungeon.observe();
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Camouflage(com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage) Dewdrop(com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) Barkskin(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin) SandalsOfNature(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature)

Aggregations

Barkskin (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Dewdrop (com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 Camouflage (com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage)1 SandalsOfNature (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature)1