Search in sources :

Example 26 with Mob

use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.

the class ScrollOfTerror method doRead.

@Override
protected void doRead() {
    new Flare(5, 32).color(0xFF0000, true).show(curUser.sprite, 2f);
    Sample.INSTANCE.play(Assets.SND_READ);
    Invisibility.dispel();
    int count = 0;
    Mob affected = null;
    for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
        if (Level.fieldOfView[mob.pos]) {
            Buff.affect(mob, Terror.class, Terror.DURATION).object = curUser.id();
            count++;
            affected = mob;
        }
    }
    switch(count) {
        case 0:
            GLog.i("The scroll emits a brilliant flash of red light");
            break;
        case 1:
            GLog.i("The scroll emits a brilliant flash of red light and the " + affected.name + " flees!");
            break;
        default:
            GLog.i("The scroll emits a brilliant flash of red light and the monsters flee!");
    }
    setKnown();
    readAnimation();
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Flare(com.watabou.pixeldungeon.effects.Flare)

Example 27 with Mob

use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.

the class WandOfAvalanche method onZap.

@Override
protected void onZap(int cell) {
    Sample.INSTANCE.play(Assets.SND_ROCKS);
    int level = power();
    Ballistica.distance = Math.min(Ballistica.distance, 8 + level);
    int size = 1 + level / 3;
    PathFinder.buildDistanceMap(cell, BArray.not(Level.solid, null), size);
    int shake = 0;
    for (int i = 0; i < Level.LENGTH; i++) {
        int d = PathFinder.distance[i];
        if (d < Integer.MAX_VALUE) {
            Char ch = Actor.findChar(i);
            if (ch != null) {
                ch.sprite.flash();
                ch.damage(Random.Int(2, 6 + (size - d) * 2), this);
                if (ch.isAlive() && Random.Int(2 + d) == 0) {
                    Buff.prolong(ch, Paralysis.class, Random.IntRange(2, 6));
                }
            }
            if (ch != null && ch.isAlive()) {
                if (ch instanceof Mob) {
                    Dungeon.level.mobPress((Mob) ch);
                } else {
                    Dungeon.level.press(i, ch);
                }
            } else {
                Dungeon.level.press(i, null);
            }
            if (Dungeon.visible[i]) {
                CellEmitter.get(i).start(Speck.factory(Speck.ROCK), 0.07f, 3 + (size - d));
                if (Level.water[i]) {
                    GameScene.ripple(i);
                }
                if (shake < size - d) {
                    shake = size - d;
                }
            }
        }
        Camera.main.shake(3, 0.07f * (3 + shake));
    }
    if (!curUser.isAlive()) {
        Dungeon.fail(Utils.format(ResultDescriptions.WAND, name, Dungeon.depth));
        GLog.n("You killed yourself with your own Wand of Avalanche...");
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Char(com.watabou.pixeldungeon.actors.Char)

Example 28 with Mob

use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.

the class CavesBossLevel method press.

@Override
public void press(int cell, Char hero) {
    super.press(cell, hero);
    if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
        enteredArena = true;
        Mob boss = Bestiary.mob(Dungeon.depth);
        boss.state = boss.HUNTING;
        do {
            boss.pos = Random.Int(LENGTH);
        } while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || Dungeon.visible[boss.pos]);
        GameScene.add(boss);
        set(arenaDoor, Terrain.WALL);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
        CellEmitter.get(arenaDoor).start(Speck.factory(Speck.ROCK), 0.07f, 10);
        Camera.main.shake(3, 0.7f);
        Sample.INSTANCE.play(Assets.SND_ROCKS);
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob)

Example 29 with Mob

use of com.watabou.pixeldungeon.actors.mobs.Mob in project pixel-dungeon by watabou.

the class CityBossLevel method press.

@Override
public void press(int cell, Char hero) {
    super.press(cell, hero);
    if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
        enteredArena = true;
        Mob boss = Bestiary.mob(Dungeon.depth);
        boss.state = boss.HUNTING;
        int count = 0;
        do {
            boss.pos = Random.Int(LENGTH);
        } while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || (Dungeon.visible[boss.pos] && count++ < 20));
        GameScene.add(boss);
        if (Dungeon.visible[boss.pos]) {
            boss.notice();
            boss.sprite.alpha(0);
            boss.sprite.parent.add(new AlphaTweener(boss.sprite, 1, 0.1f));
        }
        set(arenaDoor, Terrain.LOCKED_DOOR);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Aggregations

Mob (com.watabou.pixeldungeon.actors.mobs.Mob)29 Heap (com.watabou.pixeldungeon.items.Heap)6 Blob (com.watabou.pixeldungeon.actors.blobs.Blob)4 Flare (com.watabou.pixeldungeon.effects.Flare)3 Plant (com.watabou.pixeldungeon.plants.Plant)3 Char (com.watabou.pixeldungeon.actors.Char)2 HeroClass (com.watabou.pixeldungeon.actors.hero.HeroClass)2 Item (com.watabou.pixeldungeon.items.Item)2 HeroSprite (com.watabou.pixeldungeon.sprites.HeroSprite)2 Point (com.watabou.utils.Point)2 ArrayList (java.util.ArrayList)2 Group (com.watabou.noosa.Group)1 SkinnedBlock (com.watabou.noosa.SkinnedBlock)1 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)1 DungeonTilemap (com.watabou.pixeldungeon.DungeonTilemap)1 FogOfWar (com.watabou.pixeldungeon.FogOfWar)1 Actor (com.watabou.pixeldungeon.actors.Actor)1 Awareness (com.watabou.pixeldungeon.actors.buffs.Awareness)1 Blindness (com.watabou.pixeldungeon.actors.buffs.Blindness)1 Buff (com.watabou.pixeldungeon.actors.buffs.Buff)1