use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class Monk method attackProc.
@Override
public int attackProc(Char enemy, int damage) {
if (Random.Int(6) == 0 && enemy == Dungeon.hero) {
Hero hero = Dungeon.hero;
KindOfWeapon weapon = hero.belongings.weapon;
if (weapon != null && !(weapon instanceof Knuckles) && !weapon.cursed) {
hero.belongings.weapon = null;
Dungeon.level.drop(weapon, hero.pos).sprite.drop();
GLog.w(TXT_DISARM, name, weapon.name());
}
}
return damage;
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class Chasm method heroLand.
public static void heroLand() {
Hero hero = Dungeon.hero;
hero.sprite.burst(hero.sprite.blood(), 10);
Camera.main.shake(4, 0.2f);
Buff.prolong(hero, Cripple.class, Cripple.DURATION);
hero.damage(Random.IntRange(hero.HT / 3, hero.HT / 2), new Hero.Doom() {
@Override
public void onDeath() {
Badges.validateDeathFromFalling();
Dungeon.fail(Utils.format(ResultDescriptions.FALL, Dungeon.depth));
GLog.n("You fell to death...");
}
});
}
use of com.watabou.pixeldungeon.actors.hero.Hero 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();
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class WndTradeItem method sellOne.
private void sellOne(Item item) {
if (item.quantity() <= 1) {
sell(item);
} else {
Hero hero = Dungeon.hero;
item = item.detach(hero.belongings.backpack);
int price = item.price();
new Gold(price).doPickUp(hero);
GLog.i(TXT_SOLD, item.name(), price);
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class WndTradeItem method buy.
private void buy(Heap heap) {
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
int price = price(item);
Dungeon.gold -= price;
GLog.i(TXT_BOUGHT, item.name(), price);
if (!item.doPickUp(hero)) {
Dungeon.level.drop(item, heap.pos).sprite.drop();
}
}
Aggregations