use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin 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();
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method drRoll.
@Override
public int drRoll() {
int dr = 0;
Barkskin bark = buff(Barkskin.class);
if (belongings.armor != null) {
dr += Random.NormalIntRange(belongings.armor.DRMin(), belongings.armor.DRMax());
if (STR() < belongings.armor.STRReq()) {
dr -= 2 * (belongings.armor.STRReq() - STR());
dr = Math.max(dr, 0);
}
}
if (belongings.weapon != null)
dr += Random.NormalIntRange(0, belongings.weapon.defenseFactor(this));
if (bark != null)
dr += Random.NormalIntRange(0, bark.level());
return dr;
}
Aggregations