Search in sources :

Example 26 with Hero

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;
}
Also used : Knuckles(com.watabou.pixeldungeon.items.weapon.melee.Knuckles) Hero(com.watabou.pixeldungeon.actors.hero.Hero) KindOfWeapon(com.watabou.pixeldungeon.items.KindOfWeapon)

Example 27 with Hero

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...");
        }
    });
}
Also used : Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 28 with Hero

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();
}
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)

Example 29 with Hero

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);
    }
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 30 with Hero

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();
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Aggregations

Hero (com.watabou.pixeldungeon.actors.hero.Hero)44 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)8 Item (com.watabou.pixeldungeon.items.Item)8 Char (com.watabou.pixeldungeon.actors.Char)6 Gold (com.watabou.pixeldungeon.items.Gold)5 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)4 BlackSkull (com.nyrds.pixeldungeon.items.necropolis.BlackSkull)2 Fire (com.watabou.pixeldungeon.actors.blobs.Fire)2 Barkskin (com.watabou.pixeldungeon.actors.buffs.Barkskin)2 Shadows (com.watabou.pixeldungeon.actors.buffs.Shadows)2 Thief (com.watabou.pixeldungeon.actors.mobs.Thief)2 Dewdrop (com.watabou.pixeldungeon.items.Dewdrop)2 KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)2 MysteryMeat (com.watabou.pixeldungeon.items.food.MysteryMeat)2 Herbalism (com.watabou.pixeldungeon.items.rings.RingOfHerbalism.Herbalism)2 RingOfSatiety (com.watabou.pixeldungeon.items.rings.RingOfSatiety)2 Knuckles (com.watabou.pixeldungeon.items.weapon.melee.Knuckles)2 Level (com.watabou.pixeldungeon.levels.Level)2 SuppressLint (android.annotation.SuppressLint)1 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)1