Search in sources :

Example 1 with Boss

use of com.watabou.pixeldungeon.actors.mobs.Boss in project pixel-dungeon-remix by NYRDS.

the class ChaosStaff method onZap.

@Override
protected void onZap(int cell) {
    ChaosCommon.doChaosMark(cell, 10 + level() * 10 + charge);
    charge = 0;
    if (Math.random() < 0.1f) {
        Char ch = Actor.findChar(cell);
        if (ch instanceof Mob) {
            Mob mob = (Mob) ch;
            if ((mob instanceof Boss) || (mob instanceof NPC)) {
                return;
            }
            switch(Random.Int(0, 4)) {
                case 0:
                    mob.die(getCurUser());
                    break;
                case 1:
                    Mob.makePet(mob, getCurUser());
                    break;
                case 2:
                    int nextCell = Dungeon.level.getEmptyCellNextTo(cell);
                    if (Dungeon.level.cellValid(nextCell)) {
                        try {
                            Mob newMob = mob.getClass().newInstance();
                            Dungeon.level.spawnMob(newMob);
                        } catch (Exception e) {
                            throw new TrackedRuntimeException(e);
                        }
                    }
                    break;
                case 3:
                    WandOfTeleportation.teleport(mob);
                    break;
                case 4:
                    PotionOfHealing.heal(ch, 1);
                    break;
            }
        }
    }
}
Also used : NPC(com.watabou.pixeldungeon.actors.mobs.npcs.NPC) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Boss(com.watabou.pixeldungeon.actors.mobs.Boss) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) Char(com.watabou.pixeldungeon.actors.Char) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException)

Example 2 with Boss

use of com.watabou.pixeldungeon.actors.mobs.Boss in project pixel-dungeon-remix by NYRDS.

the class WandOfTeleportation method onZap.

@Override
protected void onZap(int cell) {
    Char ch = Actor.findChar(cell);
    if (ch == getCurUser()) {
        setKnown();
        ScrollOfTeleportation.teleportHero(getCurUser());
    } else if (ch != null && !(ch instanceof Boss) && ch.isMovable()) {
        teleport(ch);
    } else {
        GLog.i(Game.getVar(R.string.WandOfTeleportation_Info2));
    }
}
Also used : Boss(com.watabou.pixeldungeon.actors.mobs.Boss) Char(com.watabou.pixeldungeon.actors.Char)

Example 3 with Boss

use of com.watabou.pixeldungeon.actors.mobs.Boss in project pixel-dungeon-remix by NYRDS.

the class SacrificialSword method applySpecial.

public void applySpecial(Hero hero, Char tgt) {
    if (tgt instanceof Boss) {
        return;
    }
    if (tgt instanceof NPC) {
        return;
    }
    if (!(tgt instanceof Mob)) {
        return;
    }
    Mob mob = (Mob) tgt;
    double conversionChance = baseChance(hero) + -mob.defenseSkill(hero) * 0.01 * mob.speed() - tgt.hp() * 0.01;
    double roll = Math.random();
    if (roll < conversionChance) {
        Mob.makePet(mob, hero);
    }
}
Also used : NPC(com.watabou.pixeldungeon.actors.mobs.npcs.NPC) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Boss(com.watabou.pixeldungeon.actors.mobs.Boss)

Example 4 with Boss

use of com.watabou.pixeldungeon.actors.mobs.Boss in project pixel-dungeon-remix by NYRDS.

the class Necrotism method act.

@Override
public boolean act() {
    if (target.isAlive()) {
        target.getSprite().burst(0x6935a5, 3);
        int damage;
        if (target instanceof Boss) {
            damage = (target.hp() / 200);
        } else {
            damage = (target.hp() / Math.max(3, (21 - iteration)));
        }
        target.damage(Math.max(1, damage * iteration), this);
        spend(TICK);
        int cell = target.getPos();
        for (int n : Level.NEIGHBOURS16) {
            int p = n + cell;
            Char ch = Actor.findChar(p);
            if (Dungeon.level.cellValid(p) && ch != null && !(ch instanceof Hero) && !(ch instanceof NPC)) {
                if (Random.Int(1) == 0 && !ch.hasBuff(Necrotism.class)) {
                    Buff.affect(ch, Necrotism.class).set(duration, iteration + 1);
                }
            }
        }
        if ((left -= TICK) <= 0) {
            detach();
        }
    } else {
        detach();
    }
    return true;
}
Also used : NPC(com.watabou.pixeldungeon.actors.mobs.npcs.NPC) Boss(com.watabou.pixeldungeon.actors.mobs.Boss) Char(com.watabou.pixeldungeon.actors.Char) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 5 with Boss

use of com.watabou.pixeldungeon.actors.mobs.Boss in project pixel-dungeon-remix by NYRDS.

the class ScrollOfDomination method doRead.

@Override
protected void doRead() {
    SpellSprite.show(getCurUser(), SpellSprite.DOMINATION);
    Sample.INSTANCE.play(Assets.SND_DOMINANCE);
    Invisibility.dispel(getCurUser());
    ArrayList<Mob> mobsInSight = new ArrayList<>();
    for (Mob mob : Dungeon.level.getCopyOfMobsArray()) {
        if (Dungeon.level.fieldOfView[mob.getPos()] && !(mob instanceof Boss) && !mob.isPet() && !(mob instanceof NPC)) {
            mobsInSight.add(mob);
        }
    }
    while (!mobsInSight.isEmpty()) {
        Mob pet = Random.element(mobsInSight);
        if (pet.canBePet()) {
            Mob.makePet(pet, getCurUser());
            new Flare(3, 32).show(pet.getSprite(), 2f);
            break;
        }
        mobsInSight.remove(pet);
    }
    Dungeon.observe();
    setKnown();
    getCurUser().spendAndNext(TIME_TO_READ);
}
Also used : NPC(com.watabou.pixeldungeon.actors.mobs.npcs.NPC) Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Boss(com.watabou.pixeldungeon.actors.mobs.Boss) Flare(com.watabou.pixeldungeon.effects.Flare) ArrayList(java.util.ArrayList)

Aggregations

Boss (com.watabou.pixeldungeon.actors.mobs.Boss)5 NPC (com.watabou.pixeldungeon.actors.mobs.npcs.NPC)4 Char (com.watabou.pixeldungeon.actors.Char)3 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)3 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)1 Hero (com.watabou.pixeldungeon.actors.hero.Hero)1 Flare (com.watabou.pixeldungeon.effects.Flare)1 ArrayList (java.util.ArrayList)1