Search in sources :

Example 41 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Mob method die.

@Override
public void die(Object cause) {
    runMobScript("onDie", cause);
    Hero hero = Dungeon.hero;
    {
        // TODO we should move this block out of Mob class
        if (hero.heroClass == HeroClass.NECROMANCER) {
            if (hero.isAlive()) {
                if (hero.belongings.armor instanceof NecromancerRobe) {
                    hero.accumulateSoulPoints();
                }
            }
        }
        for (Item item : hero.belongings) {
            if (item instanceof BlackSkull && item.isEquipped(hero)) {
                ((BlackSkull) item).mobDied(this, hero);
            }
        }
    }
    {
        if (hero.isAlive()) {
            if (!friendly(hero)) {
                Statistics.enemiesSlain++;
                Badges.validateMonstersSlain();
                Statistics.qualifiedForNoKilling = false;
                if (Dungeon.nightMode) {
                    Statistics.nightHunt++;
                } else {
                    Statistics.nightHunt = 0;
                }
                Badges.validateNightHunter();
            }
            if (!(cause instanceof Mob) || hero.heroClass == HeroClass.NECROMANCER) {
                if (hero.lvl() <= maxLvl && exp > 0) {
                    hero.earnExp(exp);
                }
            }
        }
    }
    super.die(cause);
    Library.identify(Library.MOB, getMobClassName());
    if (hero.lvl() <= maxLvl + 2) {
        dropLoot();
    }
    if (hero.isAlive() && !Dungeon.visible[getPos()]) {
        GLog.i(TXT_DIED);
    }
}
Also used : NecromancerRobe(com.nyrds.pixeldungeon.items.common.armor.NecromancerRobe) Item(com.watabou.pixeldungeon.items.Item) Hero(com.watabou.pixeldungeon.actors.hero.Hero) BlackSkull(com.nyrds.pixeldungeon.items.necropolis.BlackSkull)

Example 42 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Monk method attackProc.

@Override
public int attackProc(@NonNull 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.getPos()).sprite.drop();
            GLog.w(TXT_DISARM, getName(), 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 43 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Foliage method evolve.

@Override
protected void evolve() {
    int from = getWidth() + 1;
    int to = getLength() - getWidth() - 1;
    int[] map = Dungeon.level.map;
    boolean regrowth = false;
    boolean visible = false;
    for (int pos = from; pos < to; pos++) {
        if (cur[pos] > 0) {
            off[pos] = cur[pos];
            volume += off[pos];
            if (map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY) {
                map[pos] = Terrain.GRASS;
                regrowth = true;
            }
            visible = visible || Dungeon.visible[pos];
        } else {
            off[pos] = 0;
        }
    }
    Hero hero = Dungeon.hero;
    if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.getPos()] > 0) {
        Buff.affect(hero, Shadows.class).prolong();
    }
    if (regrowth) {
        GameScene.updateMap();
    }
    if (visible) {
        Journal.add(Journal.Feature.GARDEN.desc());
    }
}
Also used : Shadows(com.watabou.pixeldungeon.actors.buffs.Shadows) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 44 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Burning method act.

@Override
public boolean act() {
    if (target.isAlive()) {
        if (target instanceof Hero) {
            Buff.prolong(target, Light.class, TICK * 1.01f);
        }
        int bonusDamage = Dungeon.depth / 2;
        target.damage(Random.Int(1 + bonusDamage, 5 + bonusDamage), this);
        applyToCarriedItems(new burnItem());
    } else {
        detach();
    }
    if (Dungeon.level.flammable[target.getPos()]) {
        GameScene.add(Blob.seed(target.getPos(), 4, Fire.class));
    }
    spend(TICK);
    left -= TICK;
    if (left <= 0 || Random.Float() > (2 + (float) target.hp() / target.ht()) / 3 || (Dungeon.level.water[target.getPos()] && !target.isFlying())) {
        detach();
    }
    return true;
}
Also used : Fire(com.watabou.pixeldungeon.actors.blobs.Fire) Hero(com.watabou.pixeldungeon.actors.hero.Hero) SuppressLint(android.annotation.SuppressLint)

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