Search in sources :

Example 21 with Mob

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

the class QuickSlot method useTargeting.

private void useTargeting() {
    targeting = lastTarget != null && lastTarget.isAlive() && Dungeon.visible[lastTarget.pos];
    if (targeting) {
        int pos = Ballistica.cast(Dungeon.hero.pos, lastTarget.pos, false, true);
        if (pos != lastTarget.pos) {
            lastTarget = null;
            targeting = false;
        }
    }
    if (!targeting) {
        int n = Dungeon.hero.visibleEnemies();
        for (int i = 0; i < n; i++) {
            Mob enemy = Dungeon.hero.visibleEnemy(i);
            int pos = Ballistica.cast(Dungeon.hero.pos, enemy.pos, false, true);
            if (pos == enemy.pos) {
                lastTarget = enemy;
                targeting = true;
                break;
            }
        }
    }
    if (targeting) {
        if (Actor.all().contains(lastTarget)) {
            lastTarget.sprite.parent.add(crossM);
            crossM.point(DungeonTilemap.tileToWorld(lastTarget.pos));
            crossB.visible = true;
        } else {
            lastTarget = null;
        }
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob)

Example 22 with Mob

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

the class AttackIndicator method checkEnemies.

private void checkEnemies() {
    int heroPos = Dungeon.hero.pos;
    candidates.clear();
    int v = Dungeon.hero.visibleEnemies();
    for (int i = 0; i < v; i++) {
        Mob mob = Dungeon.hero.visibleEnemy(i);
        if (Level.adjacent(heroPos, mob.pos)) {
            candidates.add(mob);
        }
    }
    if (!candidates.contains(lastTarget)) {
        if (candidates.isEmpty()) {
            lastTarget = null;
        } else {
            lastTarget = Random.element(candidates);
            updateImage();
            flash();
        }
    } else {
        if (!bg.visible) {
            flash();
        }
    }
    visible(lastTarget != null);
    enable(bg.visible);
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob)

Example 23 with Mob

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

the class DangerIndicator method onClick.

@Override
protected void onClick() {
    Mob target = Dungeon.hero.visibleEnemy(enemyIndex++);
    HealthIndicator.instance.target(target == HealthIndicator.instance.target() ? null : target);
    Camera.main.target = null;
    Camera.main.focusOn(target.sprite);
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob)

Example 24 with Mob

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

the class MageArmor method doSpecial.

@Override
public void doSpecial() {
    for (Mob mob : Dungeon.level.mobs) {
        if (Level.fieldOfView[mob.pos]) {
            Buff.affect(mob, Burning.class).reignite(mob);
            Buff.prolong(mob, Roots.class, 3);
        }
    }
    curUser.HP -= (curUser.HP / 3);
    curUser.spend(Actor.TICK);
    curUser.sprite.operate(curUser.pos);
    curUser.busy();
    curUser.sprite.centerEmitter().start(ElmoParticle.FACTORY, 0.15f, 4);
    Sample.INSTANCE.play(Assets.SND_READ);
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Burning(com.watabou.pixeldungeon.actors.buffs.Burning)

Example 25 with Mob

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

the class ScrollOfLullaby method doRead.

@Override
protected void doRead() {
    curUser.sprite.centerEmitter().start(Speck.factory(Speck.NOTE), 0.3f, 5);
    Sample.INSTANCE.play(Assets.SND_LULLABY);
    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, Sleep.class);
            if (mob.buff(Sleep.class) != null) {
                affected = mob;
                count++;
            }
        }
    }
    switch(count) {
        case 0:
            GLog.i("The scroll utters a soothing melody.");
            break;
        case 1:
            GLog.i("The scroll utters a soothing melody and the " + affected.name + " falls asleep!");
            break;
        default:
            GLog.i("The scroll utters a soothing melody and the monsters fall asleep!");
    }
    setKnown();
    readAnimation();
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Sleep(com.watabou.pixeldungeon.actors.buffs.Sleep)

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